Link the OpenCL framework weakly on OS X, so that a binary built on 10.6

with OpenCL will also run on 10.5 without OpenCL.

Build with OpenCL by default now, but keep the opencl build option around
until Linux also links OpenCL weakly, at which point it can go away.

Start to merge in the actions required to make the OS X application bundle
redistributable into the main build and let bundle=true be concerned only
with the optional step of creating a dmg.

Some people are building binary snapshots for OS X without applying the
install_name_tool fixups and besides, osx_make_dmg.sh doesn't fully handle
the internal dependencies between the wx libraries, so we need to be rid
of any external dependencies by the time "scons bundle=false ." finishes.

Ideally we should just use static builds of the wx libraries, but the flat
namespace used by Objective-C for anything other than normally linked
dylibs (sadly not dlopen'ed dylibs) makes that difficult because both the
main binary and the plugins have wx linked in without any symbol ordering.

TBD: Either do automatic install_name_tool fixups for both the main binary
and the wx dylibs or find a workaround for the flat namespace problem.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5797 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-26 13:29:44 +00:00
parent 8c3ed5dc46
commit 10b76db391
2 changed files with 28 additions and 22 deletions

View File

@ -100,7 +100,7 @@ vars.AddVariables(
BoolVariable('lint', 'Set for lint build (extra warnings)', False), BoolVariable('lint', 'Set for lint build (extra warnings)', False),
BoolVariable('nowx', 'Set for building with no WX libs', False), BoolVariable('nowx', 'Set for building with no WX libs', False),
BoolVariable('wxgl', 'Set for building with WX GL on Linux', False), BoolVariable('wxgl', 'Set for building with WX GL on Linux', False),
BoolVariable('opencl', 'Build with OpenCL', False), BoolVariable('opencl', 'Build with OpenCL', True),
BoolVariable('nojit', 'Remove entire jit cores', False), BoolVariable('nojit', 'Remove entire jit cores', False),
BoolVariable('shared_glew', 'Use system shared libGLEW', True), BoolVariable('shared_glew', 'Use system shared libGLEW', True),
BoolVariable('shared_lzo', 'Use system shared liblzo2', True), BoolVariable('shared_lzo', 'Use system shared liblzo2', True),
@ -199,11 +199,9 @@ if env['lint']:
compileFlags += [ ('-W' + warning) for warning in warnings ] compileFlags += [ ('-W' + warning) for warning in warnings ]
env['CCFLAGS'] = compileFlags env['CCFLAGS'] = compileFlags
if sys.platform == 'win32':
env['CXXFLAGS'] = compileFlags
else:
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
env['CPPDEFINES'] = cppDefines env['CPPDEFINES'] = cppDefines
if not sys.platform == 'win32':
env['CXXFLAGS'] = ['-fvisibility-inlines-hidden']
# PGO - Profile Guided Optimization # PGO - Profile Guided Optimization
if env['pgo']=='generate': if env['pgo']=='generate':
@ -257,15 +255,19 @@ if sys.platform == 'darwin':
conf = env.Configure(custom_tests = tests, conf = env.Configure(custom_tests = tests,
config_h="Source/Core/Common/Src/Config.h") config_h="Source/Core/Common/Src/Config.h")
env['HAVE_OPENCL'] = 0 if not sys.platform == 'win32':
if env['opencl']: if env['opencl']:
env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL') env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL')
# OS X specifics # OS X specifics
if sys.platform == 'darwin': if sys.platform == 'darwin':
# OpenCL is new in OS X 10.6. Other than OpenCL, if env['FRAMEWORKS'].count('OpenCL'):
# we try to maintain 10.5 compatibility, however. env['FRAMEWORKS'].remove('OpenCL')
if not env['HAVE_OPENCL']: env['LINKFLAGS'] += ['-weak_framework', 'OpenCL']
compileFlags += ['-isysroot', '/Developer/SDKs/MacOSX10.6.sdk']
else:
# OpenCL is new in OS X 10.6. Other than OpenCL,
# we try to maintain 10.5 compatibility, however.
compileFlags += ['-isysroot', '/Developer/SDKs/MacOSX10.5.sdk'] compileFlags += ['-isysroot', '/Developer/SDKs/MacOSX10.5.sdk']
compileFlags += ['-mmacosx-version-min=10.5'] compileFlags += ['-mmacosx-version-min=10.5']
conf.Define('MAP_32BIT', 0) conf.Define('MAP_32BIT', 0)
@ -285,7 +287,7 @@ else:
shared = {} shared = {}
shared['glew'] = shared['lzo'] = shared['sdl'] = \ shared['glew'] = shared['lzo'] = shared['sdl'] = \
shared['soil'] = shared['sfml'] = shared['zlib'] = 0 shared['soil'] = shared['sfml'] = shared['zlib'] = 0
if not sys.platform == 'darwin': if not sys.platform == 'win32' and not sys.platform == 'darwin':
if env['shared_glew']: if env['shared_glew']:
shared['glew'] = conf.CheckPKG('GLEW') shared['glew'] = conf.CheckPKG('GLEW')
if env['shared_sdl']: if env['shared_sdl']:
@ -350,7 +352,7 @@ else:
if env['FRAMEWORKS'].count('QuickTime'): if env['FRAMEWORKS'].count('QuickTime'):
env['FRAMEWORKS'].remove('QuickTime') env['FRAMEWORKS'].remove('QuickTime')
# Make sure that the libraries claimed by wx-config are valid # Make sure that the libraries claimed by wx-config are valid
env['HAVE_WX'] = conf.CheckPKG('c') #env['HAVE_WX'] = conf.CheckPKG('c')
if not env['HAVE_WX'] and not env['nowx']: if not env['HAVE_WX'] and not env['nowx']:
print "WX libraries not found - see config.log" print "WX libraries not found - see config.log"
@ -494,12 +496,13 @@ if env['bundle']:
if sys.platform == 'linux2': if sys.platform == 'linux2':
# Make tar ball (TODO put inside normal dir) # Make tar ball (TODO put inside normal dir)
tar_env = env.Clone() tar_env = env.Clone()
tarball = tar_env.Tar('dolphin-'+rev +'.tar.bz2', env['prefix']) tarball = tar_env.Tar('dolphin-' + rev + '.tar.bz2', env['prefix'])
tar_env.Append(TARFLAGS='-j', TARCOMSTR="Creating release tarball") tar_env.Append(TARFLAGS='-j', TARCOMSTR="Creating release tarball")
env.Clean(all, tarball)
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
env.Command('.', env['binary_dir'] + app = env['binary_dir'] + 'Dolphin.app'
'Dolphin.app/Contents/MacOS/Dolphin', './osx_make_dmg.sh') dmg = env['binary_dir'] + 'Dolphin-r' + rev + '.dmg'
env.Command('.', app + '/Contents/MacOS/Dolphin', 'rm -f ' + dmg +
#TODO clean all bundles ' && hdiutil create -srcfolder ' + app + ' -format UDBZ ' + dmg +
#env.Clean(all, 'dolphin-*' + '.tar.bz2') ' && hdiutil internet-enable -yes ' + dmg)
#env.Clean(all, 'Binary/Dolphin-r*' + '.dmg') env.Clean(all, dmg)

View File

@ -20,7 +20,7 @@ if wxenv['HAVE_WX']:
memcardfiles = [ memcardfiles = [
'MemcardManager.cpp', 'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp', 'MemoryCards/GCMemcard.cpp',
'WxUtils.cpp', 'WxUtils.cpp',
] ]
files += memcardfiles files += memcardfiles
@ -66,13 +66,16 @@ if sys.platform == 'darwin':
exeGUI = env['binary_dir'] + 'Dolphin.app/Contents/MacOS/Dolphin' exeGUI = env['binary_dir'] + 'Dolphin.app/Contents/MacOS/Dolphin'
exeNoGUI = env['binary_dir'] + 'DolphinNoGUI' exeNoGUI = env['binary_dir'] + 'DolphinNoGUI'
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/' +
'Library/Frameworks/Cg.framework',
'/Library/Frameworks/Cg.framework/Cg')
wxenv.Plist( wxenv.Plist(
env['binary_dir'] + 'Dolphin.app/Contents/Info.plist', env['binary_dir'] + 'Dolphin.app/Contents/Info.plist',
Value(dict( Value(dict(
CFBundleExecutable = 'Dolphin', CFBundleExecutable = 'Dolphin',
CFBundleIconFile = 'Dolphin.icns', CFBundleIconFile = 'Dolphin.icns',
CFBundleIdentifier = 'com.dolphin-emu.dolphin', CFBundleIdentifier = 'com.dolphin-emu.dolphin',
CFBundleName = 'Dolphin',
CFBundlePackageType = 'APPL', CFBundlePackageType = 'APPL',
CFBundleShortVersionString = CFBundleShortVersionString =
os.popen('svnversion -n ' + Dir('#').abspath).read(), os.popen('svnversion -n ' + Dir('#').abspath).read(),