SConstruct
branchpyrit
changeset 99 f3abdaa2e8fb
parent 95 ca7d4c665531
child 100 c005054bf4c1
--- a/SConstruct	Mon May 19 22:59:04 2008 +0200
+++ b/SConstruct	Sun May 31 16:53:05 2009 +0200
@@ -42,33 +42,35 @@
 else:
 	tools = ['default']
 
-env = Environment(tools = tools, CPPPATH = ['.','#include'])
+env = Environment(tools = tools, CPPPATH = ['.','#include','#build/include'])
 
-opt = Options(['build/.optioncache'])
-opt.AddOptions(
-	BoolOption('simd', 'allow SSE intrinsics', True),
+vars = Variables(files=['build/.varscache'])
+vars.AddVariables(
+	BoolVariable('simd', 'allow SSE intrinsics', True),
 	('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),
+	BoolVariable('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),
+	BoolVariable('profile', "enable gcc's profiling support (-pg)", False),
 )
 if env['PLATFORM'] == 'win32':
-	opt.AddOptions(
-		BoolOption('mingw', 'use Mingw and GCC compiler, if available', False),
+	vars.AddVariables(
+		BoolVariable('mingw', 'use Mingw and GCC compiler, if available', False),
 		('pythonpath', 'path to Python installation',
 			'C:\\Python%c%c' % (sys.version[0], sys.version[2])),
 	)
 else:
-	opt.AddOptions(
-		BoolOption('intelc', 'use Intel C++ Compiler, if available', False),
+	vars.AddVariables(
+		BoolVariable('intelc', 'use Intel C++ Compiler, if available', False),
 	)
 
 
-opt.Update(env)
-opt.Save('build/.optioncache', env)
-Help(opt.GenerateHelpText(env))
+vars.Update(env)
+vars.Save('build/.varscache', env)
+Help(vars.GenerateHelpText(env))
 
+if env.GetOption('help') == True or env.GetOption('clean') == True:
+    Return()
 
 ### configure
 
@@ -102,9 +104,10 @@
 def CheckGCC(context):
 	global gcc, gccversion
 	context.Message('Checking for GCC compiler... ')
-	gcc = "g++" in env['TOOLS']
+	testenv = Environment()
+	gcc = "g++" in testenv['TOOLS']
 	if gcc:
-		gccversion = env['CCVERSION']
+		gccversion = testenv['CCVERSION']
 		context.Result(gccversion)
 	else:
 		gccversion = ''
@@ -133,10 +136,11 @@
 	context.Result(cpu)
 	return True
 
-conf_dir = "#/build/.sconf_temp"
-log_file="#/build/config.log"
-config_h="#/include/config.h"
+conf_dir = "#build/.sconf_temp"
+log_file="#build/config.log"
+config_h="#build/include/config.h"
 conf = Configure(env, conf_dir=conf_dir, log_file=log_file, config_h=config_h,
+    clean=False, help=False,
 	custom_tests = {
 		'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags,
 		'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC, 'CheckMSVC' : CheckMSVC})
@@ -231,7 +235,7 @@
 
 
 # configure libpng
-if conf.CheckLibWithHeader('libpng', 'png.h', 'C'):
+if conf.CheckLibWithHeader('zlib', 'zlib.h', 'C') and conf.CheckLibWithHeader('libpng', 'png.h', 'C'):
 	conf.Define('HAVE_PNG')
 
 env = conf.Finish()
@@ -243,12 +247,12 @@
 if platform == 'win32':
 	pythonver = '%c%c' % (sys.version[0], sys.version[2])
 	pythonlib = 'python'+pythonver
-	pythonpath = [env['pythonpath'],
-		'C:\\Program Files\\Python'+pythonver]
+	pythonpath = [env['pythonpath']]
 	pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath])
 	pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath])
 	pyenv.Replace(SHLIBSUFFIX='.pyd')
-	conf = Configure(pyenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h)
+	conf = Configure(pyenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h,
+	                 clean=False, help=False)
 	if not conf.CheckLib(pythonlib):
 		have_python = False
 	pyenv = conf.Finish()
@@ -286,6 +290,7 @@
 	return False
 
 conf = Configure(sdlenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h,
+    clean=False, help=False,
 	custom_tests = {'CheckSDL' : CheckSDL} )
 have_sdl = conf.CheckSDL()
 sdlenv = conf.Finish()