src/SConscript
author Radek Brich <radek.brich@devl.cz>
Thu, 10 Apr 2008 23:20:36 +0200
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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
     1
Import('env')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
     2
env.Append(CPPPATH = '#include')
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     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
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
sources = [
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
	'raytracer.cc', 'scene.cc', 'sampler.cc',
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    20
	'container.cc', 'kdtree.cc', 'octree.cc', 'noise.cc']
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
objs = []
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
shared_objs = []
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
for src in sources:
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
	objs.append( env.Object(src) )
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
	shared_objs.append( env.SharedObject(src) )
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    28
pymodule = pyenv.SharedLibrary('raytracer',
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
	['raytracermodule.cc']+shared_objs,
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
	SHLIBPREFIX = '',
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
	CCFLAGS = '$CCFLAGS -Wno-write-strings')
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    32
61
7006036eb0db minor SConscript tweaking
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    33
lib = env.StaticLibrary('pyrit', objs)
7006036eb0db minor SConscript tweaking
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    34
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    35
env.Alias('objs', objs)
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    36
env.Alias('static-lib', lib)
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    37
env.Alias('shared-objs', shared_objs)
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    38
env.Alias('python-module', pymodule)
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    39
env.Alias('libs', ['static-lib', 'python-module'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 61
diff changeset
    40
61
7006036eb0db minor SConscript tweaking
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    41
Return('lib pymodule')