forked from appcelerator-archive/titanium_desktop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
95 lines (80 loc) · 2.99 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
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
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python
# this will ensure that you're using the right version of scons
EnsureSConsVersion(1,2,0)
# this will ensure that you're using the right version of python
EnsurePythonVersion(2,5)
# common SConscripts
import os, re, sys, inspect, os.path as path
from sets import Set
import subprocess, distutils.dir_util as dir_util
sys.path.append(path.join(path.abspath('.'), 'build'))
import titanium_version
from kroll import BuildConfig
build = BuildConfig(
PRODUCT_VERSION = titanium_version.version,
INSTALL_PREFIX = '/usr/local',
PRODUCT_NAME = 'Titanium',
GLOBAL_NS_VARNAME = 'Titanium',
CONFIG_FILENAME = 'tiapp.xml',
BUILD_DIR = path.abspath('build'),
THIRD_PARTY_DIR = path.join(path.abspath('kroll'), 'thirdparty'),
DISTRIBUTION_URL = 'api.appcelerator.net',
CRASH_REPORT_URL = 'api.appcelerator.net/p/v1/app-crash-report'
)
build.set_kroll_source_dir(path.abspath('kroll'))
build.titanium_source_dir = path.abspath('.')
build.titanium_support_dir = path.join(build.titanium_source_dir, 'support', build.os)
# This should only be used for accessing various
# scripts in the kroll build directory. All resources
# should instead be built to build.dir
build.kroll_build_dir = path.join(build.kroll_source_dir, 'build')
build.env.Append(CPPPATH=[
build.titanium_source_dir,
build.kroll_source_dir,
build.kroll_include_dir
])
# debug build flags
debug = ARGUMENTS.get('debug', 0)
if debug:
build.env.Append(CPPDEFINES = ('DEBUG', 1))
if build.is_win32():
build.env.Append(CCFLAGS=['/Z7']) # max debug
build.env.Append(CPPDEFINES=('WIN32_CONSOLE', 1))
else:
build.env.Append(CPPFLAGS=['-g']) # debug
else:
build.env.Append(CPPDEFINES = ('NDEBUG', 1 ))
if not build.is_win32():
build.env.Append(CPPFLAGS = ['-O9']) # max optimizations
if build.is_win32():
build.env.Append(CCFLAGS=['/EHsc', '/GR', '/MD'])
build.env.Append(LINKFLAGS=['/DEBUG', '/PDB:${TARGET}.pdb'])
Export('build', 'debug')
targets = COMMAND_LINE_TARGETS
clean = 'clean' in targets or ARGUMENTS.get('clean', 0)
qclean = 'qclean' in targets or ARGUMENTS.get('qclean', 0)
build.nopackage = ARGUMENTS.get('nopackage', 0)
if clean or qclean:
print "Obliterating your build directory: %s" % build.dir
if path.exists(build.dir):
dir_util.remove_tree(build.dir)
if not qclean: os.system('scons -c')
Exit(0)
# forcing a crash to test crash detection
if ARGUMENTS.get('test_crash', 0):
build.env.Append(CPPDEFINES = ('TEST_CRASH_DETECTION', 1))
## Kroll *must not be required* for installation
SConscript('kroll/SConscript.thirdparty', exports='debug')
SConscript('installation/SConscript')
# After Kroll builds, the environment will link
# against libkroll, so anything that should not be
# linked against libkroll should be above this point.
SConscript('kroll/SConscript', exports='debug')
SConscript('modules/SConscript')
SConscript('SConscript.dist')
SConscript('SConscript.docs')
SConscript('SConscript.test')
run = ARGUMENTS.get('run', 0)
run_with = ARGUMENTS.get('run_with', 0)
Export('run','run_with')
SConscript('apps/SConscript')