src/SConscript
author Radek Brich <radek.brich@devl.cz>
Thu, 10 Apr 2008 23:20:36 +0200 (2008-04-10)
branchpyrit
changeset 65 242839c6d27d
parent 63 440e1ae80459
child 78 9569e9f35374
permissions -rw-r--r--
basic detection of compiler (GCC or ICC) and CPU capabilities try to detect Python path in Windows and allow direct specification through build option plus other build system fixes
Import('env')
env.Append(CPPPATH = '#include')

pyenv = env.Clone()
if env['PLATFORM'] == 'win32':
	import sys
	pythonver = '%c%c' % (sys.version[0], sys.version[2])
	pythonlib = 'python'+pythonver
	pythonpath = [env['pythonpath'],
		'C:\\Program Files\\Python'+pythonver]
	pyenv.Append(LIBS=pythonlib)
	pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath])
	pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath])
	pyenv.Replace(SHLIBSUFFIX='.pyd')
else:
	pyenv.ParseConfig('python-config --includes --libs')

sources = [
	'raytracer.cc', 'scene.cc', 'sampler.cc',
	'container.cc', 'kdtree.cc', 'octree.cc', 'noise.cc']

objs = []
shared_objs = []
for src in sources:
	objs.append( env.Object(src) )
	shared_objs.append( env.SharedObject(src) )

pymodule = pyenv.SharedLibrary('raytracer',
	['raytracermodule.cc']+shared_objs,
	SHLIBPREFIX = '',
	CCFLAGS = '$CCFLAGS -Wno-write-strings')

lib = env.StaticLibrary('pyrit', objs)

env.Alias('objs', objs)
env.Alias('static-lib', lib)
env.Alias('shared-objs', shared_objs)
env.Alias('python-module', pymodule)
env.Alias('libs', ['static-lib', 'python-module'])

Return('lib pymodule')