src/SConscript
branchpyrit
changeset 93 96d65f841791
parent 92 9af5c039b678
child 99 f3abdaa2e8fb
--- a/src/SConscript	Mon May 05 15:31:14 2008 +0200
+++ b/src/SConscript	Tue May 06 09:39:58 2008 +0200
@@ -1,44 +1,36 @@
-Import('env buildmodule cc')
-
-myenv = env.Clone(CPPPATH = '#include')
-pyenv = myenv.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')
+Import('env pyenv buildmodule cc')
 
 sources = [
-	'raytracer.cc', 'scene.cc', 'shapes.cc', 'sampler.cc',
-	'container.cc', 'kdtree.cc', 'octree.cc', 'material.cc',
-	'serialize.cc', 'pixmap.cc']
-
-objs = []
-shared_objs = []
-for src in sources:
-	objs.append( myenv.Object(src) )
-	shared_objs.append( myenv.SharedObject(src) )
+	'common.cc', 'raytracer.cc', 'sampler.cc', 'scene.cc',
+	'shapes.cc', 'material.cc', 'pixmap.cc', 'serialize.cc',
+	'container.cc', 'kdtree.cc', 'octree.cc']
 
 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)
+		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)
 	Return('pymodule')
 else:
-	lib = myenv.StaticLibrary('pyrit', objs)
+	objs = []
+	for src in sources:
+		objs.append( env.Object(src) )
+	lib = env.StaticLibrary('pyrit', objs)
 	env.Alias('objs', objs)
 	env.Alias('static-lib', lib)
 	Return('lib')