forked from WithSecureOpenSource/encjson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
56 lines (51 loc) · 1.55 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 os
import fsenv
DIRECTORIES = [
'src',
'test',
'components/encjson' ]
TARGET_DEFINES = {
'freebsd_amd64': [],
'linux32': ['_FILE_OFFSET_BITS=64'],
'linux64': [],
'linux_arm64': [],
'openbsd_amd64': [],
'darwin': []
}
TARGET_FLAGS = {
'freebsd_amd64': '',
'linux32': '-m32 ',
'linux64': '',
'linux_arm64': '',
'openbsd_amd64': '',
'darwin': ''
}
def construct():
ccflags = '-std=c11 -g -O2 -Wall -Werror'
prefix = ARGUMENTS.get('prefix', '/usr/local')
for target_arch in fsenv.target_architectures():
arch_env = Environment(
NAME='encjson',
ARCH=target_arch,
PREFIX=prefix,
PKG_CONFIG_LIBS=['fsdyn', 'fstrace'],
CCFLAGS=TARGET_FLAGS[target_arch] + ccflags,
CPPDEFINES=TARGET_DEFINES[target_arch],
LINKFLAGS=TARGET_FLAGS[target_arch],
tools=['default', 'textfile', 'fscomp'])
fsenv.consider_environment_variables(arch_env)
if target_arch == "darwin":
arch_env.AppendENVPath("PATH", "/opt/local/bin")
build_dir = os.path.join(
fsenv.STAGE,
target_arch,
ARGUMENTS.get('builddir', 'build'))
for directory in DIRECTORIES:
env = arch_env.Clone()
SConscript(dirs=directory,
exports=['env'],
duplicate=False,
variant_dir=os.path.join(build_dir, directory))
Clean('.', build_dir)
if __name__ == 'SCons.Script':
construct()