forked from rqbh/RTGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
60 lines (46 loc) · 1.69 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
import os
import sys
import shutil
from os.path import join as path_join
RTT_ROOT = os.path.normpath(os.getcwd())
sys.path = sys.path + [path_join(RTT_ROOT, 'win32')]
from building import *
import rtconfig
sys.path.insert(0, path_join(RTT_ROOT, 'components', 'rtgui', 'utils'))
exe_dir = 'executables'
# list of targets, list item format in:
# ['executable_name', 'path_to_SConscript']
TARGETS = [['demo', 'demo'],
['realtouch', 'realtouch']]
env = Environment()
if Execute(env['CC']):
env.Append(ENV = os.environ)
if ARGUMENTS.get('VERBOSE') != '1':
env['CCCOMSTR'] = "Compiling $TARGET"
env['LINKCOMSTR'] = "Linking $TARGET"
Export('RTT_ROOT')
Export('rtconfig')
# prepare building environment
base_objs = PrepareBuilding(env, RTT_ROOT)
for exe_name, src_path in TARGETS:
work_objs = base_objs + SConscript(dirs=[src_path],
variant_dir=path_join('build', src_path),
duplicate=0)
# build program
env.Program(path_join(exe_dir, exe_name), work_objs)
# end building
EndBuilding(exe_name)
# build for testcases
list = os.listdir(os.path.join(str(Dir('#')), 'test_cases'))
for d in list:
src_path = os.path.join(str(Dir('#')), 'test_cases', d)
if os.path.isfile(os.path.join(src_path, 'SConscript')):
exe_name = os.path.basename(src_path)
objs = base_objs + SConscript(dirs=[src_path],
variant_dir=path_join('build', src_path),
duplicate=0)
# build program
env.Program(path_join(exe_dir, exe_name), objs)
# end building
EndBuilding(exe_name)
PreBuilding()