src/SConscript
branchpyrit
changeset 65 242839c6d27d
parent 63 440e1ae80459
child 78 9569e9f35374
equal deleted inserted replaced
64:5785cca4cdb9 65:242839c6d27d
     1 Import('env')
     1 Import('env')
     2 env.Append(CPPPATH = '#include')
     2 env.Append(CPPPATH = '#include')
     3 
     3 
     4 import os
       
     5 PY_CCFLAGS = os.popen('python-config --includes').read()
       
     6 PY_LDFLAGS = os.popen('python-config --libs').read()
       
     7 pyenv = env.Clone()
     4 pyenv = env.Clone()
     8 pyenv.Append(LINKFLAGS=PY_LDFLAGS, CCFLAGS=PY_CCFLAGS)
     5 if env['PLATFORM'] == 'win32':
       
     6 	import sys
       
     7 	pythonver = '%c%c' % (sys.version[0], sys.version[2])
       
     8 	pythonlib = 'python'+pythonver
       
     9 	pythonpath = [env['pythonpath'],
       
    10 		'C:\\Program Files\\Python'+pythonver]
       
    11 	pyenv.Append(LIBS=pythonlib)
       
    12 	pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath])
       
    13 	pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath])
       
    14 	pyenv.Replace(SHLIBSUFFIX='.pyd')
       
    15 else:
       
    16 	pyenv.ParseConfig('python-config --includes --libs')
     9 
    17 
    10 sources = [
    18 sources = [
    11 	'raytracer.cc', 'scene.cc', 'sampler.cc',
    19 	'raytracer.cc', 'scene.cc', 'sampler.cc',
    12 	'container.cc', 'kdtree.cc', 'octree.cc', 'noise.cc']
    20 	'container.cc', 'kdtree.cc', 'octree.cc', 'noise.cc']
    13 
    21 
    15 shared_objs = []
    23 shared_objs = []
    16 for src in sources:
    24 for src in sources:
    17 	objs.append( env.Object(src) )
    25 	objs.append( env.Object(src) )
    18 	shared_objs.append( env.SharedObject(src) )
    26 	shared_objs.append( env.SharedObject(src) )
    19 
    27 
    20 pymodule = pyenv.SharedLibrary(
    28 pymodule = pyenv.SharedLibrary('raytracer',
    21 	['raytracermodule.cc']+shared_objs,
    29 	['raytracermodule.cc']+shared_objs,
    22 	SHLIBPREFIX = '',
    30 	SHLIBPREFIX = '',
    23 	CCFLAGS = '$CCFLAGS -Wno-write-strings')
    31 	CCFLAGS = '$CCFLAGS -Wno-write-strings')
    24 
    32 
    25 lib = env.StaticLibrary('pyrit', objs)
    33 lib = env.StaticLibrary('pyrit', objs)