--- a/SConstruct Tue Apr 29 23:31:08 2008 +0200
+++ b/SConstruct Fri May 02 13:27:47 2008 +0200
@@ -30,14 +30,17 @@
""")
import os, sys
-env = Environment(ENV = {'PATH' : os.environ['PATH']})
+env = Environment() #(ENV = {'PATH' : os.environ['PATH']})
Decider('MD5-timestamp')
opt = Options(['.optioncache'])
opt.AddOptions(
BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
+ BoolOption('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),
+ BoolOption('profile', "enable gcc's profiling support (-pg)", False),
)
if env['PLATFORM'] == 'win32':
opt.AddOptions(
@@ -120,12 +123,18 @@
if cc == 'intelc':
add_flags += cpuflags_intelc + ' '
+if conf.env['force_flags']:
+ add_flags = conf.env['flags'] + ' '
+else:
+ add_flags += conf.env['flags'] + ' '
+
if conf.env['precision'] == 'double':
add_flags += '-DPYRIT_DOUBLE '
elif cc == 'gcc':
add_flags += '-fsingle-precision-constant '
-add_flags += conf.env['flags']
+if not conf.env['simd']:
+ add_flags += '-DNO_SSE '
if cc == 'intelc':
conf.env.Append(CCFLAGS="-O3 -w1 " + add_flags)
@@ -143,17 +152,25 @@
conf.env.Append(CCFLAGS='-DHAVE_PNG')
conf.env.Append(LIBS=['png'])
+if not conf.CheckCHeader('pthread.h'):
+ print 'Error: Cannot build without pthread.'
+ Exit(1)
+
if conf.env['PLATFORM'] == 'win32':
conf.env.Append(LIBS=["pthreadGC2"])
else:
conf.env.Append(CCFLAGS="-pthread ")
+if conf.env['profile'] and cc == 'gcc':
+ conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg")
+
env = conf.Finish()
### build targets
-(lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env')
+lib = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports={'env':env,'buildmodule':False})
+pymodule = SConscript('src/SConscript', build_dir='build/pymodule', duplicate=0, exports={'env':env,'buildmodule':True})
SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='env lib')
SConscript('demos/SConscript', exports='pymodule')
@@ -163,6 +180,8 @@
SConscript('models/SConscript')
+env.Alias('libs', ['static-lib', 'python-module'])
+
env.Alias('docs', Command('docs/html', [], 'doxygen'))
env.Clean('docs', ['docs/html'])