fixed scons=parsing

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@591 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-09-20 22:06:22 +00:00
parent d9e4b55f15
commit 3e2419776f
12 changed files with 78 additions and 91 deletions

View File

@ -11,7 +11,7 @@ files = [
def filterWarnings(flags): def filterWarnings(flags):
return ' '.join( return ' '.join(
flag flag
for flag in flags.split() for flag in flags
if not flag.startswith('-W') if not flag.startswith('-W')
) )
env_bochs = env.Clone( env_bochs = env.Clone(

View File

@ -7,7 +7,7 @@ files = [
def filterWarnings(flags): def filterWarnings(flags):
return ' '.join( return ' '.join(
flag flag
for flag in flags.split() for flag in flags
if not flag.startswith('-W') if not flag.startswith('-W')
) )
env_lzo = env.Clone( env_lzo = env.Clone(

View File

@ -83,54 +83,22 @@ vars.AddVariables(
BoolVariable('verbose', 'Set for compilation line', False), BoolVariable('verbose', 'Set for compilation line', False),
BoolVariable('debug', 'Set for debug build', False), BoolVariable('debug', 'Set for debug build', False),
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 (WIP)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release', EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values=('release', 'devel', 'debug'), allowed_values=('release', 'devel', 'debug'),
ignorecase=2) ignorecase=2)
) )
# build falvuor
flavour = ARGUMENTS.get('flavor')
if (flavour == 'debug'):
compileFlags.append('-g')
cppDefines.append('LOGGING')
else:
compileFlags.append('-O3')
#compileFlags += [ '-W' + warning for warning in warnings ]
# 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 ]
env = Environment( env = Environment(
CC = 'gcc', CC = 'gcc',
CXX = 'g++', CXX = 'g++',
CCFLAGS = ' '.join(compileFlags),
CXXFLAGS = ' '.join(compileFlags + [ '-fvisibility-inlines-hidden' ]),
CPPDEFINES = cppDefines,
CPPPATH = include_paths, CPPPATH = include_paths,
LIBPATH = lib_paths, LIBPATH = lib_paths,
variables = vars, variables = vars,
WXCPPFLAGS = WxCppFlags,
WXLIBFLAGS = WxLibFlags,
ENV = { ENV = {
'PATH' : os.environ['PATH'], 'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME'] 'HOME' : os.environ['HOME']
@ -144,17 +112,48 @@ env = Environment(
) )
# verbose compile # verbose compile
verbose = ARGUMENTS.get('verbose', False) if not env['verbose']:
if not bool(verbose):
env['CCCOMSTR'] = "Compiling $TARGET" env['CCCOMSTR'] = "Compiling $TARGET"
env['CXXCOMSTR'] = "Compiling $TARGET" env['CXXCOMSTR'] = "Compiling $TARGET"
env['ARCOMSTR'] = " ar $TARGET" env['ARCOMSTR'] = "AR $TARGET"
env['LINKCOMSTR'] = "Linking $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') Export('env')
# print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5)
# die on unknown variables # die on unknown variables
@ -163,7 +162,7 @@ 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))
for subdir in dirs: for subdir in dirs:

View File

@ -25,5 +25,5 @@ files = [
] ]
env_common = env.Clone() env_common = env.Clone()
env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) env_common.Append(CXXFLAGS = [ '-fPIC' ])
env_common.StaticLibrary("common", files) env_common.StaticLibrary("common", files)

View File

@ -17,15 +17,14 @@ files = ["LogWindow.cpp",
] ]
wxenv = env.Clone() wxenv = env.Clone()
wxenv.Append( wxenv.Append(
CXXFLAGS = ' ' + ' '.join([ CXXFLAGS = [
env['WXCPPFLAGS'],
'-DUSE_XPM_BITMAPS', '-DUSE_XPM_BITMAPS',
'-DwxNEEDS_CHARPP' '-DwxNEEDS_CHARPP'
]), ],
LINKFLAGS = ' ' + ' '.join([ LINKFLAGS = [
'-L/usr/local/lib', '-L/usr/local/lib',
'-pthread', '-pthread',
env['WXLIBFLAGS'], ]
])
) )
wxenv.StaticLibrary("debwx", files, LIBS = [ "common" ]) wxenv.StaticLibrary("debwx", files, LIBS = [ "common" ])

View File

