-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSConstruct
56 lines (46 loc) · 1.33 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
import sys
import scons_compiledb
# Remove this check for yourself if you are on Linux and still
# get exception.
if not sys.platform.startswith("linux"):
raise ValueError("You are not on a Linux system. If you are, see 'SConstruct'.")
# Get default flags etc.
env = DefaultEnvironment()
# Add compilation database support
scons_compiledb.enable_with_cmdline(env)
# To add to variables from command line
opts = Variables(None, ARGUMENTS)
is64 = sys.maxsize > 2 ** 32
opts.Add(
EnumVariable(
"target", "Compilation target.", "debug", ["d", "debug", "r", "release"]
)
)
opts.Add(
EnumVariable("bits", "Target platform bits.", "64" if is64 else "32", ["32", "64"])
)
opts.Add(
PathVariable(
"target_path",
"The path where lib is installed.",
"foosim/bin/x11/",
PathVariable.PathExists,
)
)
opts.Add(
PathVariable(
"target_name", "The library name.", "libgdfoosim", PathVariable.PathAccept
)
)
# Update env with our variables
opts.Update(env)
# Add their help texts to '-h|--help' options
Help(opts.GenerateHelpText(env))
if env["target"] in ("debug", "d"):
SConscript(
"SConscript", variant_dir="build/debug", exports={"env": env}, duplicate=0
)
else:
SConscript(
"SConscript", variant_dir="build/release", exports={"env": env}, duplicate=0
)