forked from broxtronix/Fiat-Lux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
91 lines (68 loc) · 2.66 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import os
import SCons.Util
# -----------------------
# SETUP BUILD ENVIRONMENT
# -----------------------
env = Environment()
conf = Configure(env)
# Add osx include and lib paths (if they exist!)
if os.path.exists('/opt/local'):
env.Append(CPPPATH=["/opt/local/include"])
env.Append(LIBPATH=["/opt/local/lib"])
# AUTOCONFIGURATION
if not conf.CheckCXX():
print('!! Your compiler and/or environment is not correctly configured.')
Exit(0)
if not conf.CheckFunc('printf'):
print('!! Your compiler and/or environment is not correctly configured.')
Exit(0)
# check for math.h
if not conf.CheckLibWithHeader('m', 'math.h', 'c++'):
print "You need libm to compile this program"
Exit(1)
# Check for boost-system
if not conf.CheckLib('boost_system-mt'):
conf.env['boost-system'] = "no"
env = conf.Finish()
# BASIC COMPILER FLAGS
env.Append(CXXFLAGS = ' -I. -I/usr/X11/include -O3')
env.Append(LINKFLAGS = ' -L/usr/X11/lib -O3')
# IMPORT ENVIRONMENT VARIABLES
if os.environ.has_key('HOME'):
env['HOME'] = os.environ['HOME']
print("\t--> Setting HOME : " + os.environ['HOME'])
if os.environ.has_key('CXX'):
env.Replace(CXX = os.environ['CXX'])
print("\t--> Using C++ compiler " + os.environ['CXX'])
if os.environ.has_key('CC'):
env.Replace(CC = os.environ['CC'])
print("\t--> Using C compiler " + os.environ['CC'])
if os.environ.has_key('CXXFLAGS'):
env.Append(CXXFLAGS = os.environ['CXXFLAGS'])
print("\t--> Appending custom CXXFLAGS : " + os.environ['CXXFLAGS'])
if os.environ.has_key('CFLAGS'):
env.Append(CFLAGS = os.environ['CFLAGS'])
print("\t--> Appending custom CFLAGS : " + os.environ['CFLAGS'])
if os.environ.has_key('LDFLAGS'):
env.Append(LINKFLAGS = os.environ['LDFLAGS'])
print("\t--> Appending custom LDFLAGS : " + os.environ['LDFLAGS'])
if os.environ.has_key('PATH'):
env.Append(PATH = os.environ['PATH'])
print("\t--> Appending custom PATH : " + os.environ['PATH'])
if os.environ.has_key('PYTHONPATH'):
env.Append(PYTHONPATH = os.environ['PYTHONPATH'])
print("\t--> Appending custom PYTHONPATH : " + os.environ['PYTHONPATH'])
# SET UP BUILD DIRECTORY TARGET
env['PREFIX'] = GetLaunchDir() + "/build/"
env.Alias('stage', env['PREFIX'])
print("Staging directory: " + env['PREFIX'])
env['INSTALL_LIB_DIR'] = env['PREFIX'] + "/lib"
env['INSTALL_INC_DIR'] = env['PREFIX'] + "/include"
env['INSTALL_BIN_DIR'] = env['PREFIX'] + "/bin"
# ----------------------------
# BUILD INDIVIDUAL DIRECTORIES
# ----------------------------
# Add better depedencies using this techinque: http://www.scons.org/doc/HTML/scons-user/x3255.html#AEN3318
Export('env')
SConscript('xenon/SConscript')
SConscript('lux/SConscript')