src/SConscript
author Radek Brich <radek.brich@devl.cz>
Sun, 31 May 2009 16:53:05 +0200
branchpyrit
changeset 99 f3abdaa2e8fb
parent 93 96d65f841791
child 100 c005054bf4c1
permissions -rw-r--r--
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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     1
Import('env pyenv buildmodule cc')
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
sources = [
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     4
	'common.cc', 'raytracer.cc', 'sampler.cc', 'scene.cc',
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     5
	'shapes.cc', 'material.cc', 'pixmap.cc', 'serialize.cc',
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     6
	'container.cc', 'kdtree.cc', 'octree.cc']
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
     8
if buildmodule:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     9
	shared_objs = []
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    10
	for src in sources:
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    11
		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
    12
	if cc == 'gcc':
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
    13
		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
    14
	else:
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
    15
		ccflags = '$CCFLAGS'
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    16
	if cc == 'msvc':
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    17
		linkflags = '$LINKFLAGS /export:initpyrit'
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    18
	else:
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    19
		linkflags = '$LINKFLAGS'
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    20
	pymodule = pyenv.SharedLibrary('pyrit',
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    21
		['raytracermodule.cc']+shared_objs,
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    22
		SHLIBPREFIX = '', CCFLAGS = ccflags,
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    23
		LINKFLAGS=linkflags)
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    24
	if cc == 'msvc':	
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    25
		pyenv.AddPostAction(pymodule, 'mt /nologo /manifest ${TARGET}.manifest /outputresource:$TARGET;2')
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    26
	env.Alias('shared-objs', shared_objs)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    27
	env.Alias('python-module', pymodule)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    28
	Return('pymodule')
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    29
else:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    30
	objs = []
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    31
	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
    32
		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
    33
		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
    34
		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
    35
			env.Depends(o, '#build/include/config.h')
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    36
	lib = env.StaticLibrary('pyrit', objs)
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    37
	env.Alias('objs', objs)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    38
	env.Alias('static-lib', lib)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    39
	Return('lib')