-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.py
executable file
·61 lines (48 loc) · 1.7 KB
/
build.py
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
#!/usr/bin/python3
"""
A helper build script - Builds the production library and vanilla solver
"""
import argparse
import glob
import os
import shutil
import subprocess
import sys
import multiprocessing
def parse_arguments(args):
parser = argparse.ArgumentParser(description='FS Planner Build Script')
parser.add_argument('--debug', action='store_true', help="Flag to compile in debug mode.")
parser.add_argument('--edebug', action='store_true', help="Flag to compile in extreme debug mode.")
return parser.parse_args(args)
def main(args):
current_dir = os.path.dirname(os.path.abspath(__file__))
cpus = multiprocessing.cpu_count() - 1
debug_flag = "edebug=1" if args.edebug else ("debug=1" if args.debug else "")
scons_command = 'scons -j {} {}'.format(cpus, debug_flag)
print("Starting build process on directory '{}' with {} CPUs.".format(current_dir, cpus))
# First build the LAPKT production library
lapkt_dir = os.environ['LAPKT2_PATH']
print('\n')
print("Building LAPKT production library...")
sys.stdout.flush()
output = subprocess.call(scons_command.split(), cwd=lapkt_dir)
if output:
sys.exit(output)
# Build the FS planner production library
print('\n')
print("Building FS production library...")
sys.stdout.flush()
output = subprocess.call(scons_command.split(), cwd=current_dir)
if output:
sys.exit(output)
# Build the vanilla generic FS planner
generic_planner_dir = os.path.join(current_dir, 'planners', 'generic')
print('\n')
print("Building FS vanilla planner...")
sys.stdout.flush()
output = subprocess.call(scons_command.split(), cwd=generic_planner_dir)
if output:
sys.exit(output)
print('\n')
if __name__ == "__main__":
main(parse_arguments(sys.argv[1:]))