forked from VDrift/vdrift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConscript
268 lines (246 loc) · 7.53 KB
/
SConscript
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
import os, sys
#-------------#
# Import Vars #
#-------------#
Import('*')
#----------------#
# Subdirectories #
#----------------#
def addbulletpath( val ):
return "#bullet/"+val
#---------#
# Sources #
#---------#
src = Split("""
aabb.cpp
aabbtree.cpp
ai/ai_car_experimental.cpp
ai/ai_car_standard.cpp
ai/ai.cpp
autoupdate.cpp
bezier.cpp
camera_chase.cpp
camera_free.cpp
camera_mount.cpp
camera_orbit.cpp
carcontrolmap.cpp
cargraphics.cpp
carsound.cpp
cfg/config.cpp
cfg/ptree.cpp
cfg/ptree_inf.cpp
cfg/ptree_ini.cpp
containeralgorithm.cpp
content/configfactory.cpp
content/contentmanager.cpp
content/modelfactory.cpp
content/soundfactory.cpp
content/texturefactory.cpp
crashdetection.cpp
downloadable.cpp
dynamicsdraw.cpp
eventsystem.cpp
fastmath.cpp
forcefeedback.cpp
game.cpp
graphics/bcndecode.cpp
graphics/dds.cpp
graphics/drawable.cpp
graphics/fbobject.cpp
graphics/fbtexture.cpp
graphics/gl3v/glenums.cpp
graphics/gl3v/glwrapper.cpp
graphics/gl3v/renderer.cpp
graphics/gl3v/renderpass.cpp
graphics/glcore.cpp
graphics/glutil.cpp
graphics/graphics_config_condition.cpp
graphics/graphics_config.cpp
graphics/graphics_gl2.cpp
graphics/graphics_gl3v.cpp
graphics/mesh_gen.cpp
graphics/model.cpp
graphics/model_joe03.cpp
graphics/model_obj.cpp
graphics/render_input_postprocess.cpp
graphics/render_input_scene.cpp
graphics/render_output.cpp
graphics/shader.cpp
graphics/sky.cpp
graphics/texture.cpp
graphics/vertexarray.cpp
graphics/vertexbuffer.cpp
graphics/vertexformat.cpp
gui/font.cpp
gui/guicontrol.cpp
gui/guicontrollist.cpp
gui/gui.cpp
gui/guiimage.cpp
gui/guiimagelist.cpp
gui/guilabel.cpp
gui/guilabellist.cpp
gui/guilanguage.cpp
gui/guilinearslider.cpp
gui/guioption.cpp
gui/guipage.cpp
gui/guiradialslider.cpp
gui/guislider.cpp
gui/guiwidget.cpp
gui/guiwidgetlist.cpp
gui/text_draw.cpp
frustumcull.cpp
http.cpp
joepack.cpp
joeserialize.cpp
k1999.cpp
keyed_container.cpp
linearinterp.cpp
loadcamera.cpp
loadcollisionshape.cpp
loaddrawable.cpp
main.cpp
mathplane.cpp
mathvector.cpp
matrix4.cpp
optional.cpp
parallel_task.cpp
particle.cpp
pathmanager.cpp
performance_testing.cpp
physics/cardynamics.cpp
physics/carengine.cpp
physics/carsuspension.cpp
physics/cartire1.cpp
physics/cartire2.cpp
physics/cartire3.cpp
physics/dynamicsworld.cpp
physics/fracturebody.cpp
quaternion.cpp
radix.cpp
random.cpp
replay.cpp
reseatable_reference.cpp
roadpatch.cpp
roadstrip.cpp
settings.cpp
skidmarks.cpp
sound/soundbuffer.cpp
sound/sound.cpp
sound/soundfilter.cpp
sprite2d.cpp
suspensionbumpdetection.cpp
svn_sourceforge.cpp
timer.cpp
toggle.cpp
track.cpp
trackloader.cpp
trackmap.cpp
updatemanager.cpp
utils.cpp
window.cpp""")
src.sort(key = str.lower)
#------------------------#
# Copy Build Environment #
#------------------------#
local_env = env.Clone()
SConsignFile()
#--------------------------#
# Modify Build Environment #
#--------------------------#
appdir = ""
vdrift_install = None
common_libs = ['SDL2_image', 'vorbisfile', 'curl']
if sys.platform in ['freebsd6', 'freebsd7', 'freebsd8', 'freebsd9']:
common_libs.append('libLinearMath')
common_libs.append('libBulletCollision')
local_env.ParseConfig('sdl2-config --cflags --libs')
local_env.Append(LIBPATH = ['/usr/X11R6/lib'])
libs_link = ['pthread', common_libs]
elif ( 'darwin' == sys.platform ):
common_libs = ['SDL2_image', 'Vorbis', 'cURL']
vdrift_install = "${PRODUCT_NAME}.app"
pkgbase = "%s/Contents" % vdrift_install
appdir = "%s/MacOS/" % pkgbase
pkgsrc = "../vdrift-mac"
common_libs.append( 'SDL2' )
common_libs.append( 'WebP' )
common_libs.append( 'BulletCollision' )
common_libs.append( 'BulletDynamics' )
common_libs.append( 'BulletSoftBody' )
common_libs.append( 'LinearMath' )
common_libs.append( 'Ogg' )
def batch_copy( target, source, env):
# Do a mini svn export... this funtion could possibly
# be useful in general ( as a builder ), but I don't
# want to think about getting it cross-platform...
# win32 could use xcopy... but there are so many different
# versions of the tools below in circulation that
# testing would be difficult
for tgt, src in zip( target, source ):
src = str(src)
tgt = str(tgt)
env.Execute( ( "mkdir -p '%s';" +
"tar -cf - -C '%s' . --exclude \\*/.svn\\* |" +
"tar -xf - -C '%s'" ) % ( tgt, src, tgt ) )
def build_list( template, items ):
return [ template % x for x in items ]
Alias( 'vdrift', [
local_env.ProcessTemplate(
'%s/Info.plist' % pkgbase,
'%s/Info.plist' % pkgsrc ),
local_env.Command(
'%s/Resources/${PRODUCT_NAME}.icns' % pkgbase,
'%s/icon.icns' % pkgsrc,
Copy( '$TARGET', '$SOURCE') ),
[ local_env.WorkingExport( '%s/Frameworks' % pkgbase, s ) for s in
build_list( '%s/Frameworks/%%s.framework' % pkgsrc, common_libs ) ] ] )
#local_env.Command(
# build_list( '%s/Frameworks/%%s.framework' % pkgbase, common_libs ),
# build_list( '%s/%%s.framework' % pkgsrc, common_libs ),
# batch_copy ) ] )
libs_link = ['objc', 'iconv.2', 'intl.8']
local_env.Append( LIBPATH = [ '../vdrift-mac/Libraries'] )
local_env.Append( FRAMEWORKS = [ common_libs, 'Foundation', 'AppKit'] )
src.append(['../vdrift-mac/config_mac.mm'])
elif sys.platform in ['win32', 'msys', 'cygwin']:
#local_env.Append(LIBPATH = ['/usr/lib/mingw', '#tools/win/lib', '#build'])
libs_link = ['opengl32', 'mingw32', 'SDL2main', 'SDL2', 'intl', common_libs ]
else:
local_env.ParseConfig('sdl2-config --cflags --libs')
#local_env.Append(LIBPATH = ['/usr/X11R6/lib'])
libs_link = ['GL','pthread', common_libs]
local_env.Append(LIBS = libs_link)
#-----------------------#
# Distribute to src_dir #
#-----------------------#
dist_files = ['SConscript'] + src
env.Distribute (src_dir, dist_files)
#--------------------#
# Compile Executable #
#--------------------#
vdrift = local_env.Program(target='%s${EXECUTABLE_NAME}' % appdir, source=src)
Default(Alias('vdrift', vdrift))
#---------#
# Install #
#---------#
if not vdrift_install: vdrift_install = vdrift
install = env.Install(Dir(env.subst("$destdir$prefix/$bindir")), vdrift_install)
env.Alias("install", install)
#---------------#
# Python Export #
#---------------#
if not sys.platform in ['win32', 'msys', 'cygwin']:
#for now this seems to break windows build so disabling for win
wrapper_build_env = local_env.Clone()
pybase = 'python%s' % sys.version[0:3]
wrapper_build_env.Append(CPPPATH=[os.path.join(sys.prefix, 'include', pybase)],
LIBPATH=[os.path.join(sys.prefix, 'lib', pybase, 'config')],
LIBS=['lib%s' % pybase])
# wrapper_build_env.Append(CPPDEFINES=['BOOST_PYTHON_STATIC_LIB', 'BOOST_PYTHON_STATIC_MODULE'],
# CPPPATH=['#include','$boostIncludes'], # boostIncludes is a PathOption
# LIBS=['boost_python'])
wrapper_build_env.Replace(SHLIBPREFIX = '_') # do not add 'lib' in front of the output file
wrapper_build_env.Append(SWIGFLAGS=['-c++', '-python'])
#wrapper = wrapper_build_env.SharedLibrary('vdrift', [src, vamosobjs, guiobjs, "vdrift.i"])
wrapper = wrapper_build_env.SharedLibrary('vdrift', [src, "vdrift.i"])
env.Alias("wrapper", wrapper)