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
|
"""
A SConscript file.
Builds everything.
"""
import os
import sys
Import('env')
env = env.Clone()
dirs = {
'root': Dir('.'),
'include': Dir('include'),
'lib': Dir('lib'),
'bin': Dir('bin'),
}
env.Append(CPPPATH=[dirs['include']])
env.Append(CXXFLAGS=['-isystem', Dir('third-party/install/include').srcnode()])
env.Append(LIBPATH=[dirs['lib']])
env.Append(LIBPATH=[Dir('third-party/install/lib').srcnode()])
env.GenerateDefines(target=os.path.join('include', env.defines.defines_file_name), source=env.defines.template_file_path)
libraries = []
includes = []
for x in Glob('libs/*'):
sconscript_path = x.File('SConscript')
if sconscript_path.exists():
name = os.path.basename(str(x))
if not sys.platform.startswith('linux'):
if name in 'netlinkplus':
continue
else:
if name in 'mongooseplus':
continue
library, library_includes = SConscript(sconscript_path, exports='env dirs name')
libraries.extend(library)
includes.extend(library_includes)
apps = []
configurations = []
for x in Glob('apps/*'):
sconscript_path = x.File('SConscript')
if sconscript_path.exists():
name = os.path.basename(str(x))
app, configuration = SConscript(sconscript_path, exports='env dirs name')
apps.extend(app)
configurations.extend(configuration)
samples = []
if env.mode != 'retail':
for x in Glob('samples/*'):
libname = os.path.basename(str(x))
if not sys.platform.startswith('linux'):
if libname in 'netlinkplus':
continue
for y in x.glob('*'):
sconscript_path = y.File('SConscript')
if sconscript_path.exists():
name = 'sample_%s_%s' % (libname, os.path.basename(str(y)))
sample = SConscript(sconscript_path, exports='env dirs name')
samples.extend(sample)
if env.mode == 'release':
samples.extend(env.SymLink(y.File('%sd' % os.path.basename(str(y))).srcnode(), sample))
else:
samples.extend(env.SymLink(y.File(os.path.basename(str(y))).srcnode(), sample))
Return('libraries includes apps samples configurations')
|