src/SConscript
author Radek Brich <radek.brich@devl.cz>
Mon, 19 May 2008 22:59:04 +0200
branchpyrit
changeset 98 64638385798a
parent 93 96d65f841791
child 99 f3abdaa2e8fb
permissions -rw-r--r--
add sections about demos to README update doxygen comments
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:
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    32
		objs.append( env.Object(src) )
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    33
	lib = env.StaticLibrary('pyrit', objs)
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    34
	env.Alias('objs', objs)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    35
	env.Alias('static-lib', lib)
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 90
diff changeset
    36
	Return('lib')