-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
executable file
·46 lines (39 loc) · 1.05 KB
/
build.sh
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
#!/bin/sh
BUILD_DIR="build"
DIST_DIR="dist"
GCC="/usr/bin/arm-none-eabi-gcc"
GPP="/usr/bin/arm-none-eabi-g++"
# Force the elf and uf2 binary files to always be regenerated on build
# (this is so old uf2 files don't pile up in dist directory)
rm ${BUILD_DIR}/src/*/*/*.elf
rm ${BUILD_DIR}/src/*/*/*.uf2
/usr/bin/cmake \
--no-warn-unused-cli \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_C_COMPILER:FILEPATH=${GCC} \
-DCMAKE_CXX_COMPILER:FILEPATH=${GPP} \
-DDREAMCAST_CONTROLLER_USB_PICO_TEST:BOOL=FALSE \
-S. \
-B./${BUILD_DIR} \
-G "Unix Makefiles" \
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "CMake returned error exit code: ${STATUS}"
echo "Exiting"
exit $STATUS
fi
/usr/bin/cmake \
--build ${BUILD_DIR} \
--config Debug \
--target all \
-j 10 \
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "CMake returned error exit code: ${STATUS}"
echo "Exiting"
exit $STATUS
fi
mkdir -p ${DIST_DIR}
rm -rf ${DIST_DIR}/*
cp ${BUILD_DIR}/src/*/*/*.uf2 ${DIST_DIR}