src/SConscript
author Radek Brich <radek.brich@devl.cz>
Sun, 31 May 2009 23:06:03 +0200
branchpyrit
changeset 100 c005054bf4c1
parent 99 f3abdaa2e8fb
child 101 50a994a57849
permissions -rw-r--r--
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()

Import('env pyenv buildmodule cc')

sources = [
	'common.cc', 'raytracer.cc', 'sampler.cc', 'scene.cc',
	'shapes.cc', 'material.cc', 'pixmap.cc', 'serialize.cc',
	'container.cc', 'kdtree.cc', 'octree.cc']
	
includes = [
	'common.h', 'container.h', 'kdtree.h', 'material.h',
	'matrix.h', 'mempool.h', 'octree.h', 'pixmap.h',
	'quaternion.h', 'raytracer.h', 'raytracermodule.h',
	'sampler.h', 'scene.h',	'serialize.h', 'shapes.h',
	'simd.h', 'vector.h']

if buildmodule:
	shared_objs = []
	for src in sources:
		shared_objs.append( pyenv.SharedObject(src) )
	if cc == 'gcc':
		ccflags = '$CCFLAGS -Wno-write-strings'
	else:
		ccflags = '$CCFLAGS'
	if cc == 'msvc':
		linkflags = '$LINKFLAGS /export:initpyrit'
	else:
		linkflags = '$LINKFLAGS'
	pymodule = pyenv.SharedLibrary('pyrit',
		['raytracermodule.cc']+shared_objs,
		SHLIBPREFIX = '', CCFLAGS = ccflags,
		LINKFLAGS=linkflags)
	if cc == 'msvc':	
		pyenv.AddPostAction(pymodule, 'mt /nologo /manifest ${TARGET}.manifest /outputresource:$TARGET;2')
	env.Alias('shared-objs', shared_objs)
	env.Alias('python-module', pymodule)
	
	# MS Visual Studio Project
	vcprojsrcs = []
	for src in sources+['raytracermodule.cc']:
		vcprojsrcs += ['src/' + src]
	vcprojincs = []
	for inc in includes:
		vcprojincs += ['include/' + inc]
	vcproj = env.MSVSProject(
		auto_build_solution=0,
		target = '#pyrit_module' + env['MSVSPROJECTSUFFIX'],
		srcs = vcprojsrcs,
		incs = vcprojincs,
		buildtarget = 'python-module',
		variant = 'Release')
	
	Return(('pymodule', 'vcproj'))
else:
	objs = []
	for src in sources:
		o = env.Object(src)
		objs.append( o )
		if src == 'common.cc' or src == 'pixmap.cc':
			env.Depends(o, '#build/include/config.h')
	lib = env.StaticLibrary('pyrit', objs)
	env.Alias('objs', objs)
	env.Alias('static-lib', lib)
	Return('lib')