| author | Radek Brich <radek.brich@devl.cz> | 
| Fri, 02 May 2008 13:27:47 +0200 | |
| branch | pyrit | 
| changeset 91 | 9d66d323c354 | 
| parent 90 | f6a72eb99631 | 
| child 92 | 9af5c039b678 | 
| permissions | -rw-r--r-- | 
| 91 | 1  | 
Import('env buildmodule')
 | 
| 60 | 2  | 
|
| 91 | 3  | 
env = env.Clone(CPPPATH = '#include')  | 
| 60 | 4  | 
pyenv = env.Clone()  | 
| 
65
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
5  | 
if env['PLATFORM'] == 'win32':  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
6  | 
import sys  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
7  | 
pythonver = '%c%c' % (sys.version[0], sys.version[2])  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
8  | 
pythonlib = 'python'+pythonver  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
9  | 
pythonpath = [env['pythonpath'],  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
10  | 
'C:\\Program Files\\Python'+pythonver]  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
11  | 
pyenv.Append(LIBS=pythonlib)  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
12  | 
pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath])  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
13  | 
pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath])  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
14  | 
pyenv.Replace(SHLIBSUFFIX='.pyd')  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
15  | 
else:  | 
| 
 
242839c6d27d
basic detection of compiler (GCC or ICC) and CPU capabilities
 
Radek Brich <radek.brich@devl.cz> 
parents: 
63 
diff
changeset
 | 
16  | 
	pyenv.ParseConfig('python-config --includes --libs')
 | 
| 60 | 17  | 
|
18  | 
sources = [  | 
|
| 
78
 
9569e9f35374
move shapes to extra source file
 
Radek Brich <radek.brich@devl.cz> 
parents: 
65 
diff
changeset
 | 
19  | 
'raytracer.cc', 'scene.cc', 'shapes.cc', 'sampler.cc',  | 
| 
79
 
062b1c4143f7
material and texture classes moved to material.(cc,h)
 
Radek Brich <radek.brich@devl.cz> 
parents: 
78 
diff
changeset
 | 
20  | 
'container.cc', 'kdtree.cc', 'octree.cc', 'material.cc',  | 
| 
88
 
f7edb3b90816
merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
 
Radek Brich <radek.brich@devl.cz> 
parents: 
79 
diff
changeset
 | 
21  | 
'serialize.cc', 'pixmap.cc']  | 
| 60 | 22  | 
|
23  | 
objs = []  | 
|
24  | 
shared_objs = []  | 
|
25  | 
for src in sources:  | 
|
26  | 
objs.append( env.Object(src) )  | 
|
27  | 
shared_objs.append( env.SharedObject(src) )  | 
|
28  | 
||
| 91 | 29  | 
if buildmodule:  | 
30  | 
	pymodule = pyenv.SharedLibrary('pyrit',
 | 
|
31  | 
['raytracermodule.cc']+shared_objs,  | 
|
32  | 
SHLIBPREFIX = '',  | 
|
33  | 
CCFLAGS = '$CCFLAGS -Wno-write-strings')  | 
|
34  | 
	env.Alias('shared-objs', shared_objs)
 | 
|
35  | 
	env.Alias('python-module', pymodule)
 | 
|
36  | 
	Return('pymodule')
 | 
|
37  | 
else:  | 
|
38  | 
	lib = env.StaticLibrary('pyrit', objs)
 | 
|
39  | 
	env.Alias('objs', objs)
 | 
|
40  | 
	env.Alias('static-lib', lib)
 | 
|
41  | 
	Return('lib')
 |