2010-06-10 14:18:21 +00:00
|
|
|
# -*- python -*-
|
2008-09-20 17:31:54 +00:00
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
import os
|
2008-07-30 09:12:52 +00:00
|
|
|
import sys
|
2008-11-13 08:12:48 +00:00
|
|
|
import platform
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-09-21 13:13:20 +00:00
|
|
|
# Home made tests
|
2010-08-01 16:30:22 +00:00
|
|
|
from SconsTests import utils
|
|
|
|
from SconsTests import wxconfig
|
2008-09-21 13:13:20 +00:00
|
|
|
|
2010-06-10 14:18:21 +00:00
|
|
|
# Some features need at least SCons 1.2
|
2009-06-08 14:36:00 +00:00
|
|
|
EnsureSConsVersion(1, 2)
|
2008-09-21 13:13:20 +00:00
|
|
|
|
2010-08-01 16:30:22 +00:00
|
|
|
# Construction presets for platform
|
|
|
|
env = Environment(ENV = os.environ)
|
|
|
|
|
2010-06-09 19:41:17 +00:00
|
|
|
# Handle command line options
|
2008-09-21 15:55:27 +00:00
|
|
|
vars = Variables('args.cache')
|
2008-12-10 18:33:13 +00:00
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
vars.AddVariables(
|
2010-07-09 01:26:53 +00:00
|
|
|
BoolVariable('verbose', 'Set to show compilation lines', False),
|
|
|
|
BoolVariable('bundle', 'Set to create distribution bundle', False),
|
2010-07-23 23:16:28 +00:00
|
|
|
BoolVariable('lint', 'Set for lint build (fail on warnings)', False),
|
2010-08-01 16:30:22 +00:00
|
|
|
BoolVariable('nowx', 'Set for building without wxWidgets', False),
|
2010-07-23 23:16:28 +00:00
|
|
|
PathVariable('wxconfig', 'Path to wxconfig', None),
|
2010-08-01 16:30:22 +00:00
|
|
|
EnumVariable('flavor', 'Choose a build flavor', 'release', allowed_values =
|
|
|
|
('release','devel','debug','fastlog','prof'), ignorecase = 2),
|
|
|
|
)
|
|
|
|
|
|
|
|
if env['PLATFORM'] == 'posix': 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),
|
|
|
|
EnumVariable('pgo', 'Profile-Guided Optimization (generate or use)', 'none',
|
|
|
|
allowed_values = ('none', 'generate', 'use'), ignorecase = 2),
|
|
|
|
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),
|
|
|
|
PathVariable('CC', 'The C compiler', 'gcc', PathVariable.PathAccept),
|
|
|
|
PathVariable('CXX', 'The C++ compiler', 'g++', PathVariable.PathAccept),
|
2008-10-05 18:49:55 +00:00
|
|
|
)
|
2008-09-19 15:03:31 +00:00
|
|
|
|
2010-08-01 16:30:22 +00:00
|
|
|
# Save the given command line options
|
|
|
|
vars.Update(env)
|
|
|
|
vars.Save('args.cache', env)
|
2008-09-21 15:55:27 +00:00
|
|
|
|
2010-07-24 13:10:54 +00:00
|
|
|
# Die on unknown variables
|
|
|
|
unknown = vars.UnknownVariables()
|
|
|
|
if unknown:
|
|
|
|
print "Unknown variables:", unknown.keys()
|
|
|
|
Exit(1)
|
|
|
|
|
|
|
|
# Verbose compile
|
|
|
|
if not env['verbose']:
|
|
|
|
env['ARCOMSTR'] = "Archiving $TARGET"
|
|
|
|
env['ASCOMSTR'] = "Assembling $TARGET"
|
|
|
|
env['ASPPCOMSTR'] = "Assembling $TARGET"
|
2010-07-24 23:09:43 +00:00
|
|
|
env['CCCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['CXXCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['LINKCOMSTR'] = "Linking $TARGET"
|
2010-07-24 13:10:54 +00:00
|
|
|
env['RANLIBCOMSTR'] = "Indexing $TARGET"
|
2010-07-24 23:09:43 +00:00
|
|
|
env['SHCCCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['SHCXXCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['SHLINKCOMSTR'] = "Linking $TARGET"
|
|
|
|
env['TARCOMSTR'] = "Creating $TARGET"
|
2010-07-24 13:10:54 +00:00
|
|
|
|
2010-08-01 16:30:22 +00:00
|
|
|
if not env['flavor'] == 'debug':
|
|
|
|
env['CCFLAGS'] += ['-O3']
|
|
|
|
if env['flavor'] == 'release':
|
|
|
|
env['CCFLAGS'] += ['-fomit-frame-pointer']
|
|
|
|
elif not env['flavor'] == 'fastlog':
|
|
|
|
env['CCFLAGS'] += ['-ggdb']
|
|
|
|
env['CCFLAGS'] += ['-fno-exceptions', '-fno-strict-aliasing']
|
|
|
|
|
|
|
|
if env['lint']:
|
|
|
|
env['CCFLAGS'] += ['-Werror']
|
|
|
|
env['CCFLAGS'] += ['-Wall', '-Wextra']
|
|
|
|
env['CCFLAGS'] += ['-Wno-missing-field-initializers', '-Wno-unused-parameter']
|
|
|
|
env['CCFLAGS'] += ['-Wpacked', '-Wpointer-arith', '-Wshadow', '-Wwrite-strings']
|
|
|
|
if env['CCVERSION'] < '4.2.0':
|
|
|
|
env['CCFLAGS'] += ['-Wno-pragmas']
|
|
|
|
if env['CCVERSION'] >= '4.3.0':
|
|
|
|
env['CCFLAGS'] += ['-Wno-array-bounds', '-Wno-unused-result']
|
|
|
|
|
2010-11-04 21:27:03 +00:00
|
|
|
env['CPPDEFINES'] = []
|
2010-08-01 16:30:22 +00:00
|
|
|
if env['flavor'] == 'debug':
|
|
|
|
env['CPPDEFINES'] += ['_DEBUG']
|
|
|
|
elif env['flavor'] == 'fastlog':
|
|
|
|
env['CPPDEFINES'] += ['DEBUGFAST']
|
2010-11-13 19:44:19 +00:00
|
|
|
env['CPPPATH'] = ['#Source/PluginSpecs']
|
2010-08-01 16:30:22 +00:00
|
|
|
env['LIBPATH'] = []
|
|
|
|
env['LIBS'] = []
|
|
|
|
|
2010-06-09 19:41:17 +00:00
|
|
|
# Object files
|
2010-07-24 13:10:54 +00:00
|
|
|
env['build_dir'] = 'Build' + os.sep + platform.system() + \
|
|
|
|
'-' + platform.machine() + '-' + env['flavor']
|
2009-04-12 21:30:22 +00:00
|
|
|
|
2010-05-26 21:31:50 +00:00
|
|
|
# Static libs go here
|
2010-07-20 04:50:43 +00:00
|
|
|
env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep
|
2008-12-11 00:45:14 +00:00
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
# Default install path
|
|
|
|
if not env.has_key('install') or env['install'] == 'local':
|
|
|
|
env['prefix'] = 'Binary' + os.sep + platform.system() + \
|
2010-08-01 16:30:22 +00:00
|
|
|
'-' + platform.machine()
|
2010-08-10 08:30:04 +00:00
|
|
|
if env['flavor'] == 'debug' or env['flavor'] == 'prof':
|
|
|
|
env['prefix'] += '-' + env['flavor']
|
2010-08-01 16:30:22 +00:00
|
|
|
|
|
|
|
rev = utils.GenerateRevFile(env['flavor'], '.', None)
|
2010-07-23 23:16:28 +00:00
|
|
|
|
2010-06-14 18:07:29 +00:00
|
|
|
# OS X specifics
|
|
|
|
if sys.platform == 'darwin':
|
2010-12-05 16:18:09 +00:00
|
|
|
ccld = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5.4']
|
2010-10-24 20:07:12 +00:00
|
|
|
ccld += ['--sysroot=/Developer/SDKs/MacOSX10.5.sdk']
|
2010-11-13 20:02:01 +00:00
|
|
|
system = '/System/Library/Frameworks'
|
2010-08-01 16:30:22 +00:00
|
|
|
env['CCFLAGS'] += ccld
|
2011-01-22 02:18:25 +00:00
|
|
|
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
|
2010-12-27 22:17:19 +00:00
|
|
|
env['CCFLAGS'] += ['-Xarch_i386', '-msse3', '-Xarch_x86_64', '-mssse3']
|
2011-01-22 02:18:25 +00:00
|
|
|
env['CCFLAGS'] += ['-march=core2', '-mdynamic-no-pic']
|
2010-11-13 20:02:01 +00:00
|
|
|
env['CCFLAGS'] += ['-iframework/Developer/SDKs/MacOSX10.5.sdk' + system]
|
|
|
|
env['CCFLAGS'] += ['-iframework/Developer/SDKs/MacOSX10.6.sdk' + system]
|
2011-01-27 05:01:00 +00:00
|
|
|
#env['CC'] = 'clang'
|
|
|
|
#env['CC'] = 'gcc'
|
|
|
|
env['CC'] = 'llvm-gcc'
|
|
|
|
#env['CXX'] = 'clang++'
|
|
|
|
#env['CXX'] = 'g++'
|
|
|
|
env['CXX'] = 'llvm-g++'
|
|
|
|
env['CXXFLAGS'] += ['-x', 'objective-c++']
|
2010-11-14 06:02:44 +00:00
|
|
|
env['FRAMEWORKS'] += ['AppKit', 'Carbon', 'CoreFoundation', 'CoreServices']
|
2011-01-27 05:01:00 +00:00
|
|
|
env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'CoreAudio', 'WebKit']
|
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 19:43:26 +00:00
|
|
|
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
|
2011-01-22 02:18:25 +00:00
|
|
|
env['FRAMEWORKSFLAGS'] = ['-weak_framework', 'OpenCL']
|
|
|
|
env['FRAMEWORKSFLAGS'] += ['-Xarch_i386', '-Wl,-framework,QuickTime']
|
2010-10-28 17:00:59 +00:00
|
|
|
env['LIBPATH'] += ['/usr/lib']
|
2010-08-01 16:30:22 +00:00
|
|
|
env['LINKFLAGS'] += ccld
|
2011-01-29 04:52:19 +00:00
|
|
|
env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000']
|
2010-11-13 20:02:01 +00:00
|
|
|
env['LINKFLAGS'] += ['-Wl,-search_paths_first', '-Wl,-Z', '-F' + system]
|
2010-08-01 16:30:22 +00:00
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
if env['nowx']:
|
|
|
|
env['HAVE_WX'] = 0
|
|
|
|
else:
|
2010-11-14 06:02:44 +00:00
|
|
|
wxenv = env.Clone(CPPPATH = '', LIBPATH = '', LIBS = '')
|
2010-08-01 16:30:22 +00:00
|
|
|
conf = wxenv.Configure(conf_dir = None, log_file = None,
|
|
|
|
custom_tests = {'CheckWXConfig' : wxconfig.CheckWXConfig})
|
|
|
|
env['HAVE_WX'] = \
|
2010-08-10 08:30:04 +00:00
|
|
|
conf.CheckWXConfig(2.9, 'aui adv core base gl'.split(),
|
|
|
|
env['flavor'] == 'debug')
|
2010-07-09 01:26:53 +00:00
|
|
|
conf.Finish()
|
2010-08-01 16:30:22 +00:00
|
|
|
if not env['HAVE_WX']:
|
|
|
|
print "wxWidgets 2.9 not found using " + env['wxconfig']
|
|
|
|
Exit(1)
|
|
|
|
wxconfig.ParseWXConfig(wxenv)
|
|
|
|
env['CPPDEFINES'] += ['__WXOSX_COCOA__']
|
2010-11-14 06:02:44 +00:00
|
|
|
env['CPPPATH'] += wxenv['CPPPATH']
|
2010-08-01 16:30:22 +00:00
|
|
|
env['LIBPATH'] += wxenv['LIBPATH']
|
2010-11-14 03:10:11 +00:00
|
|
|
env['wxconfiglibs'] = wxenv['LIBS']
|
2010-08-01 16:30:22 +00:00
|
|
|
|
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 19:43:26 +00:00
|
|
|
env['CPPPATH'] += ['#Externals']
|
2010-08-01 16:30:22 +00:00
|
|
|
env['FRAMEWORKPATH'] += ['Externals/Cg']
|
2010-06-26 19:17:43 +00:00
|
|
|
env['FRAMEWORKS'] += ['Cg']
|
2011-01-20 05:06:29 +00:00
|
|
|
env['shared_sdl'] = True
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_zlib'] = True
|
2010-08-01 16:30:22 +00:00
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources'
|
2010-08-01 16:30:22 +00:00
|
|
|
|
2010-07-24 13:10:54 +00:00
|
|
|
if env['bundle']:
|
2010-07-24 17:39:17 +00:00
|
|
|
app = env['prefix'] + '/Dolphin.app'
|
|
|
|
dmg = env['prefix'] + '/Dolphin-r' + rev + '.dmg'
|
2010-07-24 13:10:54 +00:00
|
|
|
env.Command(dmg, app, 'rm -f ' + dmg +
|
|
|
|
' && hdiutil create -srcfolder ' + app + ' -format UDBZ ' + dmg +
|
|
|
|
' && hdiutil internet-enable -yes ' + dmg)
|
2010-07-09 01:26:53 +00:00
|
|
|
|
2010-07-20 02:45:31 +00:00
|
|
|
elif sys.platform == 'win32':
|
2010-08-01 16:30:22 +00:00
|
|
|
pass
|
2010-07-20 02:45:31 +00:00
|
|
|
|
|
|
|
else:
|
2010-11-13 20:02:01 +00:00
|
|
|
env['CCFLAGS'] += ['-fPIC', '-msse2', '-pthread']
|
2010-11-14 06:02:44 +00:00
|
|
|
if env['CCVERSION'] >= '4.2.0':
|
2010-11-14 15:31:10 +00:00
|
|
|
env['CCFLAGS'] += ['-fvisibility=hidden']
|
2010-11-14 06:02:44 +00:00
|
|
|
env['CXXFLAGS'] += ['-fvisibility-inlines-hidden']
|
2010-11-04 21:27:03 +00:00
|
|
|
env['CPPDEFINES'] += ['HAVE_CONFIG_H']
|
2010-08-01 16:30:22 +00:00
|
|
|
env['CPPPATH'].insert(0, '#') # Make sure we pick up our own config.h
|
2010-11-13 20:02:01 +00:00
|
|
|
env['LINKFLAGS'] += ['-pthread']
|
|
|
|
env['RPATH'] = []
|
2010-08-01 16:30:22 +00:00
|
|
|
if sys.platform == 'linux2':
|
|
|
|
env['CPPDEFINES'] += [('_FILE_OFFSET_BITS', 64), '_LARGEFILE_SOURCE']
|
|
|
|
env['CXXFLAGS'] += ['-Wno-deprecated'] # XXX <hash_map>
|
2010-11-13 20:02:01 +00:00
|
|
|
env['LIBS'] += ['dl']
|
2010-08-01 16:30:22 +00:00
|
|
|
|
|
|
|
conf = env.Configure(config_h = "#config.h", custom_tests = {
|
|
|
|
'CheckPKG' : utils.CheckPKG,
|
|
|
|
'CheckPKGConfig' : utils.CheckPKGConfig,
|
|
|
|
'CheckPortaudio' : utils.CheckPortaudio,
|
|
|
|
'CheckSDL' : utils.CheckSDL,
|
|
|
|
'CheckWXConfig' : wxconfig.CheckWXConfig,
|
|
|
|
})
|
2010-07-09 01:26:53 +00:00
|
|
|
|
2010-06-16 11:39:23 +00:00
|
|
|
if not conf.CheckPKGConfig('0.15.0'):
|
|
|
|
print "Can't find pkg-config, some tests will fail"
|
2010-06-14 18:07:29 +00:00
|
|
|
|
2010-06-17 01:18:22 +00:00
|
|
|
if env['shared_glew']:
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_glew'] = conf.CheckPKG('GLEW')
|
2010-06-17 01:18:22 +00:00
|
|
|
if env['shared_sdl']:
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_sdl'] = conf.CheckPKG('SDL')
|
2010-06-17 01:18:22 +00:00
|
|
|
if env['shared_zlib']:
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_zlib'] = conf.CheckPKG('z')
|
2010-06-17 01:18:22 +00:00
|
|
|
if env['shared_lzo']:
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_lzo'] = conf.CheckPKG('lzo2')
|
2010-06-17 01:18:22 +00:00
|
|
|
# TODO: Check the version of sfml. It should be at least version 1.5
|
|
|
|
if env['shared_sfml']:
|
2010-07-24 17:39:17 +00:00
|
|
|
env['shared_sfml'] = conf.CheckPKG('sfml-network') and \
|
2010-07-24 23:09:43 +00:00
|
|
|
conf.CheckCXXHeader("SFML/Network/Ftp.hpp")
|
2010-06-17 01:18:22 +00:00
|
|
|
if env['shared_soil']:
|
2010-07-24 17:39:17 +00: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 11:39:23 +00:00
|
|
|
"falling back to the static library"
|
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
if env['nowx']:
|
|
|
|
env['HAVE_WX'] = 0
|
|
|
|
else:
|
2010-08-04 14:41:27 +00:00
|
|
|
env['HAVE_WX'] = conf.CheckWXConfig(2.8, 'aui adv core base'.split(),
|
2010-08-10 08:30:04 +00:00
|
|
|
env['flavor'] == 'debug')
|
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 19:43:26 +00:00
|
|
|
conf.Define('HAVE_WX', env['HAVE_WX'])
|
2010-07-09 01:26:53 +00:00
|
|
|
wxconfig.ParseWXConfig(env)
|
2010-07-09 22:31:04 +00:00
|
|
|
if not env['HAVE_WX']:
|
2010-08-01 16:30:22 +00:00
|
|
|
print "wxWidgets not found - see config.log"
|
2010-07-09 22:31:04 +00:00
|
|
|
Exit(1)
|
2010-06-10 14:18:21 +00:00
|
|
|
|
2010-06-16 00:07:52 +00:00
|
|
|
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ'])
|
2010-06-16 00:07:52 +00:00
|
|
|
|
|
|
|
env['HAVE_ALSA'] = conf.CheckPKG('alsa')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_ALSA', env['HAVE_ALSA'])
|
2010-06-16 00:07:52 +00:00
|
|
|
env['HAVE_AO'] = conf.CheckPKG('ao')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_AO', env['HAVE_AO'])
|
2010-06-16 00:07:52 +00:00
|
|
|
env['HAVE_OPENAL'] = conf.CheckPKG('openal')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_OPENAL', env['HAVE_OPENAL'])
|
2010-07-20 02:45:31 +00:00
|
|
|
env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890)
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO'])
|
2010-08-17 02:14:04 +00:00
|
|
|
env['HAVE_PULSEAUDIO'] = conf.CheckPKG('libpulse')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_PULSEAUDIO', env['HAVE_PULSEAUDIO'])
|
2010-06-16 00:07:52 +00:00
|
|
|
|
2010-06-14 18:07:29 +00:00
|
|
|
env['HAVE_X11'] = conf.CheckPKG('x11')
|
|
|
|
env['HAVE_XRANDR'] = env['HAVE_X11'] and conf.CheckPKG('xrandr')
|
2010-06-26 19:17:43 +00:00
|
|
|
conf.Define('HAVE_XRANDR', env['HAVE_XRANDR'])
|
|
|
|
conf.Define('HAVE_X11', env['HAVE_X11'])
|
|
|
|
|
|
|
|
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 14:18:21 +00: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 23:16:28 +00: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-09 01:26:53 +00:00
|
|
|
|
|
|
|
# PGO - Profile Guided Optimization
|
2010-08-01 16:30:22 +00:00
|
|
|
if env['pgo'] == 'generate':
|
|
|
|
env['CCFLAGS'] += ['-fprofile-generate']
|
|
|
|
env['LINKFLAGS'] += ['-fprofile-generate']
|
|
|
|
if env['pgo'] == 'use':
|
|
|
|
env['CCFLAGS'] += ['-fprofile-use']
|
|
|
|
env['LINKFLAGS'] += ['-fprofile-use']
|
2010-07-09 01:26:53 +00:00
|
|
|
|
|
|
|
# Profiling
|
2010-08-01 16:30:22 +00:00
|
|
|
if env['flavor'] == 'prof':
|
|
|
|
proflibs = ['/usr/lib/oprofile', '/usr/local/lib/oprofile']
|
|
|
|
env['LIBPATH'] += ['proflibs']
|
|
|
|
env['RPATH'] += ['proflibs']
|
2010-07-09 01:26:53 +00:00
|
|
|
if conf.CheckPKG('opagent'):
|
|
|
|
conf.Define('USE_OPROFILE', 1)
|
|
|
|
else:
|
|
|
|
print "Can't build prof without oprofile, disabling"
|
|
|
|
|
2010-07-24 23:09:43 +00:00
|
|
|
tarname = 'dolphin-' + rev
|
|
|
|
env['TARFLAGS'] = '-cj'
|
|
|
|
env['TARSUFFIX'] = '.tar.bz2'
|
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
if env['install'] == 'local':
|
2010-07-24 13:10:54 +00:00
|
|
|
env['binary_dir'] = '#' + env['prefix']
|
|
|
|
env['data_dir'] = '#' + env['prefix']
|
2010-07-24 23:09:43 +00:00
|
|
|
if env['bundle']:
|
|
|
|
env.Tar(tarname, env['prefix'])
|
2010-07-24 17:39:17 +00:00
|
|
|
else:
|
|
|
|
env['prefix'] = Dir(env['prefix']).abspath
|
|
|
|
env['binary_dir'] = env['prefix'] + '/bin'
|
|
|
|
env['data_dir'] = env['prefix'] + "/share/dolphin-emu"
|
2010-08-18 02:24:02 +00:00
|
|
|
conf.Define('DATA_DIR', "\"" + env['data_dir'] + "/\"")
|
2010-11-04 13:47:17 +00:00
|
|
|
conf.Define('LIBS_DIR', "\"" + env['prefix'] + '/lib/dolphin-emu/' + "\"")
|
2010-07-24 17:39:17 +00:00
|
|
|
# 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['prefix'] = env['destdir'] + env['prefix']
|
2010-07-24 23:09:43 +00:00
|
|
|
if env['bundle']:
|
|
|
|
env.Command(tarname + env['TARSUFFIX'], env['prefix'],
|
|
|
|
'tar ' + env['TARFLAGS'] + 'C ' + env['destdir'] + \
|
|
|
|
' -f ' + tarname + env['TARSUFFIX'] + ' ' + \
|
|
|
|
env['prefix'].split(env['destdir'], 1)[1][1:])
|
2010-07-24 13:10:54 +00:00
|
|
|
|
|
|
|
conf.Define('USER_DIR', "\"" + env['userdir'] + "\"")
|
2010-07-23 23:16:28 +00:00
|
|
|
|
2010-07-09 01:26:53 +00:00
|
|
|
# After all configuration tests are done
|
|
|
|
conf.Finish()
|
|
|
|
|
2010-07-24 17:39:17 +00:00
|
|
|
env.Alias('install', env['prefix'])
|
2010-07-24 13:10:54 +00:00
|
|
|
|
2010-07-09 01:26:53 +00: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-08-01 16:30:22 +00:00
|
|
|
dirs = [
|
2010-07-29 17:52:43 +00:00
|
|
|
'Externals/Bochs_disasm',
|
2011-01-06 01:11:32 +00:00
|
|
|
'Externals/CLRun',
|
2010-07-29 17:52:43 +00:00
|
|
|
'Externals/Lua',
|
2010-08-01 16:30:22 +00:00
|
|
|
'Externals/GLew',
|
|
|
|
'Externals/LZO',
|
|
|
|
'Externals/SDL',
|
|
|
|
'Externals/SOIL',
|
|
|
|
'Externals/SFML/src',
|
2010-07-29 17:52:43 +00:00
|
|
|
#'Externals/wxWidgets',
|
2010-08-01 16:30:22 +00:00
|
|
|
'Externals/zlib',
|
2011-01-29 04:52:19 +00:00
|
|
|
'Source/Plugins/Plugin_VideoOGL/Src',
|
|
|
|
#'Source/Plugins/Plugin_VideoSoftware/Src',
|
2010-07-29 17:52:43 +00:00
|
|
|
'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/VideoCommon/Src',
|
2010-11-16 00:13:33 +00:00
|
|
|
'Source/Core/VideoUICommon/Src',
|
2010-07-29 17:52:43 +00:00
|
|
|
'Source/DSPTool/Src',
|
|
|
|
'Source/UnitTests',
|
|
|
|
]
|
|
|
|
|
2010-08-01 16:30:22 +00:00
|
|
|
# Now that platform configuration is done, propagate it to modules
|
2008-08-26 21:02:23 +00:00
|
|
|
for subdir in dirs:
|
2010-07-29 17:52:43 +00:00
|
|
|
SConscript(dirs = subdir, duplicate = 0, exports = 'env',
|
|
|
|
variant_dir = env['build_dir'] + os.sep + subdir)
|
2010-08-01 16:30:22 +00:00
|
|
|
if subdir.startswith('Source/Core'):
|
2010-07-29 17:52:43 +00:00
|
|
|
env['CPPPATH'] += ['#' + subdir]
|
2010-02-02 21:56:29 +00:00
|
|
|
|
2010-07-24 13:10:54 +00:00
|
|
|
# Print a nice progress indication when not compiling
|
|
|
|
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
|
2010-07-24 17:39:17 +00:00
|
|
|
|
2010-08-01 16:30:22 +00:00
|
|
|
# Generate help, printing current status of options
|
2010-07-24 17:39:17 +00:00
|
|
|
Help(vars.GenerateHelpText(env))
|