| author | Radek Brich <radek.brich@devl.cz> | 
| Sun, 27 Apr 2008 14:19:37 +0200 | |
| branch | pyrit | 
| changeset 85 | 907a634e5c02 | 
| parent 84 | 6f7fe14782c2 | 
| child 88 | f7edb3b90816 | 
| permissions | -rw-r--r-- | 
| 64 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 1 | Help("""
 | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 2 | Targets: | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 3 | all - build everything, | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 4 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 5 | libs - build all libraries | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 6 | demos - build all demos | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 7 | models - download/prepare all models | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 8 | docs - compile doxygen documentation | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 9 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 10 | libs = (static-lib, python-module) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 11 | static-lib - ray tracer library to link with | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 12 | python-module - ray tracer module for Python | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 13 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 14 | demos = (python-demos, cc-demos) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 15 | python-demos - Python demos, this depends on python-module | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 16 | cc-demos - C++ demos | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 17 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 18 | models = (local-models, download-models) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 19 | local-models - prepare local models | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 20 | download-models - download models which are not locally available | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 21 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 22 | no-docs = (libs, demos, models) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 23 | - everything but docs | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 24 | no-download = (libs, demos, local-models) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 25 | - everything but docs and downloadable models | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 26 | |
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 27 | Default target is no-download. | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 28 | |
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 29 | Options: | 
| 64 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 30 | """) | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 31 | |
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 32 | import os, sys | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 33 | env = Environment(ENV = {'PATH' : os.environ['PATH']})
 | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 34 | Decider('MD5-timestamp')
 | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 35 | |
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 36 | opt = Options(['.optioncache']) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 37 | opt.AddOptions( | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 38 | 	BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
 | 
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 39 | 	('precision', 'floating point number precision (single/double)', "single"),
 | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 40 | 	('flags', 'add additional compiler flags', ""),
 | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 41 | ) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 42 | if env['PLATFORM'] == 'win32': | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 43 | opt.AddOptions( | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 44 | 		('pythonpath', 'path to Python installation',
 | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 45 | 'C:\\Python%c%c' % (sys.version[0], sys.version[2])), | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 46 | ) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 47 | opt.Update(env) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 48 | opt.Save('.optioncache', env)
 | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 49 | Help(opt.GenerateHelpText(env)) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 50 | |
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 51 | platform = 'unknown' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 52 | def CheckPlatform(context): | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 53 | global platform | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 54 | 	context.Message('Platform is... ')
 | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 55 | if sys.platform[:5] == 'linux': | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 56 | platform = 'linux' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 57 | elif env['PLATFORM'] == 'posix': | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 58 | platform = 'posix' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 59 | elif env['PLATFORM'] == 'win32': | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 60 | platform = 'win32' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 61 | context.Result(platform) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 62 | return True | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 63 | |
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 64 | def CheckIntelC(context): | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 65 | global intelc, intelcversion | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 66 | 	context.Message('Checking for Intel C++ Compiler... ')
 | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 67 | 	intelc = Tool("intelc").exists(env) == True
 | 
| 66 | 68 | if intelc: | 
| 69 | testenv = Environment() | |
| 70 | 		Tool("intelc").generate(testenv)
 | |
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 71 | intelcversion = str(testenv['INTEL_C_COMPILER_VERSION']/10.) | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 72 | context.Result(intelcversion) | 
| 66 | 73 | else: | 
| 70 
4b84e90325c5
a fix for CPU and compiler detection
 Radek Brich <radek.brich@devl.cz> parents: 
68diff
changeset | 74 | intelcversion = '' | 
| 66 | 75 | context.Result(intelc) | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 76 | return intelc | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 77 | |
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 78 | def CheckGCC(context): | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 79 | global gcc, gccversion | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 80 | 	context.Message('Checking for GCC... ')
 | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 81 | gcc = "g++" in env['TOOLS'] | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 82 | if gcc: | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 83 | gccversion = env['CCVERSION'] | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 84 | context.Result(gccversion) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 85 | else: | 
| 70 
4b84e90325c5
a fix for CPU and compiler detection
 Radek Brich <radek.brich@devl.cz> parents: 
68diff
changeset | 86 | gccversion = '' | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 87 | context.Result(False) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 88 | return gcc | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 89 | |
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 90 | def CheckCPUFlags(context): | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 91 | global cpu, cpuflags_gcc, cpuflags_intelc | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 92 | 	context.Message('Checking CPU arch and flags... ')
 | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 93 | 	env.Execute('@$CC tools/cpuflags.c -o tools/cpuflags')
 | 
