Some refinements to (r5955+r5962+r5964):

Don't rely on trailing /'s in directory names.

Destdir only works for global builds.

Only tar up global builds if they are in a destdir to
avoid SCons eating all available memory indexing /usr.

Print current status of shared_foo in 'scons -h'.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5966 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-07-24 17:39:17 +00:00
parent ad99d2a4eb
commit f99a36ccfa
8 changed files with 90 additions and 77 deletions

View File

@ -164,12 +164,10 @@ env['build_dir'] = 'Build' + os.sep + platform.system() + \
# Static libs go here # Static libs go here
env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep
# Install path # Default install path
if sys.platform == 'linux2' and env['install'] == 'global': if not env.has_key('install') or env['install'] == 'local':
env['prefix'] = os.path.join(env['prefix'] + os.sep)
else:
env['prefix'] = 'Binary' + os.sep + platform.system() + \ env['prefix'] = 'Binary' + os.sep + platform.system() + \
'-' + platform.machine() + extra + os.sep '-' + platform.machine() + extra
# Configuration tests section # Configuration tests section
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig, tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
@ -183,13 +181,6 @@ rev = utils.GenerateRevFile(env['flavor'],
"Source/Core/Common/Src/svnrev_template.h", "Source/Core/Common/Src/svnrev_template.h",
"Source/Core/Common/Src/svnrev.h") "Source/Core/Common/Src/svnrev.h")
shared = {}
shared['glew'] = shared['lzo'] = shared['sdl'] = \
shared['soil'] = shared['sfml'] = shared['zlib'] = 0
wxmods = ['aui', 'adv', 'core', 'base', 'gl']
env['HAVE_OPENCL'] = 0
env['HAVE_WX'] = 0
env['CCFLAGS'] = ccFlags env['CCFLAGS'] = ccFlags
env['CPPDEFINES'] = cppDefines env['CPPDEFINES'] = cppDefines
env['CPPPATH'] = ['#' + path for path in dirs] env['CPPPATH'] = ['#' + path for path in dirs]
@ -214,12 +205,17 @@ if sys.platform == 'darwin':
env['LINKFLAGS'] += ['-Z', '-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib', env['LINKFLAGS'] += ['-Z', '-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib',
'-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks', '-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks',
'-F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks'] '-F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks']
if platform.mac_ver()[0] >= '10.6.0': if platform.mac_ver()[0] < '10.6.0':
env['HAVE_OPENCL'] = 0
else:
env['HAVE_OPENCL'] = 1 env['HAVE_OPENCL'] = 1
env['LINKFLAGS'] += ['-weak_framework', 'OpenCL'] env['LINKFLAGS'] += ['-weak_framework', 'OpenCL']
if not env['nowx']: if env['nowx']:
env['HAVE_WX'] = 0
else:
conf = env.Configure(custom_tests = tests) conf = env.Configure(custom_tests = tests)
env['HAVE_WX'] = conf.CheckWXConfig(2.9, wxmods, 0) env['HAVE_WX'] = conf.CheckWXConfig(2.9,
['aui', 'adv', 'core', 'base', 'gl'], 0)
conf.Finish() conf.Finish()
# wx-config wants us to link with the OS X QuickTime framework # 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. # which is not available for x86_64 and we don't use it anyway.
@ -232,20 +228,23 @@ if sys.platform == 'darwin':
env['CPPPATH'] += ['#Externals'] env['CPPPATH'] += ['#Externals']
env['FRAMEWORKS'] += ['Cg'] env['FRAMEWORKS'] += ['Cg']
env['LINKFLAGS'] += ['-FExternals/Cg'] env['LINKFLAGS'] += ['-FExternals/Cg']
shared['zlib'] = 1 env['shared_zlib'] = True
env['data_dir'] = '#' + env['prefix'] + 'Dolphin.app/Contents/Resources' env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources'
env['plugin_dir'] = '#' + env['prefix'] + 'Dolphin.app/Contents/PlugIns/' env['plugin_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/PlugIns'
env.Install(env['data_dir'], 'Data/Sys') env.Install(env['data_dir'], 'Data/Sys')
env.Install(env['data_dir'], 'Data/User') env.Install(env['data_dir'], 'Data/User')
dirs += ['Externals/dylibbundler']
if env['bundle']: if env['bundle']:
app = env['prefix'] + 'Dolphin.app' app = env['prefix'] + '/Dolphin.app'
dmg = env['prefix'] + 'Dolphin-r' + rev + '.dmg' dmg = env['prefix'] + '/Dolphin-r' + rev + '.dmg'
env.Command(dmg, app, 'rm -f ' + dmg + env.Command(dmg, app, 'rm -f ' + dmg +
' && hdiutil create -srcfolder ' + app + ' -format UDBZ ' + dmg + ' && hdiutil create -srcfolder ' + app + ' -format UDBZ ' + dmg +
' && hdiutil internet-enable -yes ' + dmg) ' && hdiutil internet-enable -yes ' + dmg)
elif sys.platform == 'win32': elif sys.platform == 'win32':
env['tools'] = ['mingw'] env['tools'] = ['mingw']
dirs += ['Source/Plugins/Plugin_VideoDX9/Src']
dirs += ['Source/Plugins/Plugin_VideoDX11/Src']
else: else:
env['CCFLAGS'] += ['-pthread'] env['CCFLAGS'] += ['-pthread']
@ -258,28 +257,29 @@ else:
print "Can't find pkg-config, some tests will fail" print "Can't find pkg-config, some tests will fail"
if env['shared_glew']: if env['shared_glew']:
shared['glew'] = conf.CheckPKG('GLEW') env['shared_glew'] = conf.CheckPKG('GLEW')
if env['shared_sdl']: if env['shared_sdl']:
shared['sdl'] = conf.CheckPKG('SDL') env['shared_sdl'] = conf.CheckPKG('SDL')
if env['shared_zlib']: if env['shared_zlib']:
shared['zlib'] = conf.CheckPKG('z') env['shared_zlib'] = conf.CheckPKG('z')
if env['shared_lzo']: if env['shared_lzo']:
shared['lzo'] = conf.CheckPKG('lzo2') env['shared_lzo'] = conf.CheckPKG('lzo2')
# TODO: Check the version of sfml. It should be at least version 1.5 # TODO: Check the version of sfml. It should be at least version 1.5
if env['shared_sfml']: if env['shared_sfml']:
shared['sfml'] = conf.CheckPKG('sfml-network') and \ env['shared_sfml'] = conf.CheckPKG('sfml-network') and \
conf.CheckCXXHeader("SFML/Network/Ftp.hpp") conf.CheckCXXHeader("SFML/Network/Ftp.hpp")
if env['shared_soil']: if env['shared_soil']:
shared['soil'] = conf.CheckPKG('SOIL') env['shared_soil'] = conf.CheckPKG('SOIL')
for lib in shared: for var in env.items():
if not shared[lib]: if var[0].startswith('shared_') and var[1] == False:
print "Shared library " + lib + " not detected, " \ print "Shared library " + var[0][7:] + " not detected, " \
"falling back to the static library" "falling back to the static library"
if not env['nowx']: if env['nowx']:
# wxGLCanvas does not play well with wxGTK env['HAVE_WX'] = 0
wxmods.remove('gl') else:
env['HAVE_WX'] = conf.CheckWXConfig(2.8, wxmods, 0) env['HAVE_WX'] = conf.CheckWXConfig(2.8,
['aui', 'adv', 'core', 'base', 'gl'], 0)
conf.Define('HAVE_WX', env['HAVE_WX']) conf.Define('HAVE_WX', env['HAVE_WX'])
wxconfig.ParseWXConfig(env) wxconfig.ParseWXConfig(env)
if not env['HAVE_WX']: if not env['HAVE_WX']:
@ -329,6 +329,8 @@ else:
if env['opencl']: if env['opencl']:
env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL') env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL')
conf.Define('HAVE_OPENCL', env['HAVE_OPENCL']) conf.Define('HAVE_OPENCL', env['HAVE_OPENCL'])
else:
env['HAVE_OPENCL'] = 0
# PGO - Profile Guided Optimization # PGO - Profile Guided Optimization
if env['pgo']=='generate': if env['pgo']=='generate':
@ -348,71 +350,76 @@ else:
else: else:
print "Can't build prof without oprofile, disabling" print "Can't build prof without oprofile, disabling"
if env['install'] == 'global': if env['install'] == 'local':
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/' + "\"")
else:
env['binary_dir'] = '#' + env['prefix'] env['binary_dir'] = '#' + env['prefix']
env['data_dir'] = '#' + env['prefix'] env['data_dir'] = '#' + env['prefix']
env['plugin_dir'] = '#' + env['prefix'] + 'plugins/' 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']
conf.Define('USER_DIR', "\"" + env['userdir'] + "\"") conf.Define('USER_DIR', "\"" + env['userdir'] + "\"")
# After all configuration tests are done # After all configuration tests are done
conf.Finish() conf.Finish()
# 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 as it was defined before this.
if env.has_key('destdir'):
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']
if env['bundle']: if env['bundle']:
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'], env.Tar('dolphin-' + rev + '.tar.bz2', env['prefix'],
TARFLAGS='-cj', TARCOMSTR='Creating release tarball') TARFLAGS='-cj', TARCOMSTR='Creating release tarball')
# Data install # Data install
env.InstallAs(env['data_dir'] + 'sys', 'Data/Sys') env.InstallAs(env['data_dir'] + '/sys', 'Data/Sys')
env.InstallAs(env['data_dir'] + 'user', 'Data/User') env.InstallAs(env['data_dir'] + '/user', 'Data/User')
env.Alias('install', env['prefix'])
# Local (static) libraries must be first in the search path for the build in # 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 # order that they can override system libraries, but they must not be found
# during autoconfiguration as they will then be detected as system libraries. # during autoconfiguration as they will then be detected as system libraries.
env['LIBPATH'].insert(0, env['local_libs']) env['LIBPATH'].insert(0, env['local_libs'])
if not shared['glew']: if not env.has_key('shared_glew') or not env['shared_glew']:
env['CPPPATH'] += ['#Externals/GLew/include'] env['CPPPATH'] += ['#Externals/GLew/include']
dirs += ['Externals/GLew'] dirs += ['Externals/GLew']
if not shared['lzo']: if not env.has_key('shared_lzo') or not env['shared_lzo']:
env['CPPPATH'] += ['#Externals/LZO'] env['CPPPATH'] += ['#Externals/LZO']
dirs += ['Externals/LZO'] dirs += ['Externals/LZO']
if not shared['sdl']: if not env.has_key('shared_sdl') or not env['shared_sdl']:
env['CPPPATH'] += ['#Externals/SDL'] env['CPPPATH'] += ['#Externals/SDL']
env['CPPPATH'] += ['#Externals/SDL/include'] env['CPPPATH'] += ['#Externals/SDL/include']
dirs += ['Externals/SDL'] dirs += ['Externals/SDL']
if not shared['soil']: if not env.has_key('shared_soil') or not env['shared_soil']:
env['CPPPATH'] += ['#Externals/SOIL'] env['CPPPATH'] += ['#Externals/SOIL']
dirs += ['Externals/SOIL'] dirs += ['Externals/SOIL']
if not shared['sfml']: if not env.has_key('shared_sfml') or not env['shared_sfml']:
env['CPPPATH'] += ['#Externals/SFML/include'] env['CPPPATH'] += ['#Externals/SFML/include']
dirs += ['Externals/SFML/src'] dirs += ['Externals/SFML/src']
if not shared['zlib']: if not env.has_key('shared_zlib') or not env['shared_zlib']:
env['CPPPATH'] += ['#Externals/zlib'] env['CPPPATH'] += ['#Externals/zlib']
dirs += ['Externals/zlib'] dirs += ['Externals/zlib']
# Generate help
Help(vars.GenerateHelpText(env))
for subdir in dirs: for subdir in dirs:
SConscript(subdir + os.sep + 'SConscript', SConscript(subdir + os.sep + 'SConscript',
variant_dir = env['build_dir'] + os.sep + subdir, duplicate = 0) variant_dir = env['build_dir'] + os.sep + subdir, duplicate = 0)
env.Alias('install', env['prefix'])
# Print a nice progress indication when not compiling # Print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5) Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
# Generate help
Help(vars.GenerateHelpText(env))

