3 # Stops on first error, echo on
7 # Allow variable core usage, default uses two cores, to set 8 cores for example : commit-tests.sh -j8
9 # Default build treats warnings as errors, set -Wno-error to override, e.g.: commit-tests.sh -Wno-error
11 # A board name to build for, or ALL
36 if [ "$(uname)" = "Darwin" ]; then
37 SCRIPT
=$
(python
-c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")
39 SCRIPT
=$
(readlink
-f "$0")
42 if [[ ! -z ${GCC_ARM} ]] ; then
43 export PATH
=${GCC_ARM}:$PATH
46 : ${SRCDIR:=$(dirname "$SCRIPT")/..}
48 : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=Debug -DTRACE_SIMPGMSPACE=NO -DVERBOSE_CMAKELISTS=YES -DCMAKE_RULE_MESSAGES=OFF -Wno-dev"}
49 if (( $WERROR )); then COMMON_OPTIONS
+=" -DWARNINGS_AS_ERRORS=YES"; fi
51 : ${EXTRA_OPTIONS:="$EXTRA_OPTIONS"}
53 COMMON_OPTIONS
+=${EXTRA_OPTIONS}
55 : ${TEST_OPTIONS:="--gtest_shuffle --gtest_repeat=5 --gtest_break_on_failure"}
57 : ${FIRMARE_TARGET:="firmware-size"}
62 if [[ " 9X AVR9X ALL " =~
" ${FLAVOR} " ]] ; then
63 # OpenTX on 9X stock with FrSky telemetry
65 cmake
${COMMON_OPTIONS} -DPCB=9X
-DHELI=YES
-DTEMPLATES=YES
-DGVARS=YES
-DTELEMETRY=FRSKY
${SRCDIR}
66 make -j${CORES} ${FIRMARE_TARGET}
67 make -j${CORES} libsimulator
68 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
70 # OpenTX on 9X stock with Ardupilot telemetry
72 cmake
${COMMON_OPTIONS} -DPCB=9X
-DHELI=YES
-DTEMPLATES=YES
-DGVARS=YES
-DTELEMETRY=ARDUPILOT
${SRCDIR}
73 make -j${CORES} ${FIRMARE_TARGET}
75 # OpenTX on 9X stock with JETI telemetry
77 cmake
${COMMON_OPTIONS} -DPCB=9X
-DHELI=YES
-DTEMPLATES=YES
-DGVARS=YES
-DTELEMETRY=JETI
${SRCDIR}
78 make -j${CORES} ${FIRMARE_TARGET}
81 if [[ " MEGA2560 AVR9X ALL " =~
" ${FLAVOR} " ]] ; then
84 cmake
${COMMON_OPTIONS} -DPCB=MEGA2560
-DTEMPLATES=YES
-DGVARS=YES
-DHELI=YES
${SRCDIR}
85 make -j${CORES} ${FIRMARE_TARGET}
86 make -j${CORES} libsimulator
87 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
89 # OpenTX on Mega2560 with Mavlink telemetry
91 cmake
${COMMON_OPTIONS} -DPCB=MEGA2560
-DTELEMETRY=MAVLINK
-DHELI=YES
-DTEMPLATES=YES
-DAUDIO=YES
-DVOICE=YES
-DGVARS=YES
${SRCDIR}
92 make -j${CORES} ${FIRMARE_TARGET}
93 make -j${CORES} libsimulator
94 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
97 if [[ " GRUVIN9X AVR9X ALL " =~
" ${FLAVOR} " ]] ; then
98 # OpenTX on gruvin9x board
100 cmake
${COMMON_OPTIONS} -DPCB=GRUVIN9X
-DHELI=YES
-DTEMPLATES=YES
-DAUDIO=YES
-DVOICE=YES
-DGVARS=YES
${SRCDIR}
101 make -j${CORES} ${FIRMARE_TARGET}
102 make -j${CORES} libsimulator
103 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
106 if [[ " SKY9X ARM9X ALL " =~
" ${FLAVOR} " ]] ; then
109 cmake
${COMMON_OPTIONS} -DPCB=SKY9X
-DHELI=YES DLUA
=YES
-DMULTIMODULE=YES
-DTELEMETRY=FRSKY
-DPPM_LIMITS_SYMETRICAL=YES
-DVARIO=YES
-DGAUGES=YES
-DAUTOSWITCH=YES
-DAUTOSOURCE=YES
-DAUDIO=YES
-DGPS=YES
-DPPM_CENTER_ADJUSTABLE=YES
-DFLIGHT_MODES=YES
-DOVERRIDE_CHANNEL_FUNCTION=YES
-DFRSKY_STICKS=YES
-DGVARS=YES
${SRCDIR}
110 make -j${CORES} ${FIRMARE_TARGET}
111 make -j${CORES} libsimulator
112 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
115 if [[ " AR9X ARM9X ALL " =~
" ${FLAVOR} " ]] ; then
118 cmake
${COMMON_OPTIONS} -DPCB=AR9X
-DHELI=YES
-DGVARS=YES
${SRCDIR}
119 make -j${CORES} ${FIRMARE_TARGET}
120 make -j${CORES} libsimulator
121 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
124 if [[ " 9XRPRO ARM9X ALL " =~
" ${FLAVOR} " ]] ; then
127 cmake
${COMMON_OPTIONS} -DPCB=9XRPRO
-DHELI=YES
-DGVARS=YES
${SRCDIR}
128 make -j${CORES} ${FIRMARE_TARGET}
129 make -j${CORES} libsimulator
130 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
133 if [[ " X7 ALL " =~
" ${FLAVOR} " ]] ; then
136 cmake
${COMMON_OPTIONS} -DPCB=X7
-DHELI=YES
-DGVARS=YES
${SRCDIR}
137 make -j${CORES} ${FIRMARE_TARGET}
138 make -j${CORES} libsimulator
139 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
142 if [[ " X9D X9 ALL " =~
" ${FLAVOR} " ]] ; then
145 cmake
${COMMON_OPTIONS} -DPCB=X9D
-DHELI=YES
-DLUA=YES
-DGVARS=YES
${SRCDIR}
146 make -j${CORES} ${FIRMARE_TARGET}
147 make -j${CORES} libsimulator
148 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
151 if [[ " X9D+ X9 ALL " =~
" ${FLAVOR} " ]] ; then
154 cmake
${COMMON_OPTIONS} -DPCB=X9D
+ -DHELI=YES
-DLUA=YES
-DGVARS=YES
${SRCDIR}
155 make -j${CORES} ${FIRMARE_TARGET}
156 make -j${CORES} libsimulator
157 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
160 if [[ " X9E X9 ALL " =~
" ${FLAVOR} " ]] ; then
161 # OpenTX on Taranis X9E
163 cmake
${COMMON_OPTIONS} -DPCB=X9E
-DHELI=YES
-DLUA=YES
-DGVARS=YES
-DPPM_UNIT=PERCENT_PREC1
${SRCDIR}
164 make -j${CORES} ${FIRMARE_TARGET}
165 make -j${CORES} libsimulator
166 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
169 if [[ " X10 HORUS ALL " =~
" ${FLAVOR} " ]] ; then
170 # OpenTX on X10 boards
172 cmake
${COMMON_OPTIONS} -DPCB=X10
-DHELI=YES
-DLUA=YES
-DGVARS=YES
${SRCDIR}
173 make -j${CORES} ${FIRMARE_TARGET}
174 make -j${CORES} libsimulator
175 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
178 if [[ " X12Sr10 HORUS ALL " =~
" ${FLAVOR} " ]] ; then
179 # OpenTX on Horus beta boards
181 cmake
${COMMON_OPTIONS} -DPCB=X12S
-DPCBREV=10 -DHELI=YES
-DLUA=YES
-DGVARS=YES
${SRCDIR}
182 make -j${CORES} ${FIRMARE_TARGET}
183 make -j${CORES} libsimulator
184 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
187 if [[ " X12S HORUS ALL " =~
" ${FLAVOR} " ]] ; then
190 cmake
${COMMON_OPTIONS} -DPCB=X12S
-DHELI=YES
-DLUA=YES
-DGVARS=YES
${SRCDIR}
191 make -j${CORES} ${FIRMARE_TARGET}
192 make -j${CORES} libsimulator
193 make -j${CORES} gtests
; .
/gtests
${TEST_OPTIONS}
196 if [[ " DEFAULT ALL " =~
" ${FLAVOR} " ]] ; then
199 cmake
${COMMON_OPTIONS} ${SRCDIR}