SConstruct
branchpyrit
changeset 95 ca7d4c665531
parent 94 4c8abb8977dc
child 99 f3abdaa2e8fb
--- a/SConstruct	Thu May 08 09:21:25 2008 +0200
+++ b/SConstruct	Sat May 10 14:29:37 2008 +0200
@@ -50,6 +50,7 @@
 	('precision', 'floating point number precision (single/double)', "single"),
 	('flags', 'add additional compiler flags', ""),
 	BoolOption('force_flags', "use only flags specified by 'flags' option (do not autodetect arch/sse flags)", False),
+	('ldflags', 'add additional linker flags', ""),
 	BoolOption('profile', "enable gcc's profiling support (-pg)", False),
 )
 if env['PLATFORM'] == 'win32':
@@ -149,9 +150,6 @@
 	conf.CheckIntelC()
 	msvc=False
 
-if intelc or gcc:
-	conf.CheckCPUFlags()
-
 if intelc and (not gcc or conf.env['intelc']):
 	Tool('intelc').generate(conf.env)
 	cc = 'intelc'
@@ -164,6 +162,9 @@
 else:
 	cc = 'none'
 
+if cc == 'intelc' or cc == 'gcc':
+	conf.CheckCPUFlags()
+
 if platform == 'win32' and cc == 'gcc':
 	conf.env.Append(LIBPATH=["C:/mingw/lib", "C:/msys/mingw/lib"])
 	conf.env.Append(CPPPATH=["C:/mingw/include", "C:/msys/mingw/include"])
@@ -208,6 +209,9 @@
 if conf.env['profile'] and cc == 'gcc':
 	conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg")
 
+if conf.env['ldflags']:
+	conf.env.Append(LINKFLAGS=conf.env['ldflags'])
+
 
 # configure pthread
 pthread = True
@@ -227,9 +231,7 @@
 
 
 # configure libpng
-if conf.CheckLibWithHeader('png', 'png.h', 'C'):
-	conf.Define('HAVE_PNG')
-elif conf.CheckLib('libpng'):
+if conf.CheckLibWithHeader('libpng', 'png.h', 'C'):
 	conf.Define('HAVE_PNG')
 
 env = conf.Finish()
@@ -291,16 +293,13 @@
 
 ### build targets
 
-Export('env pyenv sdlenv cc')
+Export('env pyenv sdlenv have_sdl cc')
 lib = SConscript('src/SConscript', build_dir='build/lib', duplicate=0,
 	exports={'buildmodule':False})
 pymodule = SConscript('src/SConscript', build_dir='build/pymodule', duplicate=0,
 	exports={'buildmodule':True})
 
-if have_sdl:
-	SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0,
-		exports='lib')
-
+SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='lib')
 SConscript('demos/SConscript', exports='pymodule')
 SConscript('tests/SConscript', build_dir='build/tests', duplicate=0, exports='lib')
 SConscript('models/SConscript')