| author | Radek Brich <radek.brich@devl.cz> | 
| Mon, 08 Sep 2014 20:14:24 +0200 | |
| branch | pyrit | 
| changeset 102 | de3e9ea18f56 | 
| parent 101 | 50a994a57849 | 
| child 104 | 2274a07510c1 | 
| permissions | -rw-r--r-- | 
| 93 | 1  | 
Import('env pyenv buildmodule cc')
 | 
| 60 | 2  | 
|
3  | 
sources = [  | 
|
| 93 | 4  | 
'common.cc', 'raytracer.cc', 'sampler.cc', 'scene.cc',  | 
5  | 
'shapes.cc', 'material.cc', 'pixmap.cc', 'serialize.cc',  | 
|
6  | 
'container.cc', 'kdtree.cc', 'octree.cc']  | 
|
| 
100
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
7  | 
|
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
8  | 
includes = [  | 
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
9  | 
'common.h', 'container.h', 'kdtree.h', 'material.h',  | 
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
10  | 
'matrix.h', 'mempool.h', 'octree.h', 'pixmap.h',  | 
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
11  | 
'quaternion.h', 'raytracer.h', 'raytracermodule.h',  | 
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
12  | 
'sampler.h', 'scene.h', 'serialize.h', 'shapes.h',  | 
| 
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
13  | 
'simd.h', 'vector.h']  | 
| 60 | 14  | 
|
| 91 | 15  | 
if buildmodule:  | 
| 93 | 16  | 
shared_objs = []  | 
17  | 
for src in sources:  | 
|
18  | 
shared_objs.append( pyenv.SharedObject(src) )  | 
|
| 
92
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
19  | 
if cc == 'gcc':  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
20  | 
ccflags = '$CCFLAGS -Wno-write-strings'  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
21  | 
else:  | 
| 
 
9af5c039b678
add MSVC compiler support, make it default for Windows
 
Radek Brich <radek.brich@devl.cz> 
parents: 
91 
diff
changeset
 | 
22  | 
ccflags = '$CCFLAGS'  | 
| 93 | 23  | 
if cc == 'msvc':  | 
24  | 
linkflags = '$LINKFLAGS /export:initpyrit'  | 
|
25  | 
else:  | 
|
26  | 
linkflags = '$LINKFLAGS'  | 
|
| 91 | 27  | 
	pymodule = pyenv.SharedLibrary('pyrit',
 | 
28  | 
['raytracermodule.cc']+shared_objs,  | 
|
| 93 | 29  | 
SHLIBPREFIX = '', CCFLAGS = ccflags,  | 
30  | 
LINKFLAGS=linkflags)  | 
|
31  | 
if cc == 'msvc':  | 
|
32  | 
		pyenv.AddPostAction(pymodule, 'mt /nologo /manifest ${TARGET}.manifest /outputresource:$TARGET;2')
 | 
|
| 91 | 33  | 
	env.Alias('shared-objs', shared_objs)
 | 
34  | 
	env.Alias('python-module', pymodule)
 | 
|
| 
100
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
35  | 
|
| 
101
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
36  | 
if cc == 'msvc':  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
37  | 
# MS Visual Studio Project  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
38  | 
vcprojsrcs = []  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
39  | 
for src in sources+['raytracermodule.cc']:  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
40  | 
vcprojsrcs += ['src/' + src]  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
41  | 
vcprojincs = []  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
42  | 
for inc in includes:  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
43  | 
vcprojincs += ['include/' + inc]  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
44  | 
vcproj = env.MSVSProject(  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
45  | 
auto_build_solution=0,  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
46  | 
target = '#pyrit_module' + env['MSVSPROJECTSUFFIX'],  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
47  | 
srcs = vcprojsrcs,  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
48  | 
incs = vcprojincs,  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
49  | 
buildtarget = 'python-module',  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
50  | 
variant = 'Release')  | 
| 
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
51  | 
		Return(('pymodule', 'vcproj'))
 | 
| 
100
 
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
 
Radek Brich <radek.brich@devl.cz> 
parents: 
99 
diff
changeset
 | 
52  | 
|
| 
101
 
50a994a57849
vcproj build target only for cc=msvc, fix sdl-config
 
Radek Brich <radek.brich@devl.cz> 
parents: 
100 
diff
changeset
 | 
53  | 
	Return('pymodule')
 | 
| 91 | 54  | 
else:  | 
| 93 | 55  | 
objs = []  | 
56  | 
for src in sources:  | 
|
| 
99
 
f3abdaa2e8fb
build script: updated for latest SCons, moved config.h to build/, help and clean targets does not run configure any more, fixed GCC check, added check for zlib
 
Radek Brich <radek.brich@devl.cz> 
parents: 
93 
diff
changeset
 | 
57  | 
o = env.Object(src)  | 
| 
 
f3abdaa2e8fb
build script: updated for latest SCons, moved config.h to build/, help and clean targets does not run configure any more, fixed GCC check, added check for zlib
 
Radek Brich <radek.brich@devl.cz> 
parents: 
93 
diff
changeset
 | 
58  | 
objs.append( o )  | 
| 
 
f3abdaa2e8fb
build script: updated for latest SCons, moved config.h to build/, help and clean targets does not run configure any more, fixed GCC check, added check for zlib
 
Radek Brich <radek.brich@devl.cz> 
parents: 
93 
diff
changeset
 | 
59  | 
if src == 'common.cc' or src == 'pixmap.cc':  | 
| 
 
f3abdaa2e8fb
build script: updated for latest SCons, moved config.h to build/, help and clean targets does not run configure any more, fixed GCC check, added check for zlib
 
Radek Brich <radek.brich@devl.cz> 
parents: 
93 
diff
changeset
 | 
60  | 
env.Depends(o, '#build/include/config.h')  | 
| 93 | 61  | 
	lib = env.StaticLibrary('pyrit', objs)
 | 
| 91 | 62  | 
	env.Alias('objs', objs)
 | 
63  | 
	env.Alias('static-lib', lib)
 | 
|
64  | 
	Return('lib')
 |