2010-06-10 08:18:21 -06:00
|
|
|
# -*- python -*-
|
2008-09-20 11:31:54 -06:00
|
|
|
|
2008-07-12 11:40:22 -06:00
|
|
|
import os
|
2008-07-30 03:12:52 -06:00
|
|
|
import sys
|
2008-11-13 01:12:48 -07:00
|
|
|
import platform
|
2008-07-12 11:40:22 -06:00
|
|
|
|
2008-09-21 07:13:20 -06:00
|
|
|
# Home made tests
|
|
|
|
sys.path.append('SconsTests')
|
2010-06-10 08:18:21 -06:00
|
|
|
import wxconfig
|
2008-09-21 13:54:29 -06:00
|
|
|
import utils
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2010-06-10 08:18:21 -06:00
|
|
|
# Some features need at least SCons 1.2
|
2009-06-08 08:36:00 -06:00
|
|
|
EnsureSConsVersion(1, 2)
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2010-06-09 13:41:17 -06:00
|
|
|
# Handle command line options
|
2008-09-21 09:55:27 -06:00
|
|
|
vars = Variables('args.cache')
|
2008-12-10 11:33:13 -07:00
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
vars.AddVariables(
|
2010-07-08 19:26:53 -06:00
|
|
|
BoolVariable('verbose', 'Set to show compilation lines', False),
|
|
|
|
BoolVariable('bundle', 'Set to create distribution bundle', False),
|
2010-07-23 17:16:28 -06:00
|
|
|
BoolVariable('lint', 'Set for lint build (fail on warnings)', False),
|
2010-06-26 13:17:43 -06:00
|
|
|
BoolVariable('nowx', 'Set for building with no WX libs', False),
|
2010-07-23 17:16:28 -06:00
|
|
|
PathVariable('wxconfig', 'Path to wxconfig', None),
|
2008-10-05 12:49:55 -06:00
|
|
|
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
2010-06-02 14:35:12 -06:00
|
|
|
allowed_values = ('release','devel','debug','fastlog','prof'),
|
2010-06-26 13:17:43 -06:00
|
|
|
ignorecase = 2),
|
2008-10-05 12:49:55 -06:00
|
|
|
)
|
2008-09-19 09:03:31 -06:00
|
|
|
|
2010-06-26 13:17:43 -06:00
|
|
|
if not sys.platform == 'win32' and not sys.platform == 'darwin':
|
|
|
|
vars.AddVariables(
|
|
|
|
PathVariable('destdir',
|
|
|
|
'Temporary install location (for package building)',
|
|
|
|
None, PathVariable.PathAccept),
|
|
|
|
EnumVariable('install',
|
|
|
|
'Choose a local or global installation', 'local',
|
|
|
|
allowed_values = ('local', 'global'), ignorecase = 2),
|
|
|
|
PathVariable('prefix',
|
|
|
|
'Installation prefix (only used for a global build)',
|
|
|
|
'/usr', PathVariable.PathAccept),
|
|
|
|
PathVariable('userdir',
|
|
|
|
'Set the name of the user data directory in home',
|
|
|
|
'.dolphin-emu', PathVariable.PathAccept),
|
|
|
|
BoolVariable('opencl', 'Build with OpenCL', False),
|
2010-07-08 19:26:53 -06:00
|
|
|
EnumVariable('pgo', 'Profile-Guided Optimization (generate or use)',
|
|
|
|
'none', allowed_values = ('none', 'generate', 'use'),
|
|
|
|
ignorecase = 2),
|
2010-06-26 13:17:43 -06:00
|
|
|
BoolVariable('shared_glew', 'Use system shared libGLEW', True),
|
|
|
|
BoolVariable('shared_lzo', 'Use system shared liblzo2', True),
|
|
|
|
BoolVariable('shared_sdl', 'Use system shared libSDL', True),
|
|
|
|
BoolVariable('shared_sfml', 'Use system shared libsfml-network', True),
|
|
|
|
BoolVariable('shared_soil', 'Use system shared libSOIL', True),
|
|
|
|
BoolVariable('shared_zlib', 'Use system shared libz', True),
|
2010-07-23 17:16:28 -06:00
|
|
|
('CC', 'The C compiler', 'gcc'),
|
|
|
|
('CXX', 'The C++ compiler', 'g++'),
|
2010-06-26 13:17:43 -06:00
|
|
|
)
|
|
|
|
|
2010-07-23 17:16:28 -06:00
|
|
|
env = Environment(ENV = os.environ, variables = vars)
|
2010-07-24 07:10:54 -06:00
|
|
|
Export('env')
|
2008-09-21 09:55:27 -06:00
|
|
|
|
2010-07-24 07:10:54 -06:00
|
|
|
# Die on unknown variables
|
|
|
|
unknown = vars.UnknownVariables()
|
|
|
|
if unknown:
|
|
|
|
print "Unknown variables:", unknown.keys()
|
|
|
|
Exit(1)
|
|
|
|
|
|
|
|
# Save the given command line options
|
|
|
|
vars.Save('args.cache', env)
|
2008-09-21 13:54:29 -06:00
|
|
|
|
2010-07-23 17:16:28 -06:00
|
|
|
cppDefines = [
|
|
|
|
( '_FILE_OFFSET_BITS', 64),
|
|
|
|
'_LARGEFILE_SOURCE',
|
|
|
|
'GCC_HASCLASSVISIBILITY',
|
|
|
|
]
|
|
|
|
|
|
|
|
ccFlags = [
|
|
|
|
'-Wall',
|
|
|
|
'-Wpacked',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wshadow',
|
|
|
|
'-Wwrite-strings',
|
|
|
|
'-fPIC',
|
|
|
|
'-fno-exceptions',
|
2010-07-24 07:10:54 -06:00
|
|
|
'-fno-strict-aliasing',
|
2010-07-24 04:24:16 -06:00
|
|
|
'-fvisibility=hidden',
|
2010-07-23 17:16:28 -06:00
|
|
|
'-msse2',
|
|
|
|
]
|
|
|
|
|
|
|
|
if env['CCVERSION'] >= '4.3.0': ccFlags += [
|
|
|
|
'-Wno-array-bounds', # False positives
|
|
|
|
'-Wno-unused-result', # Too many syscalls
|
|
|
|
]
|
|
|
|
|
2010-06-09 13:41:17 -06:00
|
|
|
# Build flavor
|
2010-07-24 07:10:54 -06:00
|
|
|
if env['flavor'] == 'debug':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-ggdb')
|
2009-03-05 09:26:05 -07:00
|
|
|
cppDefines.append('_DEBUG') #enables LOGGING
|
2008-12-19 02:36:27 -07:00
|
|
|
# FIXME: this disable wx debugging how do we make it work?
|
2010-06-10 08:18:21 -06:00
|
|
|
cppDefines.append('NDEBUG')
|
2010-07-24 07:10:54 -06:00
|
|
|
elif env['flavor'] == 'devel':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-ggdb')
|
2010-07-24 07:10:54 -06:00
|
|
|
elif env['flavor'] == 'fastlog':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-O3')
|
2009-03-05 09:26:05 -07:00
|
|
|
cppDefines.append('DEBUGFAST')
|
2010-07-24 07:10:54 -06:00
|
|
|
elif env['flavor'] == 'prof':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-O3')
|
|
|
|
ccFlags.append('-ggdb')
|
2010-07-24 07:10:54 -06:00
|
|
|
elif env['flavor'] == 'release':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-O3')
|
|
|
|
ccFlags.append('-fomit-frame-pointer');
|
2010-07-24 07:10:54 -06:00
|
|
|
|
|
|
|
if env['flavor'] == 'debug':
|
|
|
|
extra = '-debug'
|
|
|
|
elif env['flavor'] == 'prof':
|
|
|
|
extra = '-prof'
|
|
|
|
else:
|
|
|
|
extra = ''
|
|
|
|
|
2008-09-20 16:06:22 -06:00
|
|
|
if env['lint']:
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-Werror')
|
2010-02-05 02:53:33 -07:00
|
|
|
|
2010-07-24 07:10:54 -06:00
|
|
|
# Verbose compile
|
|
|
|
if not env['verbose']:
|
|
|
|
env['CCCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['CXXCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['ARCOMSTR'] = "Archiving $TARGET"
|
|
|
|
env['LINKCOMSTR'] = "Linking $TARGET"
|
|
|
|
env['ASCOMSTR'] = "Assembling $TARGET"
|
|
|
|
env['ASPPCOMSTR'] = "Assembling $TARGET"
|
|
|
|
env['SHCCCOMSTR'] = "Compiling shared $TARGET"
|
|
|
|
env['SHCXXCOMSTR'] = "Compiling shared $TARGET"
|
|
|
|
env['SHLINKCOMSTR'] = "Linking shared $TARGET"
|
|
|
|
env['RANLIBCOMSTR'] = "Indexing $TARGET"
|
|
|
|
|
2010-07-23 17:16:28 -06:00
|
|
|
dirs = [
|
|
|
|
'Externals/Bochs_disasm',
|
|
|
|
'Externals/Lua',
|
|
|
|
'Externals/MemcardManager',
|
|
|
|
'Externals/WiiUse/Src',
|
|
|
|
'Source/Core/AudioCommon/Src',
|
|
|
|
'Source/Core/Common/Src',
|
|
|
|
'Source/Core/Core/Src',
|
|
|
|
'Source/Core/DSPCore/Src',
|
|
|
|
'Source/Core/DebuggerUICommon/Src',
|
|
|
|
'Source/Core/DebuggerWX/Src',
|
|
|
|
'Source/Core/DiscIO/Src',
|
|
|
|
'Source/Core/DolphinWX/Src',
|
|
|
|
'Source/Core/InputCommon/Src',
|
|
|
|
'Source/Core/InputUICommon/Src',
|
|
|
|
'Source/Core/VideoCommon/Src',
|
|
|
|
'Source/DSPTool/Src',
|
|
|
|
'Source/Plugins/Plugin_DSP_HLE/Src',
|
|
|
|
'Source/Plugins/Plugin_DSP_LLE/Src',
|
2010-07-24 07:10:54 -06:00
|
|
|
'Source/Plugins/Plugin_VideoOGL/Src',
|
2010-07-23 17:16:28 -06:00
|
|
|
'Source/Plugins/Plugin_VideoSoftware/Src',
|
|
|
|
'Source/Plugins/Plugin_Wiimote/Src',
|
|
|
|
'Source/Plugins/Plugin_WiimoteNew/Src',
|
|
|
|
'Source/UnitTests',
|
|
|
|
]
|
|
|
|
|
2010-06-09 13:41:17 -06:00
|
|
|
# Object files
|
2010-07-24 07:10:54 -06:00
|
|
|
env['build_dir'] = 'Build' + os.sep + platform.system() + \
|
|
|
|
'-' + platform.machine() + '-' + env['flavor']
|
2009-04-12 15:30:22 -06:00
|
|
|
|
2010-05-26 15:31:50 -06:00
|
|
|
# Static libs go here
|
2010-07-19 22:50:43 -06:00
|
|
|
env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep
|
2008-12-10 17:45:14 -07:00
|
|
|
|
2010-07-24 11:39:17 -06:00
|
|
|
# Default install path
|
|
|
|
if not env.has_key('install') or env['install'] == 'local':
|
|
|
|
env['prefix'] = 'Binary' + os.sep + platform.system() + \
|
|
|
|
'-' + platform.machine() + extra
|
2010-02-02 14:56:29 -07:00
|
|
|
|
2010-07-23 17:16:28 -06:00
|
|
|
# Configuration tests section
|
|
|
|
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
|
|
|
|
'CheckPKGConfig' : utils.CheckPKGConfig,
|
|
|
|
'CheckPKG' : utils.CheckPKG,
|
|
|
|
'CheckSDL' : utils.CheckSDL,
|
|
|
|
'CheckPortaudio' : utils.CheckPortaudio,
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:10:54 -06:00
|
|
|
rev = utils.GenerateRevFile(env['flavor'],
|
|
|
|
"Source/Core/Common/Src/svnrev_template.h",
|
|
|
|
"Source/Core/Common/Src/svnrev.h")
|
|
|
|
|
2010-07-23 17:16:28 -06:00
|
|
|
env['CCFLAGS'] = ccFlags
|
|
|
|
env['CPPDEFINES'] = cppDefines
|
|
|
|
env['CPPPATH'] = ['#' + path for path in dirs]
|
|
|
|
env['CPPPATH'] += ['#Source/PluginSpecs']
|
|
|
|
env['CXXFLAGS'] = ['-fvisibility-inlines-hidden']
|
|
|
|
env['LIBPATH'] = []
|
|
|
|
env['LIBS'] = []
|
|
|
|
env['RPATH'] = []
|
|
|
|
|
2010-06-14 12:07:29 -06:00
|
|
|
# OS X specifics
|
|
|
|
if sys.platform == 'darwin':
|
2010-07-23 17:16:28 -06:00
|
|
|
gccflags = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
|
|
|
env['CCFLAGS'] += gccflags
|
2010-07-24 04:24:16 -06:00
|
|
|
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
|
|
|
|
env['CC'] = "gcc-4.2 -ObjC"
|
|
|
|
env['CXX'] = "g++-4.2 -ObjC++"
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
env['FRAMEWORKS'] += ['AppKit', 'CoreFoundation', 'CoreServices']
|
|
|
|
env['FRAMEWORKS'] += ['AudioUnit', 'CoreAudio']
|
|
|
|
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
|
2010-07-17 23:31:51 -06:00
|
|
|
env['LIBS'] += ['iconv']
|
2010-07-23 17:16:28 -06:00
|
|
|
env['LINKFLAGS'] += gccflags
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
env['LINKFLAGS'] += ['-Z', '-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib',
|
|
|
|
'-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks',
|
|
|
|
'-F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks']
|
2010-07-24 11:39:17 -06:00
|
|
|
if platform.mac_ver()[0] < '10.6.0':
|
|
|
|
env['HAVE_OPENCL'] = 0
|
|
|
|
else:
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
env['HAVE_OPENCL'] = 1
|
|
|
|
env['LINKFLAGS'] += ['-weak_framework', 'OpenCL']
|
2010-07-24 11:39:17 -06:00
|
|
|
if env['nowx']:
|
|
|
|
env['HAVE_WX'] = 0
|
|
|
|
else:
|
2010-07-08 19:26:53 -06:00
|
|
|
conf = env.Configure(custom_tests = tests)
|
2010-07-24 11:39:17 -06:00
|
|
|
env['HAVE_WX'] = conf.CheckWXConfig(2.9,
|
|
|
|
['aui', 'adv', 'core', 'base', 'gl'], 0)
|
2010-07-08 19:26:53 -06:00
|
|
|
conf.Finish()
|
|
|
|
# wx-config wants us to link with the OS X QuickTime framework
|
|
|
|
# which is not available for x86_64 and we don't use it anyway.
|
|
|
|
# Strip it out to silence some harmless linker warnings.
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
# In the 10.5 SDK, Carbon is only partially built for x86_64.
|
2010-07-23 17:16:28 -06:00
|
|
|
frameworks = env['FRAMEWORKS']
|
2010-07-19 22:50:43 -06:00
|
|
|
wxconfig.ParseWXConfig(env)
|
2010-07-10 15:17:08 -06:00
|
|
|
if env['CPPDEFINES'].count('WXUSINGDLL'):
|
2010-07-19 22:50:43 -06:00
|
|
|
env['FRAMEWORKS'] = frameworks
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
env['CPPPATH'] += ['#Externals']
|
2010-06-26 13:17:43 -06:00
|
|
|
env['FRAMEWORKS'] += ['Cg']
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
env['LINKFLAGS'] += ['-FExternals/Cg']
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_zlib'] = True
|
|
|
|
env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources'
|
|
|
|
env['plugin_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/PlugIns'
|
2010-07-24 07:10:54 -06:00
|
|
|
env.Install(env['data_dir'], 'Data/Sys')
|
|
|
|
env.Install(env['data_dir'], 'Data/User')
|
2010-07-24 11:39:17 -06:00
|
|
|
dirs += ['Externals/dylibbundler']
|
2010-07-24 07:10:54 -06:00
|
|
|
if env['bundle']:
|
2010-07-24 11:39:17 -06:00
|
|
|
app = env['prefix'] + '/Dolphin.app'
|
|
|
|
dmg = env['prefix'] + '/Dolphin-r' + rev + '.dmg'
|
2010-07-24 07:10:54 -06:00
|
|
|
env.Command(dmg, app, 'rm -f ' + dmg +
|
|
|
|
' && hdiutil create -srcfolder ' + app + ' -format UDBZ ' + dmg +
|
|
|
|
' && hdiutil internet-enable -yes ' + dmg)
|
2010-07-08 19:26:53 -06:00
|
|
|
|
2010-07-19 20:45:31 -06:00
|
|
|
elif sys.platform == 'win32':
|
|
|
|
env['tools'] = ['mingw']
|
2010-07-24 11:39:17 -06:00
|
|
|
dirs += ['Source/Plugins/Plugin_VideoDX9/Src']
|
|
|
|
dirs += ['Source/Plugins/Plugin_VideoDX11/Src']
|
2010-07-19 20:45:31 -06:00
|
|
|
|
|
|
|
else:
|
2010-07-23 17:16:28 -06:00
|
|
|
env['CCFLAGS'] += ['-pthread']
|
2010-07-23 17:51:34 -06:00
|
|
|
env['CXXFLAGS'] += ['-Wno-deprecated'] # XXX <hash_map>
|
2010-07-21 21:29:35 -06:00
|
|
|
env['CPPPATH'].insert(0, '#')
|
|
|
|
env['LINKFLAGS'] += ['-pthread']
|
2010-07-19 20:45:31 -06:00
|
|
|
conf = env.Configure(custom_tests = tests, config_h="#config.h")
|
2010-07-08 19:26:53 -06:00
|
|
|
|
2010-06-16 05:39:23 -06:00
|
|
|
if not conf.CheckPKGConfig('0.15.0'):
|
|
|
|
print "Can't find pkg-config, some tests will fail"
|
2010-06-14 12:07:29 -06:00
|
|
|
|
2010-06-16 19:18:22 -06:00
|
|
|
if env['shared_glew']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_glew'] = conf.CheckPKG('GLEW')
|
2010-06-16 19:18:22 -06:00
|
|
|
if env['shared_sdl']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_sdl'] = conf.CheckPKG('SDL')
|
2010-06-16 19:18:22 -06:00
|
|
|
if env['shared_zlib']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_zlib'] = conf.CheckPKG('z')
|
2010-06-16 19:18:22 -06:00
|
|
|
if env['shared_lzo']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_lzo'] = conf.CheckPKG('lzo2')
|
2010-06-16 19:18:22 -06:00
|
|
|
# TODO: Check the version of sfml. It should be at least version 1.5
|
|
|
|
if env['shared_sfml']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_sfml'] = conf.CheckPKG('sfml-network') and \
|
2010-06-16 10:35:19 -06:00
|
|
|
conf.CheckCXXHeader("SFML/Network/Ftp.hpp")
|
2010-06-16 19:18:22 -06:00
|
|
|
if env['shared_soil']:
|
2010-07-24 11:39:17 -06:00
|
|
|
env['shared_soil'] = conf.CheckPKG('SOIL')
|
|
|
|
for var in env.items():
|
|
|
|
if var[0].startswith('shared_') and var[1] == False:
|
|
|
|
print "Shared library " + var[0][7:] + " not detected, " \
|
2010-06-16 05:39:23 -06:00
|
|
|
"falling back to the static library"
|
|
|
|
|
2010-07-24 11:39:17 -06:00
|
|
|
if env['nowx']:
|
|
|
|
env['HAVE_WX'] = 0
|
|
|
|
else:
|
|
|
|
env['HAVE_WX'] = conf.CheckWXConfig(2.8,
|
|
|
|
['aui', 'adv', 'core', 'base', 'gl'], 0)
|
Maintaining Leopard binary compatibility turns out be a a bit cumbersome.
For a typical OS X app, one only needs to specify the SDK version and the
target OS version range.
Because we use OpenCL which is new in 10.6, however, we must be somewhat
more verbose in order to make use of the forward compatibility facilities.
Unfortunately, the critical bit that is required to have binaries built
on 10.6 work on 10.5, namely disabling the new compact __LINKEDIT format,
causes stack alignment crashes at emulation time on 10.6, so for now
Leopard users still have to build Dolphin themselves.
Hopefully, this stack alignment problem will turn out to be coincident
with lingering alignment issues.
Include the OS X version of the Cg framework in Externals as with the
Windows one. The header files appear to be the same in the Windows and the
OS X builds of the February 2.2 Cg toolkit, although they are differently
munged by what appears to be some automatic process, so no new duplicates.
Any upgrades to the Cg libraries will of course need to be done in sync.
I do hope that Sonicadvance1's GLSL work will enable us to get rid of Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5893 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-17 13:43:26 -06:00
|
|
|
conf.Define('HAVE_WX', env['HAVE_WX'])
|
2010-07-08 19:26:53 -06:00
|
|
|
wxconfig.ParseWXConfig(env)
|
2010-07-09 16:31:04 -06:00
|
|
|
if not env['HAVE_WX']:
|
|
|
|
print "WX libraries not found - see config.log"
|
|
|
|
Exit(1)
|
2010-06-10 08:18:21 -06:00
|
|
|
|
2010-07-21 21:29:35 -06:00
|
|
|
conf.CheckPKG('usbhid')
|
|
|
|
|
2010-06-15 18:07:52 -06:00
|
|
|
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ'])
|
2010-06-15 18:07:52 -06:00
|
|
|
|
|
|
|
env['HAVE_ALSA'] = conf.CheckPKG('alsa')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_ALSA', env['HAVE_ALSA'])
|
2010-06-15 18:07:52 -06:00
|
|
|
env['HAVE_AO'] = conf.CheckPKG('ao')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_AO', env['HAVE_AO'])
|
2010-06-15 18:07:52 -06:00
|
|
|
env['HAVE_OPENAL'] = conf.CheckPKG('openal')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_OPENAL', env['HAVE_OPENAL'])
|
2010-07-19 20:45:31 -06:00
|
|
|
env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890)
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO'])
|
2010-06-15 18:07:52 -06:00
|
|
|
env['HAVE_PULSEAUDIO'] = conf.CheckPKG('libpulse-simple')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_PULSEAUDIO', env['HAVE_PULSEAUDIO'])
|
2010-06-15 18:07:52 -06:00
|
|
|
|
2010-06-14 12:07:29 -06:00
|
|
|
env['HAVE_X11'] = conf.CheckPKG('x11')
|
|
|
|
env['HAVE_XRANDR'] = env['HAVE_X11'] and conf.CheckPKG('xrandr')
|
2010-06-26 13:17:43 -06:00
|
|
|
conf.Define('HAVE_XRANDR', env['HAVE_XRANDR'])
|
|
|
|
conf.Define('HAVE_X11', env['HAVE_X11'])
|
|
|
|
|
|
|
|
# Check for GTK 2.0 or newer
|
|
|
|
if env['HAVE_WX'] and not conf.CheckPKG('gtk+-2.0'):
|
|
|
|
print "gtk+-2.0 developement headers not detected"
|
|
|
|
print "gtk+-2.0 is required to build the WX GUI"
|
|
|
|
Exit(1)
|
|
|
|
|
2010-06-10 08:18:21 -06:00
|
|
|
if not conf.CheckPKG('GL'):
|
|
|
|
print "Must have OpenGL to build"
|
|
|
|
Exit(1)
|
|
|
|
if not conf.CheckPKG('GLU'):
|
|
|
|
print "Must have GLU to build"
|
|
|
|
Exit(1)
|
2010-07-23 17:16:28 -06:00
|
|
|
if not conf.CheckPKG('Cg') and sys.platform == 'linux2':
|
|
|
|
print "Must have Cg toolkit from NVidia to build"
|
|
|
|
Exit(1)
|
|
|
|
if not conf.CheckPKG('CgGL') and sys.platform == 'linux2':
|
|
|
|
print "Must have CgGL to build"
|
|
|
|
Exit(1)
|
2010-07-08 19:26:53 -06:00
|
|
|
|
2010-06-26 13:17:43 -06:00
|
|
|
if env['opencl']:
|
|
|
|
env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL')
|
2010-07-10 15:17:08 -06:00
|
|
|
conf.Define('HAVE_OPENCL', env['HAVE_OPENCL'])
|
2010-07-24 11:39:17 -06:00
|
|
|
else:
|
|
|
|
env['HAVE_OPENCL'] = 0
|
2010-06-10 08:18:21 -06:00
|
|
|
|
2010-07-08 19:26:53 -06:00
|
|
|
# PGO - Profile Guided Optimization
|
|
|
|
if env['pgo']=='generate':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-fprofile-generate')
|
2010-07-08 19:26:53 -06:00
|
|
|
env['LINKFLAGS']='-fprofile-generate'
|
|
|
|
if env['pgo']=='use':
|
2010-07-23 17:16:28 -06:00
|
|
|
ccFlags.append('-fprofile-use')
|
2010-07-08 19:26:53 -06:00
|
|
|
env['LINKFLAGS']='-fprofile-use'
|
|
|
|
|
|
|
|
# Profiling
|
2010-07-24 07:10:54 -06:00
|
|
|
if (env['flavor'] == 'prof'):
|
2010-07-08 19:26:53 -06:00
|
|
|
proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ]
|
|
|
|
env['LIBPATH'].append(proflibs)
|
|
|
|
env['RPATH'].append(proflibs)
|
|
|
|
if conf.CheckPKG('opagent'):
|
|
|
|
conf.Define('USE_OPROFILE', 1)
|
|
|
|
else:
|
|
|
|
print "Can't build prof without oprofile, disabling"
|
|
|
|
|
2010-07-24 11:39:17 -06:00
|
|
|
if env['install'] == 'local':
|
2010-07-24 07:10:54 -06:00
|
|
|
env['binary_dir'] = '#' + env['prefix']
|
|
|
|
env['data_dir'] = '#' + env['prefix']
|
2010-07-24 11:39:17 -06:00
|
|
|
env['plugin_dir'] = '#' + env['prefix'] + '/plugins'
|
|
|
|
else:
|
|
|
|
env['prefix'] = Dir(env['prefix']).abspath
|
|
|
|
env['binary_dir'] = env['prefix'] + '/bin'
|
|
|
|
env['data_dir'] = env['prefix'] + "/share/dolphin-emu"
|
|
|
|
env['plugin_dir'] = env['prefix'] + '/lib/dolphin-emu'
|
|
|
|
conf.Define('DATA_DIR', "\"" + env['data_dir'] + "\"")
|
|
|
|
conf.Define('LIBS_DIR', "\"" + env['prefix'] + '/lib/' + "\"")
|
|
|
|
# Setup destdir for package building
|
|
|
|
# Warning: The program will not run from this location.
|
|
|
|
# It is assumed the package will later install it to the prefix.
|
|
|
|
if env.has_key('destdir'):
|
|
|
|
env['destdir'] = Dir(env['destdir']).abspath
|
|
|
|
env['binary_dir'] = env['destdir'] + env['binary_dir']
|
|
|
|
env['data_dir'] = env['destdir'] + env['data_dir']
|
|
|
|
env['plugin_dir'] = env['destdir'] + env['plugin_dir']
|
|
|
|
env['prefix'] = env['destdir'] + env['prefix']
|
2010-07-24 07:10:54 -06:00
|
|
|
|
|
|
|
conf.Define('USER_DIR', "\"" + env['userdir'] + "\"")
|
2010-07-23 17:16:28 -06:00
|
|
|
|
2010-07-08 19:26:53 -06:00
|
|
|
# After all configuration tests are done
|
|
|
|
conf.Finish()
|
|
|
|
|
2010-07-24 08:21:05 -06:00
|
|
|
if env['bundle']:
|
2010-07-24 11:39:17 -06:00
|
|
|
if env['install'] == 'global' and not env.has_key('destdir'):
|
|
|
|
print 'Not tarring up ' + env['prefix']
|
|
|
|
else:
|
|
|
|
env.Tar('dolphin-' + rev + '.tar.bz2', env['prefix'],
|
|
|
|
TARFLAGS='-cj', TARCOMSTR='Creating release tarball')
|
2010-07-24 07:10:54 -06:00
|
|
|
|
|
|
|
# Data install
|
2010-07-24 11:39:17 -06:00
|
|
|
env.InstallAs(env['data_dir'] + '/sys', 'Data/Sys')
|
|
|
|
env.InstallAs(env['data_dir'] + '/user', 'Data/User')
|
|
|
|
|
|
|
|
env.Alias('install', env['prefix'])
|
2010-07-24 07:10:54 -06:00
|
|
|
|
2010-07-08 19:26:53 -06:00
|
|
|
# Local (static) libraries must be first in the search path for the build in
|
|
|
|
# order that they can override system libraries, but they must not be found
|
|
|
|
# during autoconfiguration as they will then be detected as system libraries.
|
|
|
|
env['LIBPATH'].insert(0, env['local_libs'])
|
|
|
|
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_glew') or not env['shared_glew']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/GLew/include']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/GLew']
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_lzo') or not env['shared_lzo']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/LZO']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/LZO']
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_sdl') or not env['shared_sdl']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/SDL']
|
|
|
|
env['CPPPATH'] += ['#Externals/SDL/include']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/SDL']
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_soil') or not env['shared_soil']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/SOIL']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/SOIL']
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_sfml') or not env['shared_sfml']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/SFML/include']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/SFML/src']
|
2010-07-24 11:39:17 -06:00
|
|
|
if not env.has_key('shared_zlib') or not env['shared_zlib']:
|
2010-07-18 21:42:37 -06:00
|
|
|
env['CPPPATH'] += ['#Externals/zlib']
|
2010-07-08 19:26:53 -06:00
|
|
|
dirs += ['Externals/zlib']
|
2010-06-16 06:42:49 -06:00
|
|
|
|
2008-08-26 15:02:23 -06:00
|
|
|
for subdir in dirs:
|
2010-07-24 07:10:54 -06:00
|
|
|
SConscript(subdir + os.sep + 'SConscript',
|
|
|
|
variant_dir = env['build_dir'] + os.sep + subdir, duplicate = 0)
|
2010-02-02 14:56:29 -07:00
|
|
|
|
2010-07-24 07:10:54 -06:00
|
|
|
# Print a nice progress indication when not compiling
|
|
|
|
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
|
2010-07-24 11:39:17 -06:00
|
|
|
|
|
|
|
# Generate help
|
|
|
|
Help(vars.GenerateHelpText(env))
|