1
+
EnsureSConsVersion(0,14);
2
+
3
+
import os
4
+
import os.path
5
+
import glob
6
+
import sys
7
+
import methods
8
+
9
+
methods.update_version()
10
+
11
+
# scan possible build platforms
12
+
13
+
platform_list = [] # list of platforms
14
+
platform_opts = {} # options for each platform
15
+
platform_flags = {} # flags for each platform
16
+
17
+
18
+
active_platforms=[]
19
+
active_platform_ids=[]
20
+
platform_exporters=[]
21
+
global_defaults=[]
22
+
23
+
for x in glob.glob("platform/*"):
24
+
if (not os.path.isdir(x)):
25
+
continue
26
+
tmppath="./"+x
27
+
28
+
sys.path.append(tmppath)
29
+
import detect
30
+
31
+
if (os.path.exists(x+"/export/export.cpp")):
32
+
platform_exporters.append(x[9:])
33
+
if (os.path.exists(x+"/globals/global_defaults.cpp")):
34
+
global_defaults.append(x[9:])
35
+
if (detect.is_active()):
36
+
active_platforms.append( detect.get_name() )
37
+
active_platform_ids.append(x);
38
+
if (detect.can_build()):
39
+
x=x.replace("platform/","") # rest of world
40
+
x=x.replace("platform\\","") # win32
41
+
platform_list+=[x]
42
+
platform_opts[x]=detect.get_opts()
43
+
platform_flags[x]=detect.get_flags()
44
+
sys.path.remove(tmppath)
45
+
sys.modules.pop('detect')
46
+
47
+
module_list=methods.detect_modules()
48
+
49
+
50
+
print "Detected Platforms: "+str(platform_list)
51
+
print("Detected Modules: "+str(module_list))
52
+
53
+
methods.save_active_platforms(active_platforms,active_platform_ids)
54
+
55
+
custom_tools=['default']
56
+
57
+
if (os.name=="posix"):
58
+
pass
59
+
elif (os.name=="nt"):
60
+
if (os.getenv("VSINSTALLDIR")==None):
61
+
custom_tools=['mingw']
62
+
63
+
env_base=Environment(tools=custom_tools,ENV = {'PATH' : os.environ['PATH']});
64
+
#env_base=Environment(tools=custom_tools);
65
+
env_base.global_defaults=global_defaults
66
+
env_base.android_source_modules=[]
67
+
env_base.android_source_files=[]
68
+
env_base.android_module_libraries=[]
69
+
env_base.android_manifest_chunk=""
70
+
env_base.disabled_modules=[]
71
+
72
+
env_base.__class__.android_module_source = methods.android_module_source
73
+
env_base.__class__.android_module_library = methods.android_module_library
74
+
env_base.__class__.android_module_file = methods.android_module_file
75
+
env_base.__class__.android_module_manifest = methods.android_module_manifest
76
+
env_base.__class__.disable_module = methods.disable_module
77
+
78
+
env_base.__class__.add_source_files = methods.add_source_files
79
+
80
+
customs = ['custom.py']
81
+
82
+
profile = ARGUMENTS.get("profile", False)
83
+
if profile:
84
+
import os.path
85
+
if os.path.isfile(profile):
86
+
customs.append(profile)
87
+
elif os.path.isfile(profile+".py"):
88
+
customs.append(profile+".py")
89
+
90
+
opts=Options(customs, ARGUMENTS)
91
+
opts.Add('target', 'Compile Target (debug/profile/release).', "debug")
92
+
opts.Add('platform','Platform: '+str(platform_list)+'(sfml).',"")
93
+
opts.Add('python','Build Python Support: (yes/no)','no')
94
+
opts.Add('squirrel','Build Squirrel Support: (yes/no)','no')
95
+
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
96
+
opts.Add('lua','Build Lua Support: (yes/no)','no')
97
+
opts.Add('rfd','Remote Filesystem Driver: (yes/no)','no')
98
+
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
99
+
opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
100
+
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
101
+
opts.Add('opengl', 'Build OpenGL Support: (yes/no)', 'yes')
102
+
opts.Add('game', 'Game (custom) Code Directory', "")
103
+
opts.Add('squish','Squish BC Texture Compression (yes/no)','yes')
104
+
opts.Add('theora','Theora Video (yes/no)','yes')
105
+
opts.Add('freetype','Freetype support in editor','yes')
106
+
opts.Add('speex','Speex Audio (yes/no)','yes')
107
+
opts.Add('xml','XML Save/Load support (yes/no)','yes')
108
+
opts.Add('png','PNG Image loader support (yes/no)','yes')
109
+
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
110
+
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
111
+
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
112
+
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
113
+
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
114
+
opts.Add('musepack','Musepack Audio (yes/no)','yes')
115
+
opts.Add('default_gui_theme','Default GUI theme (yes/no)','yes')
116
+
opts.Add("CXX", "Compiler");
117
+
opts.Add("nedmalloc", "Add nedmalloc support", 'yes');
118
+
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
119
+
opts.Add("CFLAGS", "Custom flags for the C compiler");
120
+
opts.Add("LINKFLAGS", "Custom flags for the linker");
121
+
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
122
+
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
123
+
opts.Add('old_scenes', 'Compatibility with old-style scenes', "yes")
124
+
125
+
# add platform specific options
126
+
127
+
for k in platform_opts.keys():
128
+
opt_list = platform_opts[k]
129
+
for o in opt_list:
130
+
opts.Add(o[0],o[1],o[2])
131
+
132
+
for x in module_list:
133
+
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
134
+
135
+
opts.Update(env_base) # update environment
136
+
Help(opts.GenerateHelpText(env_base)) # generate help
137
+
138
+
# add default include paths
139
+
140
+
env_base.Append(CPPPATH=['#core','#core/math','#tools','#drivers','#'])
141
+
142
+
# configure ENV for platform
143
+
env_base.detect_python=True
144
+
env_base.platform_exporters=platform_exporters
145
+
146
+
"""
147
+
sys.path.append("./platform/"+env_base["platform"])
148
+
import detect
149
+
detect.configure(env_base)
150
+
sys.path.remove("./platform/"+env_base["platform"])
151
+
sys.modules.pop('detect')
152
+
"""
153
+
154
+
if (env_base['target']=='debug'):
155
+
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
156
+
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
157
+
158
+
env_base.platforms = {}
159
+
160
+
for p in platform_list:
161
+
162
+
sys.path.append("./platform/"+p)
163
+
import detect
164
+
if "create" in dir(detect):
165
+
env = detect.create(env_base)
166
+
else:
167
+
env = env_base.Clone()
168
+
detect.configure(env)
169
+
env['platform'] = p
170
+
sys.path.remove("./platform/"+p)
171
+
sys.modules.pop('detect')
172
+
173
+
flag_list = platform_flags[p]
174
+
for f in flag_list:
175
+
env[f[0]] = f[1]
176
+
177
+
env.module_list=[]
178
+
179
+
for x in module_list:
180
+
if env['module_'+x+'_enabled'] != "yes":
181
+
continue
182
+
tmppath="./modules/"+x
183
+
sys.path.append(tmppath)
184
+
env.current_module=x
185
+
import config
186
+
if (config.can_build(p)):
187
+
config.configure(env)
188
+
env.module_list.append(x)
189
+
sys.path.remove(tmppath)
190
+
sys.modules.pop('config')
191
+
192
+
193
+
if (env['musepack']=='yes'):
194
+
env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
195
+
196
+
if (env["old_scenes"]=='yes'):
197
+
env.Append(CPPFLAGS=['-DOLD_SCENE_FORMAT_ENABLED'])
198
+
if (env["rfd"]=='yes'):
199
+
env.Append(CPPFLAGS=['-DRFD_ENABLED'])
200
+
if (env["builtin_zlib"]=='yes'):
201
+
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
202
+
203
+
if (env['squirrel']=='yes'):
204
+
205
+
env.Append(CPPFLAGS=['-DSQUIRREL_ENABLED'])
206
+
env.Append(CPPPATH=['#script/squirrel/src'])
207
+
208
+
# to test 64 bits compiltion
209
+
# env.Append(CPPFLAGS=['-m64'])
210
+
211
+
if (env['lua']=='yes'):
212
+
213
+
env.Append(CPPFLAGS=['-DLUA_ENABLED'])
214
+
env.Append(CPPPATH=['#script/lua/src'])
215
+
if (env_base['squish']=='yes'):
216
+
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
217
+
218
+
if (env['vorbis']=='yes'):
219
+
env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
220
+
221
+
if (env['theora']=='yes'):
222
+
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
223
+
224
+
if (env['png']=='yes'):
225
+
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
226
+
if (env['dds']=='yes'):
227
+
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
228
+
if (env['pvr']=='yes'):
229
+
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
230
+
if (env['jpg']=='yes'):
231
+
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
232
+
if (env['webp']=='yes'):
233
+
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
234
+
235
+
if (env['speex']=='yes'):
236
+
env.Append(CPPFLAGS=['-DSPEEX_ENABLED']);
237
+
238
+
if (env['tools']=='yes'):
239
+
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
240
+
if (env['disable_3d']=='yes'):
241
+
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
242
+
if (env['gdscript']=='yes'):
243
+
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
244
+
if (env['disable_advanced_gui']=='yes'):
245
+
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
246
+
247
+
if (env['minizip'] == 'yes'):
248
+
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
249
+
250
+
if (env['xml']=='yes'):
251
+
env.Append(CPPFLAGS=['-DXML_ENABLED'])
252
+
253
+
if (env['default_gui_theme']=='no'):
254
+
env.Append(CPPFLAGS=['-DDEFAULT_THEME_DISABLED'])
255
+
256
+
if (env["python"]=='yes'):
257
+
detected=False;
258
+
if (env.detect_python):
259
+
print("Python 3.0 Prefix:");
260
+
pycfg_exec="python3-config"
261
+
errorval=os.system(pycfg_exec+" --prefix")
262
+
prefix=""
263
+
if (not errorval):
264
+
#gah, why can't it get both at the same time like pkg-config, sdl-config, etc?
265
+
env.ParseConfig(pycfg_exec+" --cflags")
266
+
env.ParseConfig(pycfg_exec+" --libs")
267
+
detected=True
268
+
269
+
if (detected):
270
+
env.Append(CPPFLAGS=['-DPYTHON_ENABLED'])
271
+
#remove annoying warnings
272
+
if ('-Wstrict-prototypes' in env["CCFLAGS"]):
273
+
env["CCFLAGS"].remove('-Wstrict-prototypes');
274
+
if ('-fwrapv' in env["CCFLAGS"]):
275
+
env["CCFLAGS"].remove('-fwrapv');
276
+
else:
277
+
print("Python 3.0 not detected ("+pycfg_exec+") support disabled.");
278
+
279
+
#if env['nedmalloc'] == 'yes':
280
+
# env.Append(CPPFLAGS = ['-DNEDMALLOC_ENABLED'])
281
+
282
+
Export('env')
283
+
284
+
#build subdirs, the build order is dependent on link order.
285
+
286
+
SConscript("core/SCsub")
287
+
SConscript("servers/SCsub")
288
+
SConscript("scene/SCsub")
289
+
SConscript("tools/SCsub")
290
+
SConscript("script/SCsub");
291
+
SConscript("drivers/SCsub")
292
+
SConscript("bin/SCsub")
293
+
294
+
if env['game']:
295
+
SConscript(env['game']+'/SCsub')
296
+
297
+
SConscript("modules/SCsub")
298
+
SConscript("main/SCsub")
299
+
300
+
SConscript("platform/"+p+"/SCsub"); # build selected platform
301
+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4