| author | Radek Brich <radek.brich@devl.cz> | 
| Mon, 05 May 2008 15:31:14 +0200 | |
| branch | pyrit | 
| changeset 92 | 9af5c039b678 | 
| parent 91 | 9d66d323c354 | 
| child 93 | 96d65f841791 | 
| 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  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
33  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
34  | 
EnsurePythonVersion(2, 3)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
35  | 
EnsureSConsVersion(0, 97)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
36  | 
|
| 
68
 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 
Radek Brich <radek.brich@devl.cz> 
parents: 
67 
diff
changeset
 | 
37  | 
Decider('MD5-timestamp')
 | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
38  | 
SConsignFile('build/.sconsign.dblite')
 | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
39  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
40  | 
if sys.platform == 'win32':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
41  | 
tools = ['mingw']  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
42  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
43  | 
tools = ['default']  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
44  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
45  | 
env = Environment(tools = tools)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
46  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
47  | 
opt = Options(['build/.optioncache'])  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
48  | 
opt.AddOptions(  | 
| 91 | 49  | 
	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
 | 
50  | 
	('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
 | 
51  | 
	('flags', 'add additional compiler flags', ""),
 | 
| 91 | 52  | 
	BoolOption('force_flags', "use only flags specified by 'flags' option (do not autodetect arch/sse flags)", False),
 | 
53  | 
	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
 | 
54  | 
)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
55  | 
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
 | 
56  | 
opt.AddOptions(  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
57  | 
		BoolOption('msvc', 'use Microsoft Visual C++ Compiler, if available', True),
 | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
58  | 
		('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
 | 
59  | 
'C:\\Python%c%c' % (sys.version[0], sys.version[2])),  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
60  | 
)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
61  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
62  | 
opt.AddOptions(  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
63  | 
		BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
64  | 
)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
65  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
66  | 
|
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
67  | 
opt.Update(env)  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
68  | 
opt.Save('build/.optioncache', env)
 | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
69  | 
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
 | 
70  | 
|
| 
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
 | 
71  | 
|
| 
 
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
 | 
72  | 
### 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
 | 
73  | 
|
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
74  | 
platform = 'unknown'  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
75  | 
def CheckPlatform(context):  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
76  | 
global platform  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
77  | 
	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
 | 
78  | 
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
 | 
79  | 
platform = 'linux'  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
80  | 
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
 | 
81  | 
platform = 'posix'  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
82  | 
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
 | 
83  | 
platform = 'win32'  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
84  | 
context.Result(platform)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
85  | 
return True  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
86  | 
|
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
87  | 
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
 | 
88  | 
global intelc, intelcversion  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
89  | 
	context.Message('Checking for IntelC compiler... ')
 | 
| 
68
 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 
Radek Brich <radek.brich@devl.cz> 
parents: 
67 
diff
changeset
 | 
90  | 
	intelc = Tool("intelc").exists(env) == True
 | 
| 66 | 91  | 
if intelc:  | 
92  | 
testenv = Environment()  | 
|
93  | 
		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
 | 
94  | 
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
 | 
95  | 
context.Result(intelcversion)  | 
| 66 | 96  | 
else:  | 
| 
70
 
4b84e90325c5
a fix for CPU and compiler detection
 
Radek Brich <radek.brich@devl.cz> 
parents: 
68 
diff
changeset
 | 
97  | 
intelcversion = ''  | 
| 66 | 98  | 
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
 | 
99  | 
return intelc  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
100  | 
|
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
101  | 
def CheckGCC(context):  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
102  | 
global gcc, gccversion  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
103  | 
	context.Message('Checking for GCC compiler... ')
 | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
104  | 
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
 | 
105  | 
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
 | 
106  | 
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
 | 
107  | 
context.Result(gccversion)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
108  | 
else:  | 
| 
70
 
4b84e90325c5
a fix for CPU and compiler detection
 
Radek Brich <radek.brich@devl.cz> 
parents: 
68 
diff
changeset
 | 
109  | 
gccversion = ''  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
110  | 
context.Result(False)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
111  | 
return gcc  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
112  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
113  | 
def CheckMSVC(context):  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
114  | 
global msvc, msvcversion  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
115  | 
	context.Message('Checking for MSVC compiler... ')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
116  | 
testenv = Environment()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
117  | 
msvc = "msvc" in testenv['TOOLS']  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
118  | 
if msvc:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
119  | 
msvcversion = testenv['MSVS_VERSION']  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
120  | 
context.Result(msvcversion)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
121  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
122  | 
msvcversion = ''  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
123  | 
context.Result(False)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
124  | 
return msvc  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
125  | 
|
| 
68
 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 
Radek Brich <radek.brich@devl.cz> 
parents: 
67 
diff
changeset
 | 
126  | 
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
 | 
127  | 
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
 | 
128  | 
	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
 | 
129  | 
	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
 | 
130  | 
	(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
 | 
131  | 
		% (''.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
 | 
132  | 
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
 | 
133  | 
return True  | 
| 
 
2c154aad7f33
added detection of optimal CPU flags for both GCC and IntelC
 
Radek Brich <radek.brich@devl.cz> 
parents: 
67 
diff
changeset
 | 
134  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
135  | 
conf_dir = "#/build/.sconf_temp"  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
136  | 
log_file="#/build/config.log"  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
137  | 
config_h="#/include/config.h"  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
138  | 
conf = Configure(env, conf_dir=conf_dir, log_file=log_file, config_h=config_h,  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
139  | 
	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
 | 
140  | 
'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags,  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
141  | 
'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC, 'CheckMSVC' : CheckMSVC})  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
142  | 
conf.CheckPlatform()  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
143  | 
|
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
144  | 
conf.CheckGCC()  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
145  | 
if platform == 'win32':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
146  | 
conf.CheckMSVC()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
147  | 
intelc = False  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
148  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
149  | 
conf.CheckIntelC()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
150  | 
msvc=False  | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
151  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
152  | 
if intelc or gcc:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
153  | 
conf.CheckCPUFlags()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
154  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
155  | 
if intelc and (not gcc or conf.env['intelc']):  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
156  | 
	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
 | 
157  | 
cc = 'intelc'  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
158  | 
elif msvc and (not gcc or conf.env['msvc']):  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
159  | 
	Tool('default').generate(conf.env)
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
160  | 
	conf.Define("MSVC")
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
161  | 
cc = 'msvc'  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
162  | 
elif gcc:  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
163  | 
cc = 'gcc'  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
164  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
165  | 
cc = 'none'  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
166  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
167  | 
if platform == 'win32' and cc == 'gcc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
168  | 
conf.env.Append(LIBPATH=["C:/mingw/lib", "C:/msys/mingw/lib"])  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
169  | 
conf.env.Append(CPPPATH=["C:/mingw/include", "C:/msys/mingw/include"])  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
170  | 
|
| 
67
 
249553e1d4fe
new option to choose single or double precision floats
 
Radek Brich <radek.brich@devl.cz> 
parents: 
66 
diff
changeset
 | 
171  | 
add_flags = ''  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
172  | 
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
 | 
173  | 
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
 | 
174  | 
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
 | 
175  | 
add_flags += cpuflags_intelc + ' '  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
176  | 
if cc == 'msvc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
177  | 
add_flags += '/fp:fast '  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
178  | 
if conf.env['simd']:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
179  | 
add_flags += '/arch:SSE '  | 
| 
67
 
249553e1d4fe
new option to choose single or double precision floats
 
Radek Brich <radek.brich@devl.cz> 
parents: 
66 
diff
changeset
 | 
180  | 
|
| 91 | 181  | 
if conf.env['force_flags']:  | 
182  | 
add_flags = conf.env['flags'] + ' '  | 
|
183  | 
else:  | 
|
184  | 
add_flags += conf.env['flags'] + ' '  | 
|
185  | 
||
| 
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
 | 
186  | 
if conf.env['precision'] == 'double':  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
187  | 
	conf.Define("PYRIT_DOUBLE")
 | 
| 
67
 
249553e1d4fe
new option to choose single or double precision floats
 
Radek Brich <radek.brich@devl.cz> 
parents: 
66 
diff
changeset
 | 
188  | 
elif cc == 'gcc':  | 
| 
 
249553e1d4fe
new option to choose single or double precision floats
 
Radek Brich <radek.brich@devl.cz> 
parents: 
66 
diff
changeset
 | 
189  | 
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
 | 
190  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
191  | 
if not conf.env['simd'] or conf.env['precision'] == 'double':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
192  | 
	conf.Define("NO_SIMD")
 | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
193  | 
|
| 66 | 194  | 
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
 | 
195  | 
conf.env.Append(CCFLAGS="-O3 -w1 " + add_flags)  | 
| 66 | 196  | 
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
 | 
197  | 
conf.env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags)  | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
198  | 
elif cc == 'msvc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
199  | 
conf.env.Append(CCFLAGS="/Ox /Ob2 /GS- /Gy /GF /GR- /Zp16 /MD /EHsc /vmb " + add_flags)  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
200  | 
else:  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
201  | 
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
 | 
202  | 
Exit(1)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
64 
diff
changeset
 | 
203  | 
|
| 66 | 204  | 
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
 | 
205  | 
print "Additional flags: " + add_flags  | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
206  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
207  | 
pthread = True  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
208  | 
if conf.env['PLATFORM'] == 'win32':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
209  | 
if cc == 'msvc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
210  | 
		if not conf.CheckLib('pthreadVC2'):
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
211  | 
pthread = False  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
212  | 
conf.env.Append(LIBS=["pthreadVC2"])  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
213  | 
elif cc == 'gcc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
214  | 
		if not conf.CheckLib('pthreadGC2'):
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
215  | 
pthread = False  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
216  | 
conf.env.Append(LIBS=["pthreadGC2"])  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
217  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
218  | 
conf.env.Append(CCFLAGS="-pthread ")  | 
| 
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
 | 
219  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
220  | 
if not pthread:  | 
| 91 | 221  | 
print 'Error: Cannot build without pthread.'  | 
222  | 
Exit(1)  | 
|
223  | 
||
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
224  | 
if conf.CheckLibWithHeader('png', 'png.h', 'C'):
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
225  | 
	conf.Define('HAVE_PNG')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
226  | 
conf.env.Append(LIBS=['png'])  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
227  | 
elif conf.CheckLib('libpng13'):
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
228  | 
	conf.Define('HAVE_PNG')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
229  | 
conf.env.Append(LIBS=['libpng13'])  | 
| 
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
 | 
230  | 
|
| 91 | 231  | 
if conf.env['profile'] and cc == 'gcc':  | 
232  | 
conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg")  | 
|
233  | 
||
| 
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
 | 
234  | 
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
 | 
235  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
236  | 
# configure SDL  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
237  | 
sdlenv = env.Clone()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
238  | 
if cc != 'msvc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
239  | 
try:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
240  | 
		sdlenv.ParseConfig('sh sdl-config --cflags')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
241  | 
		sdlenv.ParseConfig('sh sdl-config --libs')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
242  | 
except:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
243  | 
pass  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
244  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
245  | 
sdlenv.Append(LIBS=['SDL', 'SDLmain'])  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
246  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
247  | 
conf = Configure(sdlenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h)  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
248  | 
have_sdl = False  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
249  | 
if conf.CheckLib('SDL'):
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
250  | 
have_sdl = True  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
251  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
252  | 
print "SDL not found, some demos will not built."  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
253  | 
sdlenv = conf.Finish()  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
254  | 
|
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
255  | 
if cc == 'msvc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
256  | 
sdlenv.Append(LINKFLAGS="/SUBSYSTEM:WINDOWS")  | 
| 
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
 | 
257  | 
|
| 
 
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
 | 
258  | 
### build targets  | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
259  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
260  | 
Export('env sdlenv cc')
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
261  | 
lib = SConscript('src/SConscript', build_dir='build/lib', duplicate=0,
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
262  | 
	exports={'buildmodule':False})
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
263  | 
pymodule = SConscript('src/SConscript', build_dir='build/pymodule', duplicate=0,
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
264  | 
	exports={'buildmodule':True})
 | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
265  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
266  | 
if have_sdl:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
267  | 
	SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0,
 | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
268  | 
exports='lib')  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
269  | 
|
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
270  | 
SConscript('demos/SConscript', exports='pymodule')
 | 
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
271  | 
SConscript('tests/SConscript', build_dir='build/tests', duplicate=0, exports='lib')
 | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
272  | 
SConscript('models/SConscript')
 | 
| 60 | 273  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
274  | 
env.Alias('demos', ['cc-demos', 'python-demos'])
 | 
| 91 | 275  | 
env.Alias('libs', ['static-lib', 'python-module'])
 | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
276  | 
env.Alias('docs', Command('docs/html', [], 'doxygen'))
 | 
| 66 | 277  | 
env.Clean('docs', ['docs/html'])
 | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
278  | 
env.Alias('no-docs', ['libs', 'demos', 'models'])
 | 
| 
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
279  | 
env.Alias('no-download', ['libs', 'demos', 'local-models'])
 | 
| 
64
 
5785cca4cdb9
add Help with list of targets to SConstruct
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
280  | 
env.Alias('all', ['no-docs', 'docs'])
 | 
| 
63
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
281  | 
env.Alias('pyrit', 'no-download')
 | 
| 
 
440e1ae80459
add many SCons targets (see DEVNOTES)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
62 
diff
changeset
 | 
282  | 
Default('pyrit')
 |