View File

@ -55,12 +55,12 @@ if sys.platform == 'win32':
files += [ "stdafx.cpp" ] files += [ "stdafx.cpp" ]
elif sys.platform == 'darwin' and not env['HAVE_WX']: elif sys.platform == 'darwin' and not env['HAVE_WX']:
files += [ 'cocoaApp.m' ] files += [ 'cocoaApp.m' ]
exeNoGUI = '#' + env['prefix'] + 'DolphinNoGUI' exeNoGUI = '#' + env['prefix'] + '/DolphinNoGUI'
elif sys.platform == 'darwin' and env['HAVE_WX']: elif sys.platform == 'darwin' and env['HAVE_WX']:
exeGUI = 'Dolphin' exeGUI = 'Dolphin'
exeGUIdist = '#' + env['prefix'] + 'Dolphin.app/Contents/MacOS/Dolphin' exeGUIdist = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin'
env.Install('#' + env['prefix'] + 'Dolphin.app/Contents/' + env.Install('#' + env['prefix'] + '/Dolphin.app/Contents/' +
'Library/Frameworks/Cg.framework', 'Library/Frameworks/Cg.framework',
'#Externals/Cg/Cg.framework/Cg') '#Externals/Cg/Cg.framework/Cg')
@ -72,7 +72,7 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
for srcNode in source: for srcNode in source:
writePlist(srcNode.value, str(target[0])) writePlist(srcNode.value, str(target[0]))
env.Append(BUILDERS = {'Plist' : Builder(action = createPlist)}) env.Append(BUILDERS = {'Plist' : Builder(action = createPlist)})
env.Plist('#' + env['prefix'] + 'Dolphin.app/Contents/Info.plist', env.Plist('#' + env['prefix'] + '/Dolphin.app/Contents/Info.plist',
Value(dict( Value(dict(
CFBundleExecutable = 'Dolphin', CFBundleExecutable = 'Dolphin',
CFBundleIconFile = 'Dolphin.icns', CFBundleIconFile = 'Dolphin.icns',
@ -94,8 +94,8 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
else: else:
files += [ 'X11Utils.cpp' ] files += [ 'X11Utils.cpp' ]
libs += [ 'SDL' ] libs += [ 'SDL' ]
exeGUI = env['binary_dir'] + 'dolphin-emu' exeGUI = env['binary_dir'] + '/dolphin-emu'
exeNoGUI = env['binary_dir'] + 'dolphin-emu-nogui' exeNoGUI = env['binary_dir'] + '/dolphin-emu-nogui'
if env['HAVE_WX']: if env['HAVE_WX']:
env.StaticLibrary(env['local_libs'] + 'memcard', memcardfiles) env.StaticLibrary(env['local_libs'] + 'memcard', memcardfiles)

View File

@ -1,8 +1,9 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
name = "Plugin_DSP_HLE" name = os.sep + "Plugin_DSP_HLE"
files = [ files = [
'DSPHandler.cpp', 'DSPHandler.cpp',

View File

@ -1,8 +1,9 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
name = "Plugin_DSP_LLE" name = os.sep + "Plugin_DSP_LLE"
files = [ files = [
"Config.cpp", "Config.cpp",

View File

@ -1,9 +1,10 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
import sys import sys
name = "Plugin_VideoOGL" name = os.sep + "Plugin_VideoOGL"
files = [ files = [
'BPFunctions.cpp', 'BPFunctions.cpp',

View File

@ -1,9 +1,10 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
import sys import sys
name = "Plugin_VideoSoftware" name = os.sep + "Plugin_VideoSoftware"
files = [ files = [
'BPMemLoader.cpp', 'BPMemLoader.cpp',

View File

@ -1,8 +1,9 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
name = "Plugin_Wiimote" name = os.sep + "Plugin_Wiimote"
files = [ files = [
"Config.cpp", "Config.cpp",

View File

@ -1,9 +1,10 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import os
import sys import sys
name = "Plugin_WiimoteNew" name = os.sep + "Plugin_WiimoteNew"
files = [ files = [
'WiimoteEmu/WiimoteEmu.cpp', 'WiimoteEmu/WiimoteEmu.cpp',