From 3e2419776f2be1f0eda8e019f122a7fb5edc6f3e Mon Sep 17 00:00:00 2001 From: nakeee Date: Sat, 20 Sep 2008 22:06:22 +0000 Subject: [PATCH] fixed scons=parsing git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@591 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/Bochs_disasm/SConscript | 2 +- Externals/LZO/SConscript | 2 +- SConstruct | 77 +++++++++---------- Source/Core/Common/Src/SConscript | 2 +- Source/Core/DebuggerWX/src/SConscript | 11 ++- Source/Core/DolphinWX/Src/SConscript | 16 ++-- Source/Core/VideoCommon/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_HLE/Src/SConscript | 3 +- Source/Plugins/Plugin_DSP_LLE/Src/SConscript | 13 ++-- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 22 +++--- .../Plugin_Wiimote_Test/Src/SConscript | 9 +-- Source/Plugins/Plugin_nJoy_SDL/Src/SConscript | 10 +-- 12 files changed, 78 insertions(+), 91 deletions(-) diff --git a/Externals/Bochs_disasm/SConscript b/Externals/Bochs_disasm/SConscript index a65a733084..40ba3f3e38 100644 --- a/Externals/Bochs_disasm/SConscript +++ b/Externals/Bochs_disasm/SConscript @@ -11,7 +11,7 @@ files = [ def filterWarnings(flags): return ' '.join( flag - for flag in flags.split() + for flag in flags if not flag.startswith('-W') ) env_bochs = env.Clone( diff --git a/Externals/LZO/SConscript b/Externals/LZO/SConscript index 75b0dca2ab..5f1a451232 100644 --- a/Externals/LZO/SConscript +++ b/Externals/LZO/SConscript @@ -7,7 +7,7 @@ files = [ def filterWarnings(flags): return ' '.join( flag - for flag in flags.split() + for flag in flags if not flag.startswith('-W') ) env_lzo = env.Clone( diff --git a/SConstruct b/SConstruct index 33e0b9ed83..6c0168a368 100644 --- a/SConstruct +++ b/SConstruct @@ -83,54 +83,22 @@ vars.AddVariables( BoolVariable('verbose', 'Set for compilation line', False), BoolVariable('debug', 'Set for debug build', 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 (WIP)', False), EnumVariable('flavor', 'Choose a build flavor', 'release', allowed_values=('release', 'devel', 'debug'), ignorecase=2) ) -# build falvuor -flavour = ARGUMENTS.get('flavor') -if (flavour == 'debug'): - compileFlags.append('-g') - cppDefines.append('LOGGING') -else: - compileFlags.append('-O3') - -# more warnings -lint = ARGUMENTS.get('lint', False) -if bool(lint): - warnings.append('error') - warnings.append('unreachable-code') - warnings.append('float-equal') - -nowx = ARGUMENTS.get('nowx', 0) -if int(nowx): - WxCppFlags = '' - WxLibFlags = '' -else: - WxCppFlags = os.popen('wx-config --cppflags').read() - if WxCppFlags[-1] == "\n": - WxCppFlags = WxCppFlags[:-1] - WxLibFlags = os.popen('wx-config --libs').read() - if WxLibFlags[-1] == "\n": - WxLibFlags = WxLibFlags[:-1] - -compileFlags += [ '-W' + warning for warning in warnings ] +#compileFlags += [ '-W' + warning for warning in warnings ] env = Environment( CC = 'gcc', CXX = 'g++', - CCFLAGS = ' '.join(compileFlags), - CXXFLAGS = ' '.join(compileFlags + [ '-fvisibility-inlines-hidden' ]), - CPPDEFINES = cppDefines, CPPPATH = include_paths, LIBPATH = lib_paths, variables = vars, - WXCPPFLAGS = WxCppFlags, - WXLIBFLAGS = WxLibFlags, ENV = { 'PATH' : os.environ['PATH'], 'HOME' : os.environ['HOME'] @@ -144,17 +112,48 @@ env = Environment( ) # verbose compile -verbose = ARGUMENTS.get('verbose', False) - -if not bool(verbose): +if not env['verbose']: env['CCCOMSTR'] = "Compiling $TARGET" env['CXXCOMSTR'] = "Compiling $TARGET" - env['ARCOMSTR'] = " ar $TARGET" + env['ARCOMSTR'] = "AR $TARGET" env['LINKCOMSTR'] = "Linking $TARGET" +# build falvuor +flavour = ARGUMENTS.get('flavor') +if (flavour == 'debug'): + compileFlags.append('-g') + cppDefines.append('LOGGING') +else: + compileFlags.append('-O3') + + +# more warnings +if env['lint']: + warnings.append('error') + warnings.append('unreachable-code') + warnings.append('float-equal') + +# add the warnings to the compile flags +compileFlags += [ '-W' + warning for warning in warnings ] + +env['CCFLAGS'] = compileFlags +env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ] +env['CPPDEFINES'] = cppDefines + +# handling wx flags CCFLAGS should be created before +# TODO: add version check +if not env['nowx']: + env.ParseConfig('wx-config --cflags --libs') + +#get sdl stuff +env.ParseConfig("sdl-config --cflags --libs") + +# lib ao (needed for sound plugins) +env.ParseConfig("pkg-config --cflags --libs ao") Export('env') +# print a nice progress indication when not compiling Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) # die on unknown variables @@ -163,7 +162,7 @@ if unknown: print "Unknown variables:", unknown.keys() Exit(1) -#generate help +# generate help Help(vars.GenerateHelpText(env)) for subdir in dirs: diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index a9e17b16ac..972376849a 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -25,5 +25,5 @@ files = [ ] env_common = env.Clone() -env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) +env_common.Append(CXXFLAGS = [ '-fPIC' ]) env_common.StaticLibrary("common", files) diff --git a/Source/Core/DebuggerWX/src/SConscript b/Source/Core/DebuggerWX/src/SConscript index 522e36bbf4..f5a0a2b9c8 100644 --- a/Source/Core/DebuggerWX/src/SConscript +++ b/Source/Core/DebuggerWX/src/SConscript @@ -17,15 +17,14 @@ files = ["LogWindow.cpp", ] wxenv = env.Clone() wxenv.Append( - CXXFLAGS = ' ' + ' '.join([ - env['WXCPPFLAGS'], + CXXFLAGS = [ '-DUSE_XPM_BITMAPS', '-DwxNEEDS_CHARPP' - ]), - LINKFLAGS = ' ' + ' '.join([ + ], + LINKFLAGS = [ '-L/usr/local/lib', '-pthread', - env['WXLIBFLAGS'], - ]) + ] ) + wxenv.StaticLibrary("debwx", files, LIBS = [ "common" ]) diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 1bfa1b10d6..42ceafe6a5 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -23,18 +23,14 @@ libs = [ wxenv = env.Clone() wxenv.Append( - CXXFLAGS = ' ' + ' '.join([ - env['WXCPPFLAGS'], + CXXFLAGS = [ '-DUSE_XPM_BITMAPS', '-DwxNEEDS_CHARPP', - '`sdl-config --cflags`', - ]), - LINKFLAGS = ' ' + ' '.join([ + ], + LINKFLAGS = [ '-L/usr/local/lib', '-pthread', - env['WXLIBFLAGS'], - '`sdl-config --libs`' - ]) + ] ) if sys.platform == 'darwin': @@ -66,5 +62,5 @@ else: exeNoGUI = '../../../../Binary/linux/DolphinNoGUI' objects = [ wxenv.Object(srcFile) for srcFile in files ] -wxenv.Program(exeGUI, objects + [ 'Main.cpp' ], LIBS = libs) -wxenv.Program(exeNoGUI, objects + [ 'MainNoGUI.cpp' ], LIBS = libs) +wxenv.Program(exeGUI, objects + [ 'Main.cpp' ], LIBS=wxenv['LIBS']+libs) +wxenv.Program(exeNoGUI, objects + [ 'MainNoGUI.cpp' ], LIBS=wxenv['LIBS']+libs) diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 6744ac23cb..f9af771339 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -13,5 +13,5 @@ files = [ ] env_common = env.Clone() -env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) +env_common.Append(CXXFLAGS = [ '-fPIC' ]) env_common.StaticLibrary("videocommon", files) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript index a799ca366a..8bb1373946 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript @@ -20,8 +20,7 @@ files = [ dspenv = env.Clone() dspenv.Append( - CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), - LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ]) + CXXFLAGS = [ '-fPIC', ], ) if sys.platform == 'darwin': diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript index 759845b1df..6226ae1f05 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript @@ -17,9 +17,10 @@ files = [ "main.cpp", ] -dspenv = env.Clone() -dspenv.Append( - CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), - LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ]) - ) -dspenv.SharedLibrary(output, files, LIBS = ["common"]) +lleenv = env.Clone() +lleenv.Append( + CXXFLAGS = [ '-fPIC', ], + ) + + +lleenv.SharedLibrary(output, files, LIBS = ["common"]) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index d649e78036..582906c003 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -24,14 +24,15 @@ files = [ ] compileFlags = [ '-fPIC', - env['WXCPPFLAGS'], ] linkFlags = [ - env['WXLIBFLAGS'], ] libs = [ 'videocommon', 'common', 'GLEW', ] + +gfxenv = env.Clone() + if sys.platform == 'darwin': platform = 'mac' # SDL is currently the only way to get video on Mac OS X. @@ -49,23 +50,20 @@ else: # By default, GLX is used on Linux to setup OpenGL, but you can select SDL # instead if you like, by changing the line below. useSDL = False - # Libraries with pkg-config support. - compileFlags.append('`pkg-config --cflags xxf86vm`') - linkFlags.append('`pkg-config --libs xxf86vm`') + gfxenv.ParseConfig("pkg-config --libs ao") + # Libraries without pkg-config support. libs += [ 'GL', 'Cg', 'CgGL', 'X11' ] -if useSDL: - compileFlags += [ '`sdl-config --cflags`', '-DUSE_SDL=1' ] - linkFlags += [ '`sdl-config --libs`' ] +if useSDL: + compileFlags += [ '-DUSE_SDL=1' ] -gfxenv = env.Clone() gfxenv.Append( - CXXFLAGS = ' ' + ' '.join(compileFlags), - LINKFLAGS = ' ' + ' '.join(linkFlags) + CXXFLAGS = compileFlags, ) + gfxenv.SharedLibrary( '../../../../Binary/%s/Plugins/zeroogl.so' % platform, files, - LIBS = libs + LIBS = gfxenv['LIBS'] + libs ) diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/SConscript b/Source/Plugins/Plugin_Wiimote_Test/Src/SConscript index eb6872ceb9..ba7dbd8f6c 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/SConscript +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/SConscript @@ -12,12 +12,9 @@ files = [ padenv = env.Clone() padenv.Append( - CXXFLAGS = ' ' + ' '.join([ - '-fPIC', env['WXCPPFLAGS'], '`pkg-config --cflags sdl`' - ]), - LINKFLAGS = ' ' + ' '.join([ - env['WXLIBFLAGS'], '`pkg-config --libs sdl`' - ]) + CXXFLAGS = [ + '-fPIC', + ], ) padenv.SharedLibrary(output, files, LIBS = [ "common" ]) diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript index 573503f9ae..db6895dfce 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript @@ -14,11 +14,9 @@ files = [ padenv = env.Clone() padenv.Append( - CXXFLAGS = ' ' + ' '.join([ - '-fPIC', env['WXCPPFLAGS'], '`pkg-config --cflags sdl`' - ]), - LINKFLAGS = ' ' + ' '.join([ - env['WXLIBFLAGS'], '`pkg-config --libs sdl`' - ]) + CXXFLAGS = [ + '-fPIC', + ], ) + padenv.SharedLibrary(output, files, LIBS = [ "common" ])