-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
70 lines (64 loc) · 2.84 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
import os
cmd_options = {
'board' : ['openmote-b'],
'project' : ['at86rf215-sensors-rx', 'at86rf215-sensors-tx'],
'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'],
)