prepare kd-tree traversal for packet tracing (4 rays at once)
RayPacket and VectorPacket structures for packet tracing
remove some redundant const's
Help("""
Targets:
all - build everything,
libs - build all libraries
demos - build all demos
models - download/prepare all models
docs - compile doxygen documentation
libs = (static-lib, python-module)
static-lib - ray tracer library to link with
python-module - ray tracer module for Python
demos = (python-demos, cc-demos)
python-demos - Python demos, this depends on python-module
cc-demos - C++ demos
models = (local-models, download-models)
local-models - prepare local models
download-models - download models which are not locally available
no-docs = (libs, demos, models)
- everything but docs
no-download = (libs, demos, local-models)
- everything but docs and downloadable models
Default target is no-download.
Options:
""")
import os, sys
env = Environment(ENV = {'PATH' : os.environ['PATH']})
Decider('MD5-timestamp')
opt = Options(['.optioncache'])
opt.AddOptions(
BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
('precision', 'floating point number precision (single/double)', "single"),
('flags', 'add additional compiler flags', ""),
)
if env['PLATFORM'] == 'win32':
opt.AddOptions(
('pythonpath', 'path to Python installation',
'C:\\Python%c%c' % (sys.version[0], sys.version[2])),
)
opt.Update(env)
opt.Save('.optioncache', env)
Help(opt.GenerateHelpText(env))
platform = 'unknown'
def CheckPlatform(context):
global platform
context.Message('Platform is... ')
if sys.platform[:5] == 'linux':
platform = 'linux'
elif env['PLATFORM'] == 'posix':
platform = 'posix'
elif env['PLATFORM'] == 'win32':
platform = 'win32'
context.Result(platform)
return True
def CheckIntelC(context):
global intelc, intelcversion
context.Message('Checking for Intel C++ Compiler... ')
intelc = Tool("intelc").exists(env) == True
if intelc:
testenv = Environment()
Tool("intelc").generate(testenv)
intelcversion = str(testenv['INTEL_C_COMPILER_VERSION']/10.)
context.Result(intelcversion)
else:
intelcversion = ''
context.Result(intelc)
return intelc
def CheckGCC(context):
global gcc, gccversion
context.Message('Checking for GCC... ')
gcc = "g++" in env['TOOLS']
if gcc:
gccversion = env['CCVERSION']
context.Result(gccversion)
else:
gccversion = ''
context.Result(False)
return gcc
def CheckCPUFlags(context):
global cpu, cpuflags_gcc, cpuflags_intelc
context.Message('Checking CPU arch and flags... ')
env.Execute('@$CC tools/cpuflags.c -o tools/cpuflags')
(cpu, cpuflags_gcc, cpuflags_intelc) = os.popen('tools/cpuflags %s %s'
% (''.join(gccversion.rsplit('.',1)), intelcversion) ).read().split('\n')[:3]
context.Result(cpu)
return True
conf = Configure(env,
custom_tests = {
'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags,
'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC})
conf.CheckPlatform()
conf.CheckGCC()
conf.CheckIntelC()
conf.CheckCPUFlags()
env = conf.Finish()
if intelc and env['intelc']:
Tool("intelc").generate(env)
cc = 'intelc'
elif gcc:
cc = 'gcc'
add_flags = ''
if cc == 'gcc':
add_flags += cpuflags_gcc + ' -ffast-math '
if cc == 'intelc':
add_flags += cpuflags_intelc + ' '
if env['precision'] == 'double':
add_flags += '-DPYRIT_DOUBLE '
elif cc == 'gcc':
add_flags += '-fsingle-precision-constant '
add_flags += env['flags']
if cc == 'intelc':
env.Append(CCFLAGS="-O3 -w1 " + add_flags)
elif cc == 'gcc':
env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags)
# CCFLAGS= -fno-strict-aliasing
else:
print "No supported compiler found."
Exit(1)
print "Using compiler: " + cc
print "Additional flags: " + add_flags
# pthread
if env['PLATFORM'] == 'win32':
env.Append(LIBS=["pthreadGC2"])
else:
env.Append(CCFLAGS="-pthread ")
(lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env')
SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='env lib')
SConscript('demos/SConscript', exports='pymodule')
env.Alias('demos', ['cc-demos', 'python-demos'])
SConscript('tests/SConscript', build_dir='build/tests', duplicate=0, exports='env lib')
SConscript('models/SConscript')
env.Alias('docs', Command('docs/html', [], 'doxygen'))
env.Clean('docs', ['docs/html'])
env.Alias('no-docs', ['libs', 'demos', 'models'])
env.Alias('no-download', ['libs', 'demos', 'local-models'])
env.Alias('all', ['no-docs', 'docs'])
env.Alias('pyrit', 'no-download')
Default('pyrit')