-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstruction.scons
More file actions
85 lines (71 loc) · 2.55 KB
/
Copy pathconstruction.scons
File metadata and controls
85 lines (71 loc) · 2.55 KB
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
import os
import compilers
import envBuilder
import utils
AddOption('--platform',
dest='platform',
type='choice',
nargs=1,
choices=["native", "beagle", "android"],
action='store',
metavar='ARCHITECTURE',
default='native',
help='Specify platform.')
AddOption('--android-abi',
dest='abi',
type='choice',
nargs=1,
choices=["armeabi-v7a", "arm64-v8a", "x86", "x86-64"],
action='store',
metavar='ABI',
default='x86',
help='Specify Android ABI.')
AddOption('--type',
dest='build-type',
type='choice',
nargs=1,
choices=["debug", "release"],
action='store',
metavar='BUILD-TYPE',
default='release',
help='Specify build type (relase, debug etc).')
AddOption('--install-path',
dest='install-path',
type='string',
nargs=1,
action='store',
metavar='PATH-PREFIX',
default='#install',
help='Specify installation directory prefix, e.g /usr/local')
# Determine build configuration from command line options:
platform = GetOption('platform')
android_abi = GetOption('abi')
buildType = GetOption('build-type')
installRoot = GetOption('install-path')
if not utils.TargetIsValid(platform):
raise RuntimeError("Invalid platform/architecture: " + platform)
if not utils.BuildTypeIsValid(buildType):
raise RuntimeError("Invalid build type: " + buildType)
# Setup the compiler:
compiler = compilers.makeCompilerFor(platform, buildType, android_abi)
compiler.AppendFlags( '-Wall -pedantic' )
print("Compiler cmd: " + compiler.cmd)
print("Compiler path: " + compiler.path)
print("Compiler sysroot: " + compiler.sysroot)
# Initialise the environment to use this compiler:
env = envBuilder.makeEnvForCompiler(compiler)
env.Decider('MD5-timestamp')
env['platform'] = platform
env['abi'] = android_abi
install_path = os.path.join(installRoot, platform)
if platform in ['android']:
install_path = os.path.join(install_path, android_abi)
env['installPath'] = Dir(install_path).abspath
subdirs = utils.FindSconsDirs( './' )
for sconsDir in subdirs:
sconsFile = os.path.join(sconsDir, 'SConscript')
buildPath = os.path.join('build', platform, sconsDir, buildType)
if platform in ['android']:
buildPath = os.path.join(buildPath, android_abi)
clonedEnv = env.Clone()
SConscript( sconsFile, variant_dir=buildPath, duplicate=0, exports={ 'env' : clonedEnv, 'compiler' : compiler } )