-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
77 lines (69 loc) · 3.26 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
import os
cmd_options = {
'board': ['openmote-b'],
'project': ['demo-rx', 'demo-tx', 'freertos-cc2538', 'freertos-cc2538-tickless', 'ieee802154-sniffer',
'test-aes', 'test-board', 'test-crc', 'test-openmote', 'test-openmote-b', 'test-radio-at86rf215',
'test-radio-cc2538', 'test-radiotimer', 'test-rendezvous', 'test-serial',
'test-sleeptimer', 'test-spi', 'test-pwm', 'test-task', 'test-timer', 'test-uart', 'experiment-tx', 'experiment-rx'],
'compiler': ['gcc'],
'verbose': ['0', '1']
}
def validate_option(key, value, env):
if key not in cmd_options:
raise ValueError("Unknown switch {0}.".format(key))
if value not in cmd_options[key]:
raise ValueError("Unknown {0} \"{1}\". Options are {2}.\n\n".format(
key, value, ','.join(cmd_options[key])))
cmd_vars = Variables()
cmd_vars.AddVariables(
(
'board', # key
'', # help
None, # default
validate_option, # validator
None, # converter
),
(
'project', # key
'', # help
None, # default
validate_option, # validator
None, # converter
),
(
'bootload', # key
'', # help
'', # default
None, # validator
None, # converter
),
(
'compiler', # key
'', # help
cmd_options['verbose'][0], # default
validate_option, # validator
None, # converter
),
(
'params', # key
'', # help
'', # default
None, # validator
None, # converter
),
(
'verbose', # key
'', # help
cmd_options['verbose'][0], # default
validate_option, # validator
int, # converter
)
)
# Define default environment to support GCC
env = DefaultEnvironment(ENV=os.environ, tools=[
'cc', 'c++', 'ar', 'gnulink'], variables=cmd_vars)
Export('env')
env.SConscript(
'SConscript',
exports=['env'],
)