@ -23,18 +23,14 @@ libs = [
wxenv = env.Clone() wxenv = env.Clone()
wxenv.Append( wxenv.Append(
CXXFLAGS = ' ' + ' '.join([ CXXFLAGS = [
env['WXCPPFLAGS'],
'-DUSE_XPM_BITMAPS', '-DUSE_XPM_BITMAPS',
'-DwxNEEDS_CHARPP', '-DwxNEEDS_CHARPP',
'`sdl-config --cflags`', ],
]), LINKFLAGS = [
LINKFLAGS = ' ' + ' '.join([
'-L/usr/local/lib', '-L/usr/local/lib',
'-pthread', '-pthread',
env['WXLIBFLAGS'], ]
'`sdl-config --libs`'
])
) )
if sys.platform == 'darwin': if sys.platform == 'darwin':
@ -66,5 +62,5 @@ else:
exeNoGUI = '../../../../Binary/linux/DolphinNoGUI' exeNoGUI = '../../../../Binary/linux/DolphinNoGUI'
objects = [ wxenv.Object(srcFile) for srcFile in files ] objects = [ wxenv.Object(srcFile) for srcFile in files ]
wxenv.Program(exeGUI, objects + [ 'Main.cpp' ], LIBS = libs) wxenv.Program(exeGUI, objects + [ 'Main.cpp' ], LIBS=wxenv['LIBS']+libs)
wxenv.Program(exeNoGUI, objects + [ 'MainNoGUI.cpp' ], LIBS = libs) wxenv.Program(exeNoGUI, objects + [ 'MainNoGUI.cpp' ], LIBS=wxenv['LIBS']+libs)

View File

@ -13,5 +13,5 @@ files = [
] ]
env_common = env.Clone() env_common = env.Clone()
env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) env_common.Append(CXXFLAGS = [ '-fPIC' ])
env_common.StaticLibrary("videocommon", files) env_common.StaticLibrary("videocommon", files)

View File

@ -20,8 +20,7 @@ files = [
dspenv = env.Clone() dspenv = env.Clone()
dspenv.Append( dspenv.Append(
CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), CXXFLAGS = [ '-fPIC', ],
LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ])
) )
if sys.platform == 'darwin': if sys.platform == 'darwin':

View File

@ -17,9 +17,10 @@ files = [
"main.cpp", "main.cpp",
] ]
dspenv = env.Clone() lleenv = env.Clone()
dspenv.Append( lleenv.Append(
CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), CXXFLAGS = [ '-fPIC', ],
LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ]) )
)
dspenv.SharedLibrary(output, files, LIBS = ["common"])
lleenv.SharedLibrary(output, files, LIBS = ["common"])

View File

@ -24,14 +24,15 @@ files = [
] ]
compileFlags = [ compileFlags = [
'-fPIC', '-fPIC',
env['WXCPPFLAGS'],
] ]
linkFlags = [ linkFlags = [
env['WXLIBFLAGS'],
] ]
libs = [ libs = [
'videocommon', 'common', 'GLEW', 'videocommon', 'common', 'GLEW',
] ]
gfxenv = env.Clone()
if sys.platform == 'darwin': if sys.platform == 'darwin':
platform = 'mac' platform = 'mac'
# SDL is currently the only way to get video on Mac OS X. # 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 # By default, GLX is used on Linux to setup OpenGL, but you can select SDL
# instead if you like, by changing the line below. # instead if you like, by changing the line below.
useSDL = False useSDL = False
# Libraries with pkg-config support. gfxenv.ParseConfig("pkg-config --libs ao")
compileFlags.append('`pkg-config --cflags xxf86vm`')
linkFlags.append('`pkg-config --libs xxf86vm`')
# Libraries without pkg-config support. # Libraries without pkg-config support.
libs += [ 'GL', 'Cg', 'CgGL', 'X11' ] libs += [ 'GL', 'Cg', 'CgGL', 'X11' ]
if useSDL: if useSDL:
compileFlags += [ '`sdl-config --cflags`', '-DUSE_SDL=1' ] compileFlags += [ '-DUSE_SDL=1' ]
linkFlags += [ '`sdl-config --libs`' ]
gfxenv = env.Clone()
gfxenv.Append( gfxenv.Append(
CXXFLAGS = ' ' + ' '.join(compileFlags), CXXFLAGS = compileFlags,
LINKFLAGS = ' ' + ' '.join(linkFlags)
) )
gfxenv.SharedLibrary( gfxenv.SharedLibrary(
'../../../../Binary/%s/Plugins/zeroogl.so' % platform, '../../../../Binary/%s/Plugins/zeroogl.so' % platform,
files, files,
LIBS = libs LIBS = gfxenv['LIBS'] + libs
) )

View File

@ -12,12 +12,9 @@ files = [
padenv = env.Clone() padenv = env.Clone()
padenv.Append( padenv.Append(
CXXFLAGS = ' ' + ' '.join([ CXXFLAGS = [
'-fPIC', env['WXCPPFLAGS'], '`pkg-config --cflags sdl`' '-fPIC',
]), ],
LINKFLAGS = ' ' + ' '.join([
env['WXLIBFLAGS'], '`pkg-config --libs sdl`'
])
) )
padenv.SharedLibrary(output, files, LIBS = [ "common" ]) padenv.SharedLibrary(output, files, LIBS = [ "common" ])

View File

@ -14,11 +14,9 @@ files = [
padenv = env.Clone() padenv = env.Clone()
padenv.Append( padenv.Append(
CXXFLAGS = ' ' + ' '.join([ CXXFLAGS = [
'-fPIC', env['WXCPPFLAGS'], '`pkg-config --cflags sdl`' '-fPIC',
]), ],
LINKFLAGS = ' ' + ' '.join([
env['WXLIBFLAGS'], '`pkg-config --libs sdl`'
])
) )
padenv.SharedLibrary(output, files, LIBS = [ "common" ]) padenv.SharedLibrary(output, files, LIBS = [ "common" ])