| 85 
907a634e5c02
implement triangle packet intersection
 Radek Brich <radek.brich@devl.cz> parents: 
84diff
changeset | 94 | 	(cpu, cpuflags_gcc, cpuflags_intelc) = os.popen('tools'+os.sep+'cpuflags %s %s'
 | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 95 | 		% (''.join(gccversion.rsplit('.',1)), intelcversion) ).read().split('\n')[:3]
 | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 96 | context.Result(cpu) | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 97 | return True | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 98 | |
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 99 | conf = Configure(env, | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 100 | 	custom_tests = {
 | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 101 | 'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags, | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 102 | 'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC}) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 103 | conf.CheckPlatform() | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 104 | conf.CheckGCC() | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 105 | conf.CheckIntelC() | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 106 | conf.CheckCPUFlags() | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 107 | env = conf.Finish() | 
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 108 | |
| 66 | 109 | |
| 110 | if intelc and env['intelc']: | |
| 111 | 	Tool("intelc").generate(env)
 | |
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 112 | cc = 'intelc' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 113 | elif gcc: | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 114 | cc = 'gcc' | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 115 | |
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 116 | add_flags = '' | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 117 | if cc == 'gcc': | 
| 68 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 118 | add_flags += cpuflags_gcc + ' -ffast-math ' | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 119 | if cc == 'intelc': | 
| 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 Radek Brich <radek.brich@devl.cz> parents: 
67diff
changeset | 120 | add_flags += cpuflags_intelc + ' ' | 
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 121 | |
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 122 | if env['precision'] == 'double': | 
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 123 | add_flags += '-DPYRIT_DOUBLE ' | 
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 124 | elif cc == 'gcc': | 
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 125 | add_flags += '-fsingle-precision-constant ' | 
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 126 | |
| 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 127 | add_flags += env['flags'] | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 128 | |
| 66 | 129 | if cc == 'intelc': | 
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 130 | env.Append(CCFLAGS="-O3 -w1 " + add_flags) | 
| 66 | 131 | elif cc == 'gcc': | 
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 132 | env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags) | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 133 | # CCFLAGS= -fno-strict-aliasing | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 134 | else: | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 135 | print "No supported compiler found." | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 136 | Exit(1) | 
| 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 137 | |
| 66 | 138 | print "Using compiler: " + cc | 
| 67 
249553e1d4fe
new option to choose single or double precision floats
 Radek Brich <radek.brich@devl.cz> parents: 
66diff
changeset | 139 | print "Additional flags: " + add_flags | 
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 140 | |
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 141 | # pthread | 
| 64 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 142 | if env['PLATFORM'] == 'win32': | 
| 65 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 Radek Brich <radek.brich@devl.cz> parents: 
64diff
changeset | 143 | env.Append(LIBS=["pthreadGC2"]) | 
| 64 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 144 | else: | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 145 | env.Append(CCFLAGS="-pthread ") | 
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 146 | |
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 147 | (lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env')
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 148 | |
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 149 | SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='env lib')
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 150 | SConscript('demos/SConscript', exports='pymodule')
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 151 | env.Alias('demos', ['cc-demos', 'python-demos'])
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 152 | |
| 84 
6f7fe14782c2
prepare kd-tree traversal for packet tracing (4 rays at once)
 Radek Brich <radek.brich@devl.cz> parents: 
70diff
changeset | 153 | SConscript('tests/SConscript', build_dir='build/tests', duplicate=0, exports='env lib')
 | 
| 
6f7fe14782c2
prepare kd-tree traversal for packet tracing (4 rays at once)
 Radek Brich <radek.brich@devl.cz> parents: 
70diff
changeset | 154 | |
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 155 | SConscript('models/SConscript')
 | 
| 60 | 156 | |
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 157 | env.Alias('docs', Command('docs/html', [], 'doxygen'))
 | 
| 66 | 158 | env.Clean('docs', ['docs/html'])
 | 
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 159 | |
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 160 | env.Alias('no-docs', ['libs', 'demos', 'models'])
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 161 | env.Alias('no-download', ['libs', 'demos', 'local-models'])
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 162 | |
| 64 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 163 | env.Alias('all', ['no-docs', 'docs'])
 | 
| 
5785cca4cdb9
add Help with list of targets to SConstruct
 Radek Brich <radek.brich@devl.cz> parents: 
63diff
changeset | 164 | |
| 63 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 165 | env.Alias('pyrit', 'no-download')
 | 
| 
440e1ae80459
add many SCons targets (see DEVNOTES)
 Radek Brich <radek.brich@devl.cz> parents: 
62diff
changeset | 166 | Default('pyrit')
 |