build libpandasafety with scons (#639)
* build libpandasafety with scons * remove makefile * fix thatmaster
parent
f146aa367b
commit
596344e48b
|
@ -3,6 +3,7 @@
|
||||||
.*.swo
|
.*.swo
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
|
*.os
|
||||||
*.d
|
*.d
|
||||||
*.dump
|
*.dump
|
||||||
a.out
|
a.out
|
||||||
|
|
|
@ -1 +1,8 @@
|
||||||
|
AddOption('--test',
|
||||||
|
action='store_true',
|
||||||
|
help='build test files')
|
||||||
|
|
||||||
SConscript('board/SConscript')
|
SConscript('board/SConscript')
|
||||||
|
|
||||||
|
if GetOption('test'):
|
||||||
|
SConscript('tests/safety/SConscript')
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
CC = clang
|
|
||||||
CCFLAGS = -O3 -fPIC -DPANDA -I.
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: libpandasafety.so
|
|
||||||
|
|
||||||
libpandasafety.so: test.o
|
|
||||||
$(CC) -shared -o '$@' $^ -lm
|
|
||||||
|
|
||||||
test.o: test.c
|
|
||||||
@echo "[ CC ] $@"
|
|
||||||
$(CC) $(CCFLAGS) -MMD -c -I../../board -o '$@' '$<'
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f libpandasafety.so test.o test.d
|
|
||||||
|
|
||||||
-include test.d
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
env = Environment(
|
||||||
|
CC='clang',
|
||||||
|
CXX='clang++',
|
||||||
|
CPPPATH=[".", "../../board"],
|
||||||
|
)
|
||||||
|
|
||||||
|
env.SharedLibrary("libpandasafety.so", ["test.c"])
|
|
@ -5,7 +5,7 @@ from cffi import FFI
|
||||||
|
|
||||||
can_dir = os.path.dirname(os.path.abspath(__file__))
|
can_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
libpandasafety_fn = os.path.join(can_dir, "libpandasafety.so")
|
libpandasafety_fn = os.path.join(can_dir, "libpandasafety.so")
|
||||||
subprocess.check_call(["make"], cwd=can_dir)
|
subprocess.check_call([f"scons -u -j{os.cpu_count()} --test ."], shell=True, cwd=can_dir)
|
||||||
|
|
||||||
ffi = FFI()
|
ffi = FFI()
|
||||||
ffi.cdef("""
|
ffi.cdef("""
|
||||||
|
|
Loading…
Reference in New Issue