-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
112 lines (92 loc) · 2.61 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import fnmatch
import os
import time
import atexit
from SCons.Defaults import *
release = True
if(release):
optimization = '-Os'
debug = '-g0'
lto = "1"
closure = "1"
assertions = "0"
demangle = "0"
else:
optimization = '-O0'
debug = '-g3'
lto = "0"
closure = "0"
assertions = "2"
demangle = "1"
def main():
env = Environment(ENV = os.environ, tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas'])
env.Replace(CC = "emcc" )
env.Replace(CXX = "em++" )
env.Replace(LINK = "emcc" )
env.Replace(AR = "emar" )
env.Replace(RANLIB = "emranlib")
env.Replace(LIBLINKPREFIX = "")
env.Replace(LIBPREFIX = "")
env.Replace(LIBLINKSUFFIX = ".bc")
env.Replace(LIBSUFFIX = ".bc")
env.Replace(OBJSUFFIX = ".o")
env.Replace(PROGSUFFIX = ".js")
env.Append( CPPFLAGS=[optimization] )
env.Append( LINKFLAGS=[
optimization,
debug,
"-s", "ASSERTIONS=" + assertions,
"-s", "DEMANGLE_SUPPORT=" + demangle,
"-s", "TOTAL_MEMORY=600000000",
"--llvm-lto", lto,
"--closure", closure,
"-s", "NO_EXIT_RUNTIME=1",
"-s", "DISABLE_EXCEPTION_CATCHING=1",
"-s", "EXPORTED_FUNCTIONS=\"['_main','_resizeModule','_putchar']\"",
"--preload-file", "data"
] )
timeStart = time.time()
atexit.register(PrintInformationOnBuildIsFinished, timeStart)
Includes = [
"sources/SBFramework",
"libs/glm",
"libs/imgui",
"libs/pugixml/src",
"libs/SimpleText/include",
"libs/lz4/lib"
]
imguiSources = [
"libs/imgui/imgui.cpp",
"libs/imgui/imgui_demo.cpp",
"libs/imgui/imgui_draw.cpp"
]
lz4Sources = [
"libs/lz4/lib/lz4.c",
"libs/lz4/lib/lz4hc.c",
"libs/lz4/lib/xxhash.c"
]
pugiSources = [
"libs/pugixml/src/pugixml.cpp"
]
sourcesPath = "sources"
files = GlobR(sourcesPath, "*.cpp")
env.Library('pugi', pugiSources)
env.Library('imgui', imguiSources)
env.Library('lz4', lz4Sources)
program = env.Program('ProceduralSky', files, LIBS=['imgui', 'pugi', 'lz4'], CPPFLAGS=[optimization, '-std=c++11', debug], LIBPATH='.', CPPPATH = Includes)
env.Depends(program, GlobR("data", "*"))
def PrintInformationOnBuildIsFinished(startTimeInSeconds):
""" Launched when scons is finished """
failures = GetBuildFailures()
for failure in failures:
print "Target [%s] failed: %s" % (failure.node, failure.errstr)
timeDelta = time.gmtime(time.time() - startTimeInSeconds)
print time.strftime("Build time: %M minutes %S seconds", timeDelta)
def GlobR(path, filter) :
matches = []
for root, dirnames, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, filter):
matches.append(os.path.join(root, filename))
return matches
if __name__ == "SCons.Script":
main()