| author | Radek Brich <radek.brich@devl.cz> |
| Fri, 02 May 2008 13:27:47 +0200 | |
| branch | pyrit |
| changeset 91 | 9d66d323c354 |
| parent 88 | f7edb3b90816 |
| child 92 | 9af5c039b678 |
| permissions | -rw-r--r-- |
|
64
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
1 |
Help("""
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
2 |
Targets: |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
3 |
all - build everything, |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
4 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
5 |
libs - build all libraries |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
6 |
demos - build all demos |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
7 |
models - download/prepare all models |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
8 |
docs - compile doxygen documentation |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
9 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
10 |
libs = (static-lib, python-module) |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
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:
63
diff
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:
63
diff
changeset
|
13 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
14 |
demos = (python-demos, cc-demos) |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
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:
63
diff
changeset
|
16 |
cc-demos - C++ demos |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
17 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
18 |
models = (local-models, download-models) |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
19 |
local-models - prepare local models |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
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:
63
diff
changeset
|
21 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
22 |
no-docs = (libs, demos, models) |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
23 |
- everything but docs |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
24 |
no-download = (libs, demos, local-models) |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
25 |
- everything but docs and downloadable models |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
26 |
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
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:
64
diff
changeset
|
28 |
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
29 |
Options: |
|
64
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
30 |
""") |
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
31 |
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
32 |
import os, sys |
| 91 | 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:
67
diff
changeset
|
34 |
Decider('MD5-timestamp')
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
35 |
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
36 |
opt = Options(['.optioncache']) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
37 |
opt.AddOptions( |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
38 |
BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
|
| 91 | 39 |
BoolOption('simd', 'allow SSE intrinsics', True),
|
|
67
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
40 |
('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:
64
diff
changeset
|
41 |
('flags', 'add additional compiler flags', ""),
|
| 91 | 42 |
BoolOption('force_flags', "use only flags specified by 'flags' option (do not autodetect arch/sse flags)", False),
|
43 |
BoolOption('profile', "enable gcc's profiling support (-pg)", False),
|
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
44 |
) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
45 |
if env['PLATFORM'] == 'win32': |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
46 |
opt.AddOptions( |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
47 |
('pythonpath', 'path to Python installation',
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
48 |
'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:
64
diff
changeset
|
49 |
) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
50 |
opt.Update(env) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
51 |
opt.Save('.optioncache', env)
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
52 |
Help(opt.GenerateHelpText(env)) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
53 |
|
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
54 |
|
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
55 |
### configure |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
56 |
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
57 |
platform = 'unknown' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
58 |
def CheckPlatform(context): |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
59 |
global platform |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
60 |
context.Message('Platform is... ')
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
61 |
if sys.platform[:5] == 'linux': |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
62 |
platform = 'linux' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
63 |
elif env['PLATFORM'] == 'posix': |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
64 |
platform = 'posix' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
65 |
elif env['PLATFORM'] == 'win32': |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
66 |
platform = 'win32' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
67 |
context.Result(platform) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
68 |
return True |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
69 |
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
70 |
def CheckIntelC(context): |
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
71 |
global intelc, intelcversion |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
72 |
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:
67
diff
changeset
|
73 |
intelc = Tool("intelc").exists(env) == True
|
| 66 | 74 |
if intelc: |
75 |
testenv = Environment() |
|
76 |
Tool("intelc").generate(testenv)
|
|
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
77 |
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:
67
diff
changeset
|
78 |
context.Result(intelcversion) |
| 66 | 79 |
else: |
|
70
4b84e90325c5
a fix for CPU and compiler detection
Radek Brich <radek.brich@devl.cz>
parents:
68
diff
changeset
|
80 |
intelcversion = '' |
| 66 | 81 |
context.Result(intelc) |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
82 |
return intelc |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
83 |
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
84 |
def CheckGCC(context): |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
85 |
global gcc, gccversion |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
86 |
context.Message('Checking for GCC... ')
|
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
87 |
gcc = "g++" in env['TOOLS'] |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
88 |
if gcc: |
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
89 |
gccversion = env['CCVERSION'] |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
90 |
context.Result(gccversion) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
91 |
else: |
|
70
4b84e90325c5
a fix for CPU and compiler detection
Radek Brich <radek.brich@devl.cz>
parents:
68
diff
changeset
|
92 |
gccversion = '' |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
93 |
context.Result(False) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
94 |
return gcc |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
95 |
|
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
96 |
def CheckCPUFlags(context): |
|
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
97 |
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:
67
diff
changeset
|
98 |
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:
67
diff
changeset
|
99 |
env.Execute('@$CC tools/cpuflags.c -o tools/cpuflags')
|
|
85
907a634e5c02
implement triangle packet intersection
Radek Brich <radek.brich@devl.cz>
parents:
84
diff
changeset
|
100 |
(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:
67
diff
changeset
|
101 |
% (''.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:
67
diff
changeset
|
102 |
context.Result(cpu) |
|
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
103 |
return True |
|
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
104 |
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
105 |
conf = Configure(env, |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
106 |
custom_tests = {
|
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
107 |
'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags, |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
108 |
'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC}) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
109 |
conf.CheckPlatform() |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
110 |
conf.CheckGCC() |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
111 |
conf.CheckIntelC() |
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
112 |
conf.CheckCPUFlags() |
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
113 |
|
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
114 |
if intelc and conf.env['intelc']: |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
115 |
Tool("intelc").generate(conf.env)
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
116 |
cc = 'intelc' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
117 |
elif gcc: |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
118 |
cc = 'gcc' |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
119 |
|
|
67
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
120 |
add_flags = '' |
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
121 |
if cc == 'gcc': |
|
68
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
122 |
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:
67
diff
changeset
|
123 |
if cc == 'intelc': |
|
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
124 |
add_flags += cpuflags_intelc + ' ' |
|
67
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
125 |
|
| 91 | 126 |
if conf.env['force_flags']: |
127 |
add_flags = conf.env['flags'] + ' ' |
|
128 |
else: |
|
129 |
add_flags += conf.env['flags'] + ' ' |
|
130 |
||
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
131 |
if conf.env['precision'] == 'double': |
|
67
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
132 |
add_flags += '-DPYRIT_DOUBLE ' |
|
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
133 |
elif cc == 'gcc': |
|
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
134 |
add_flags += '-fsingle-precision-constant ' |
|
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
135 |
|
| 91 | 136 |
if not conf.env['simd']: |
137 |
add_flags += '-DNO_SSE ' |
|
|
65
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
138 |
|
| 66 | 139 |
if cc == 'intelc': |
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
140 |
conf.env.Append(CCFLAGS="-O3 -w1 " + add_flags) |
| 66 | 141 |
elif cc == 'gcc': |
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
142 |
conf.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:
64
diff
changeset
|
143 |
# CCFLAGS= -fno-strict-aliasing |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
144 |
else: |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
145 |
print "No supported compiler found." |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
146 |
Exit(1) |
|
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents:
64
diff
changeset
|
147 |
|
| 66 | 148 |
print "Using compiler: " + cc |
|
67
249553e1d4fe
new option to choose single or double precision floats
Radek Brich <radek.brich@devl.cz>
parents:
66
diff
changeset
|
149 |
print "Additional flags: " + add_flags |
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
150 |
|
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
151 |
if conf.CheckLibWithHeader('png', 'png.h', 'C'):
|
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
152 |
conf.env.Append(CCFLAGS='-DHAVE_PNG') |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
153 |
conf.env.Append(LIBS=['png']) |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
154 |
|
| 91 | 155 |
if not conf.CheckCHeader('pthread.h'):
|
156 |
print 'Error: Cannot build without pthread.' |
|
157 |
Exit(1) |
|
158 |
||
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
159 |
if conf.env['PLATFORM'] == 'win32': |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
160 |
conf.env.Append(LIBS=["pthreadGC2"]) |
|
64
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
161 |
else: |
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
162 |
conf.env.Append(CCFLAGS="-pthread ") |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
163 |
|
| 91 | 164 |
if conf.env['profile'] and cc == 'gcc': |
165 |
conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg") |
|
166 |
||
|
88
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
167 |
env = conf.Finish() |
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
168 |
|
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
169 |
|
|
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents:
85
diff
changeset
|
170 |
### build targets |
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
171 |
|
| 91 | 172 |
lib = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports={'env':env,'buildmodule':False})
|
173 |
pymodule = SConscript('src/SConscript', build_dir='build/pymodule', duplicate=0, exports={'env':env,'buildmodule':True})
|
|
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
174 |
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
175 |
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:
62
diff
changeset
|
176 |
SConscript('demos/SConscript', exports='pymodule')
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
177 |
env.Alias('demos', ['cc-demos', 'python-demos'])
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
178 |
|
|
84
6f7fe14782c2
prepare kd-tree traversal for packet tracing (4 rays at once)
Radek Brich <radek.brich@devl.cz>
parents:
70
diff
changeset
|
179 |
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:
70
diff
changeset
|
180 |
|
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
181 |
SConscript('models/SConscript')
|
| 60 | 182 |
|
| 91 | 183 |
env.Alias('libs', ['static-lib', 'python-module'])
|
184 |
||
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
185 |
env.Alias('docs', Command('docs/html', [], 'doxygen'))
|
| 66 | 186 |
env.Clean('docs', ['docs/html'])
|
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
187 |
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
188 |
env.Alias('no-docs', ['libs', 'demos', 'models'])
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
189 |
env.Alias('no-download', ['libs', 'demos', 'local-models'])
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
190 |
|
|
64
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
191 |
env.Alias('all', ['no-docs', 'docs'])
|
|
5785cca4cdb9
add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents:
63
diff
changeset
|
192 |
|
|
63
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
193 |
env.Alias('pyrit', 'no-download')
|
|
440e1ae80459
add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
194 |
Default('pyrit')
|