SConstruct
author Radek Brich <radek.brich@devl.cz>
Thu, 10 Apr 2008 23:20:36 +0200
branchpyrit
changeset 65 242839c6d27d
parent 64 5785cca4cdb9
child 66 c5b89d16497a
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:
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     1
Help("""
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     2
Targets:
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     3
    all              - build everything,
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     4
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     5
    libs             - build all libraries
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     6
    demos            - build all demos
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     7
    models           - download/prepare all models
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     8
    docs             - compile doxygen documentation
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
     9
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    10
    libs = (static-lib, python-module)
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    11
    static-lib       - ray tracer library to link with
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    12
    python-module    - ray tracer module for Python
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    13
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    14
    demos = (python-demos, cc-demos)
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    15
    python-demos     - Python demos, this depends on python-module
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    16
    cc-demos         - C++ demos
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    17
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    18
    models = (local-models, download-models)
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    19
    local-models     - prepare local models
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    20
    download-models  - download models which are not locally available
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    21
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    22
    no-docs = (libs, demos, models)
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    23
                     - everything but docs
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    24
    no-download = (libs, demos, local-models)
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    25
                     - everything but docs and downloadable models
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    26
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    27
Default target is no-download.
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    28
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    29
Options:
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    30
""")
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    31
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    32
import os, sys
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    33
env = Environment(ENV = {'PATH' : os.environ['PATH']})
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    34
Decider('MD5-timestamp')
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    35
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    36
opt = Options(['.optioncache'])
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    37
opt.AddOptions(
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    38
	BoolOption('intelc', 'use Intel C++ Compiler, if available', True),
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    39
	('flags', 'add additional compiler flags', ""),
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    40
)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    41
if env['PLATFORM'] == 'win32':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    42
	opt.AddOptions(
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    43
		('pythonpath', 'path to Python installation',
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    44
			'C:\\Python%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: 64
diff changeset
    45
		)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    46
opt.Update(env)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    47
opt.Save('.optioncache', env)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    48
Help(opt.GenerateHelpText(env))
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    49
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    50
if env['intelc']:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    51
	Tool("intelc")(env)
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    52
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    53
platform = 'unknown'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    54
def CheckPlatform(context):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    55
	global platform
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    56
	context.Message('Platform is... ')
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    57
	if sys.platform[:5] == 'linux':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    58
		platform = 'linux'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    59
	elif env['PLATFORM'] == 'posix':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    60
		platform = 'posix'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    61
	elif env['PLATFORM'] == 'win32':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    62
		platform = 'win32'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    63
	context.Result(platform)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    64
	return True
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    66
cpu = 'unknown'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    67
def CheckCPU(context):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    68
	global cpu, platform
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    69
	context.Message('Checking CPU model... ')
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    70
	if (platform == 'linux'):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    71
		if (os.system("cat /proc/cpuinfo | grep 'Core(TM)2 CPU' >/dev/null") == 0):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    72
			cpu = 'core2'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    73
	context.Result(cpu)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    74
	return True
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    75
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    76
def CheckIntelC(context):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    77
	global intelc
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    78
	context.Message('Checking for Intel C++ Compiler... ')
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    79
	intelc = "intelc" in env['TOOLS']
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    80
	context.Result(intelc)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    81
	return intelc
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    82
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    83
def CheckGCC(context):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    84
	global gcc, gccversion
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    85
	context.Message('Checking for GCC... ')
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    86
	gcc = "g++" in env['TOOLS']
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    87
	if gcc:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    88
		gccversion = os.popen("g++ --version").read().split()[2]
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    89
		context.Result(gccversion)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    90
	else:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    91
		context.Result(False)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    92
	return gcc
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    93
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    94
conf = Configure(env,
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    95
	custom_tests = {
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    96
		'CheckPlatform' : CheckPlatform, 'CheckCPU' : CheckCPU,
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    97
		'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC})
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    98
conf.CheckPlatform()
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
    99
conf.CheckCPU()
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   100
conf.CheckGCC()
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   101
conf.CheckIntelC()
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   102
env = conf.Finish()
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   103
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   104
if intelc:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   105
	cc = 'intelc'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   106
elif gcc:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   107
	cc = 'gcc'
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   108
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   109
cpu_flags = ''
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   110
if cc == 'gcc':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   111
	cpu_flags += '-ffast-math '
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   112
if cpu == 'core2':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   113
	if (cc == 'intelc' or gccversion[:3] == '4.3'):
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   114
		cpu_flags += '-march=core2 -mtune=core2 '
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   115
	if cc == 'intelc':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   116
		cpu_flags += '-xT '
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   117
	if cc == 'gcc':
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   118
		cpu_flags += '-msse3 -mfpmath=sse '
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   119
cpu_flags += env['flags']
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   120
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   121
if intelc:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   122
	env.Append(CCFLAGS="-O3 -w1 " + cpu_flags)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   123
elif gcc:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   124
	env.Append(CCFLAGS="-O3 -Wall -pipe " + cpu_flags)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   125
	# CCFLAGS= -fno-strict-aliasing
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   126
else:
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   127
	print "No supported compiler found."
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   128
	Exit(1)
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   129
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   130
print "Additional compiler flags: " + cpu_flags
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   131
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   132
# pthread
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
   133
if env['PLATFORM'] == 'win32':
65
242839c6d27d basic detection of compiler (GCC or ICC) and CPU capabilities
Radek Brich <radek.brich@devl.cz>
parents: 64
diff changeset
   134
	env.Append(LIBS=["pthreadGC2"])
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
   135
else:
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
   136
	env.Append(CCFLAGS="-pthread ")
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   137
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   138
# float: -fsingle-precision-constant
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   139
# double: -DPYRIT_DOUBLE
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   140
(lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   141
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   142
SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='env lib')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   143
SConscript('demos/SConscript', exports='pymodule')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   144
env.Alias('demos', ['cc-demos', 'python-demos'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   145
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   146
SConscript('models/SConscript')
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   147
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   148
env.Alias('docs', Command('docs/html', [], 'doxygen'))
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   149
env.Clean('docs', ['docs/html', 'docs/latex'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   150
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   151
env.Alias('no-docs', ['libs', 'demos', 'models'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   152
env.Alias('no-download', ['libs', 'demos', 'local-models'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   153
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
   154
env.Alias('all', ['no-docs', 'docs'])
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
   155
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   156
env.Alias('pyrit', 'no-download')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
   157
Default('pyrit')