Test linking with libsdl as part of its configure test to verify that

the library is of the correct binary format and such.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5641 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-09 19:41:17 +00:00
parent e648c6d68b
commit 9016c90d47
3 changed files with 33 additions and 52 deletions

View File

@ -9,15 +9,9 @@ sys.path.append('SconsTests')
import wxconfig import wxconfig
import utils import utils
# Some features needs at least scons 0.98 # Some features needs at least SCons 1.2
EnsureSConsVersion(1, 2) EnsureSConsVersion(1, 2)
# TODO: how do we use it in help?
name="Dolphin"
version="SVN"
description="A wii/gamecube emulator"
license="GPL v2"
warnings = [ warnings = [
'all', 'all',
'write-strings', 'write-strings',
@ -26,7 +20,6 @@ warnings = [
'packed', 'packed',
'no-conversion', 'no-conversion',
] ]
# XXX check for the availability of these (in GCC 4.3 or newer)
compileFlags = [ compileFlags = [
'-fno-exceptions', '-fno-exceptions',
@ -98,7 +91,7 @@ if sys.platform == 'darwin':
writePlist(properties, str(dstNode)) writePlist(properties, str(dstNode))
builders['Plist'] = Builder(action = createPlist) builders['Plist'] = Builder(action = createPlist)
# handle command line options # Handle command line options
vars = Variables('args.cache') vars = Variables('args.cache')
vars.AddVariables( vars.AddVariables(
@ -145,11 +138,6 @@ if sys.platform == 'win32':
variables = vars, variables = vars,
ENV = os.environ, ENV = os.environ,
BUILDERS = builders, BUILDERS = builders,
DESCRIPTION = description,
SUMMARY = description,
LICENSE = license,
NAME = name,
VERSION = version,
) )
else: else:
env = Environment( env = Environment(
@ -164,17 +152,12 @@ else:
'PKG_CONFIG_PATH' : os.environ.get('PKG_CONFIG_PATH') 'PKG_CONFIG_PATH' : os.environ.get('PKG_CONFIG_PATH')
}, },
BUILDERS = builders, BUILDERS = builders,
DESCRIPTION = description,
SUMMARY = description,
LICENSE = license,
NAME = name,
VERSION = version,
) )
# save the given command line options # Save the given command line options
vars.Save('args.cache', env) vars.Save('args.cache', env)
# verbose compile # Verbose compile
if not env['verbose']: if not env['verbose']:
env['CCCOMSTR'] = "Compiling $TARGET" env['CCCOMSTR'] = "Compiling $TARGET"
env['CXXCOMSTR'] = "Compiling $TARGET" env['CXXCOMSTR'] = "Compiling $TARGET"
@ -187,7 +170,7 @@ if not env['verbose']:
env['SHLINKCOMSTR'] = "Linking shared $TARGET" env['SHLINKCOMSTR'] = "Linking shared $TARGET"
env['RANLIBCOMSTR'] = "Indexing $TARGET" env['RANLIBCOMSTR'] = "Indexing $TARGET"
# build flavor # Build flavor
flavour = env['flavor'] flavour = env['flavor']
if (flavour == 'debug'): if (flavour == 'debug'):
compileFlags.append('-ggdb') compileFlags.append('-ggdb')
@ -205,16 +188,18 @@ elif (flavour == 'prof'):
elif (flavour == 'release'): elif (flavour == 'release'):
compileFlags.append('-O3') compileFlags.append('-O3')
compileFlags.append('-fomit-frame-pointer'); compileFlags.append('-fomit-frame-pointer');
# more warnings # More warnings
if env['lint']: if env['lint']:
warnings.append('error') warnings.append('error')
# Should check for the availability of these (in GCC 4.3 or newer)
if sys.platform != 'darwin': if sys.platform != 'darwin':
warnings.append('no-array-bounds') warnings.append('no-array-bounds')
warnings.append('no-unused-result') warnings.append('no-unused-result')
# wxWidgets causes too many warnings with these
#warnings.append('unreachable-code') #warnings.append('unreachable-code')
#warnings.append('float-equal') #warnings.append('float-equal')
# add the warnings to the compile flags # Add the warnings to the compile flags
compileFlags += [ ('-W' + warning) for warning in warnings ] compileFlags += [ ('-W' + warning) for warning in warnings ]
env['CCFLAGS'] = compileFlags env['CCFLAGS'] = compileFlags
@ -224,7 +209,7 @@ else:
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ] env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
env['CPPDEFINES'] = cppDefines env['CPPDEFINES'] = cppDefines
# pgo - Profile Guided Optimization # PGO - Profile Guided Optimization
if env['pgo']=='generate': if env['pgo']=='generate':
compileFlags.append('-fprofile-generate') compileFlags.append('-fprofile-generate')
env['LINKFLAGS']='-fprofile-generate' env['LINKFLAGS']='-fprofile-generate'
@ -243,7 +228,7 @@ tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
'CheckPortaudio' : utils.CheckPortaudio, 'CheckPortaudio' : utils.CheckPortaudio,
} }
#object files # Object files
env['build_dir'] = os.path.join(basedir, 'Build', env['build_dir'] = os.path.join(basedir, 'Build',
platform.system() + '-' + platform.machine() + '-' + env['flavor'] + os.sep) platform.system() + '-' + platform.machine() + '-' + env['flavor'] + os.sep)
@ -253,7 +238,7 @@ env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
# Where do we run from # Where do we run from
env['base_dir'] = os.getcwd()+ '/' env['base_dir'] = os.getcwd()+ '/'
# install paths # Install paths
extra='' extra=''
if flavour == 'debug': if flavour == 'debug':
extra = '-debug' extra = '-debug'
@ -284,25 +269,27 @@ conf = env.Configure(custom_tests = tests,
if not conf.CheckPKGConfig('0.15.0'): if not conf.CheckPKGConfig('0.15.0'):
print "Can't find pkg-config, some tests will fail" print "Can't find pkg-config, some tests will fail"
# find ports/fink for library and include path # Find MacPorts or Fink for library and include paths
if sys.platform == 'darwin': if sys.platform == 'darwin':
#ports usually has newer versions # MacPorts usually has newer versions
conf.CheckMacports() conf.CheckMacports()
conf.CheckFink() conf.CheckFink()
env['HAVE_SDL'] = conf.CheckSDL('1.0.0') env['HAVE_SDL'] = conf.CheckSDL('1.0.0')
if not env['HAVE_SDL']:
print "SDL is required"
Exit(1)
# Bluetooth for wii support # Bluetooth for wii support
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez') env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
# needed for sound env['HAVE_ALSA'] = 0
env['HAVE_ALSA'] = conf.CheckPKG('alsa')
env['HAVE_AO'] = 0 env['HAVE_AO'] = 0
env['HAVE_OPENAL'] = 0 env['HAVE_OPENAL'] = 0
env['HAVE_PORTAUDIO'] = 0 env['HAVE_PORTAUDIO'] = 0
env['HAVE_PULSEAUDIO'] = 0 env['HAVE_PULSEAUDIO'] = 0
if sys.platform != 'darwin': if sys.platform != 'darwin':
env['HAVE_ALSA'] = conf.CheckPKG('alsa')
env['HAVE_AO'] = conf.CheckPKG('ao') env['HAVE_AO'] = conf.CheckPKG('ao')
env['HAVE_OPENAL'] = conf.CheckPKG('openal') env['HAVE_OPENAL'] = conf.CheckPKG('openal')
env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890)
@ -348,7 +335,7 @@ if not env['SHARED_SFML']:
env['CPPPATH'] += [ basedir + 'Externals/SFML/include' ] env['CPPPATH'] += [ basedir + 'Externals/SFML/include' ]
dirs += ['Externals/SFML/src'] dirs += ['Externals/SFML/src']
#osx specifics # OS X specifics
if sys.platform == 'darwin': if sys.platform == 'darwin':
compileFlags.append('-mmacosx-version-min=10.5') compileFlags.append('-mmacosx-version-min=10.5')
env['HAVE_XRANDR'] = 0 env['HAVE_XRANDR'] = 0
@ -387,13 +374,12 @@ if not env['HAVE_WX'] and not env['nowx']:
print "WX not found - see config.log" print "WX not found - see config.log"
Exit(1) Exit(1)
# zlib
env['HAVE_ZLIB'] = conf.CheckPKG('z') env['HAVE_ZLIB'] = conf.CheckPKG('z')
if not ['HAVE_ZLIB']: if not ['HAVE_ZLIB']:
print "zlib is required" print "zlib is required"
Exit(1) Exit(1)
# check for libgtk2.0 # Check for GTK 2.0 or newer
env['HAVE_GTK2'] = 0 env['HAVE_GTK2'] = 0
if sys.platform == 'linux2': if sys.platform == 'linux2':
env['HAVE_GTK2'] = env['HAVE_WX'] and conf.CheckPKG('gtk+-2.0') env['HAVE_GTK2'] = env['HAVE_WX'] and conf.CheckPKG('gtk+-2.0')
@ -429,7 +415,7 @@ if (env['install'] == 'global'):
conf.Define('DATA_DIR', "\"" + env['data_dir'] + "\"") conf.Define('DATA_DIR', "\"" + env['data_dir'] + "\"")
conf.Define('LIBS_DIR', "\"" + env['prefix'] + 'lib/' + "\"") conf.Define('LIBS_DIR', "\"" + env['prefix'] + 'lib/' + "\"")
# lua # Lua
env['LUA_USE_MACOSX'] = 0 env['LUA_USE_MACOSX'] = 0
env['LUA_USE_LINUX'] = 0 env['LUA_USE_LINUX'] = 0
env['LUA_USE_POSIX'] = 0 env['LUA_USE_POSIX'] = 0
@ -441,7 +427,7 @@ elif sys.platform == 'linux2':
conf.Define('LUA_USE_MACOSX', env['LUA_USE_MACOSX']) conf.Define('LUA_USE_MACOSX', env['LUA_USE_MACOSX'])
conf.Define('LUA_USE_LINUX', env['LUA_USE_LINUX']) conf.Define('LUA_USE_LINUX', env['LUA_USE_LINUX'])
# profile # Profiling
env['USE_OPROFILE'] = 0 env['USE_OPROFILE'] = 0
if (flavour == 'prof'): if (flavour == 'prof'):
proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ] proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ]
@ -459,7 +445,7 @@ conf.Finish()
rev = utils.GenerateRevFile(env['flavor'], 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")
# 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)
# Setup destdir for package building # Setup destdir for package building
@ -471,13 +457,13 @@ if env.has_key('destdir'):
env['binary_dir'] = env['destdir'] + env['binary_dir'] env['binary_dir'] = env['destdir'] + env['binary_dir']
env['data_dir'] = env['destdir'] + env['data_dir'] env['data_dir'] = env['destdir'] + env['data_dir']
# die on unknown variables # Die on unknown variables
unknown = vars.UnknownVariables() unknown = vars.UnknownVariables()
if unknown: if unknown:
print "Unknown variables:", unknown.keys() print "Unknown variables:", unknown.keys()
Exit(1) Exit(1)
# generate help # Generate help
Help(vars.GenerateHelpText(env)) Help(vars.GenerateHelpText(env))
Export('env') Export('env')

View File

@ -24,7 +24,6 @@ def CheckFramework(context, name):
return ret return ret
def CheckFink(context): def CheckFink(context):
context.Message( 'Looking for fink... ') context.Message( 'Looking for fink... ')
prog = context.env.WhereIs('fink') prog = context.env.WhereIs('fink')
@ -90,10 +89,8 @@ def CheckPKG(context, name):
context.Result(ret) context.Result(ret)
return int(ret) return int(ret)
def CheckSDL(context, version): def CheckSDL(context, version):
context.Message( 'Checking for sdl lib version > %s... ' % version) context.Message( 'Checking for SDL lib version > %s... ' % version)
if platform.system().lower() == 'windows': if platform.system().lower() == 'windows':
return 1 return 1
sdl_config = context.env.WhereIs('sdl-config') sdl_config = context.env.WhereIs('sdl-config')
@ -108,6 +105,7 @@ def CheckSDL(context, version):
context.Result(ret) context.Result(ret)
if ret: if ret:
context.env.ParseConfig('sdl-config --cflags --libs') context.env.ParseConfig('sdl-config --cflags --libs')
ret = CheckLib(context, 'SDL')
return int(ret) return int(ret)
def CheckPortaudio(context, version): def CheckPortaudio(context, version):
@ -131,8 +129,6 @@ def CheckPortaudio(context, version):
context.Result(ret) context.Result(ret)
return int(ret) return int(ret)
def GenerateRevFile(flavour, template, output): def GenerateRevFile(flavour, template, output):
try: try:

View File

@ -41,7 +41,7 @@ if wmenv['HAVE_WIIUSE']:
if sys.platform == 'darwin': if sys.platform == 'darwin':
wmenv.Append( wmenv.Append(
CXXFLAGS = cxxflags, CXXFLAGS = cxxflags,
LINKFLAGS = ['-framework' ,'IOBluetooth'], LINKFLAGS = ['-framework', 'IOBluetooth'],
LIBS = libs, LIBS = libs,
) )
wmenv['FRAMEWORKS'] = ['Cocoa', 'System'] wmenv['FRAMEWORKS'] = ['Cocoa', 'System']
@ -51,5 +51,4 @@ else:
LIBS = libs, LIBS = libs,
) )
wmenv.SharedLibrary(env['plugin_dir']+name, files) wmenv.SharedLibrary(env['plugin_dir']+name, files)