forked from Duet3D/RepRapFirmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
55 lines (44 loc) · 1.7 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
import os
import sys
from os.path import join
sys.path.append('./scons_tools')
from platforms import *
# Load data from ~/.rrf_arduino_paths.py
tmp_dict = {}
home = expanduser('~')
if home[-1] != '/':
home += '/'
site_file = home + '.rrf_arduino_paths.py'
if isfile(site_file):
with open(site_file) as f:
exec (f.read(), tmp_dict)
keys_of_interest = ['bossac_path', 'coreduet_home', 'coreng_home', 'gccarm_bin']
for key in keys_of_interest:
if key in tmp_dict:
if type(tmp_dict[key]) is str:
exec (key + '="' + tmp_dict[key] + '"')
elif type(tmp_dict[key]) is int:
exec (key + '=' + str(tmp_dict[key]))
else:
raise Exception(key + ' in ' + site_file + ' is of an unsupported type')
have_bossac = 'bossac_path' in globals()
have_home = ('coreng_home' in globals()) or ('coreduet_home' in globals())
have_bin = 'gccarm_bin' in globals()
if not (have_home and have_bin):
raise Exception('You must first create the file ' + site_file + \
' before building. See ' + \
'~/sample_rrf_arduino_paths.py for an example.')
if 'coreng_home' in globals():
os.environ['CORENG_HOME'] = coreng_home
else:
os.environ['CORENG_HOME'] = coreduet_home
os.environ['GCCARM_BIN'] = gccarm_bin
if have_bossac:
os.environ['BOSSAC_PATH'] = bossac_path
else:
os.environ['BOSSAC_PATH'] = 'bossac'
platform = ARGUMENTS.get('platform', 'duet').lower()
if not (platform in platforms):
raise Exception('Platform ' + platform + ' is not currently supported')
os.environ['VARIANT_DIR'] = join('build', platform)
SConscript(['src/SConscript'], variant_dir=os.environ['VARIANT_DIR'])