SConstruct
author Radek Brich <radek.brich@devl.cz>
Wed, 09 Apr 2008 17:55:29 +0200
branchpyrit
changeset 64 5785cca4cdb9
parent 63 440e1ae80459
child 65 242839c6d27d
permissions -rw-r--r--
add Help with list of targets to SConstruct
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.
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    28
""")
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    29
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
Decider('MD5-timestamp')
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    31
import os
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    32
env = Environment(ENV = {'PATH' : os.environ['PATH']})
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    33
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    34
### GNU C++ Compiler
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    35
#env.Replace(CXX="g++")
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    36
#env.Append(CCFLAGS="-O3 -Wall -pipe -ffast-math -msse3 ")
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    37
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    38
### Intel C++ Compiler
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    39
env.Replace(CXX="icpc")
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    40
env.Append(CCFLAGS="-O3 -w1 -mtune=core2 -xT ")
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    41
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    42
### MinGW32
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    43
#  PY_CCFLAGS=-I"C:\Program Files\Python25\include"
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    44
#  PY_LDFLAGS=-L"C:\Program Files\Python25\libs" -lpython25
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    45
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    46
# pthread
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    47
if env['PLATFORM'] == 'win32':
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    48
	env.Append(LINKFLAGS="-lpthreadGC2 ")
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    49
else:
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    50
	env.Append(CCFLAGS="-pthread ")
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    51
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    52
# CCFLAGS=-g -fno-strict-aliasing
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    53
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    54
# float: -fsingle-precision-constant
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    55
# double: -DPYRIT_DOUBLE
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    56
(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
    57
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    58
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
    59
SConscript('demos/SConscript', exports='pymodule')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    60
env.Alias('demos', ['cc-demos', 'python-demos'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    61
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    62
SConscript('models/SConscript')
60
a23b5089b9c3 moving to SCons build system
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    63
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    64
env.Alias('docs', Command('docs/html', [], 'doxygen'))
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    65
env.Clean('docs', ['docs/html', 'docs/latex'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    66
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    67
env.Alias('no-docs', ['libs', 'demos', 'models'])
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    68
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
    69
64
5785cca4cdb9 add Help with list of targets to SConstruct
Radek Brich <radek.brich@devl.cz>
parents: 63
diff changeset
    70
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
    71
63
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    72
env.Alias('pyrit', 'no-download')
440e1ae80459 add many SCons targets (see DEVNOTES)
Radek Brich <radek.brich@devl.cz>
parents: 62
diff changeset
    73
Default('pyrit')