mirror of https://github.com/ArduPilot/ardupilot
ci: simplify build script
This commit is contained in:
parent
7142bacfaa
commit
efc3f5058b
|
@ -23,33 +23,11 @@ if [[ "$cxx_compiler" == "clang++" ]]; then
|
||||||
export CCACHE_CPP2="true"
|
export CCACHE_CPP2="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If CI_BUILD_TARGET is not set, default to all of them
|
# If CI_BUILD_TARGET is not set, build 3 different ones
|
||||||
if [ -z "$CI_BUILD_TARGET" ]; then
|
if [ -z "$CI_BUILD_TARGET" ]; then
|
||||||
CI_BUILD_TARGET="sitl linux navio2 raspilot minlure bebop px4-v2 px4-v4"
|
CI_BUILD_TARGET="sitl linux px4-v2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -A build_platforms
|
|
||||||
declare -A build_concurrency
|
|
||||||
declare -A build_extra_clean
|
|
||||||
declare -A waf_supported_boards
|
|
||||||
|
|
||||||
build_platforms=( ["ArduPlane"]="navio2 raspilot minlure bebop sitl linux px4-v2"
|
|
||||||
["ArduCopter"]="navio2 raspilot minlure bebop sitl linux px4-v2 px4-v4"
|
|
||||||
["APMrover2"]="navio2 raspilot minlure bebop sitl linux px4-v2"
|
|
||||||
["AntennaTracker"]="navio2 raspilot minlure bebop sitl linux px4-v2"
|
|
||||||
["Tools/Replay"]="linux")
|
|
||||||
|
|
||||||
build_concurrency=(["navio2"]="-j2"
|
|
||||||
["raspilot"]="-j2"
|
|
||||||
["minlure"]="-j2"
|
|
||||||
["bebop"]="-j2"
|
|
||||||
["sitl"]="-j2"
|
|
||||||
["linux"]="-j2"
|
|
||||||
["px4-v2"]=""
|
|
||||||
["px4-v4"]="")
|
|
||||||
|
|
||||||
build_extra_clean=(["px4-v2"]="make px4-cleandep")
|
|
||||||
|
|
||||||
# special case for SITL testing in CI
|
# special case for SITL testing in CI
|
||||||
if [ "$CI_BUILD_TARGET" = "sitltest" ]; then
|
if [ "$CI_BUILD_TARGET" = "sitltest" ]; then
|
||||||
echo "Installing pymavlink"
|
echo "Installing pymavlink"
|
||||||
|
@ -64,6 +42,8 @@ if [ "$CI_BUILD_TARGET" = "sitltest" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
declare -A waf_supported_boards
|
||||||
|
|
||||||
waf=modules/waf/waf-light
|
waf=modules/waf/waf-light
|
||||||
|
|
||||||
# get list of boards supported by the waf build
|
# get list of boards supported by the waf build
|
||||||
|
@ -79,28 +59,38 @@ for t in $CI_BUILD_TARGET; do
|
||||||
# skip make-based build for clang
|
# skip make-based build for clang
|
||||||
if [[ "$cxx_compiler" != "clang++" ]]; then
|
if [[ "$cxx_compiler" != "clang++" ]]; then
|
||||||
echo "Starting make based build for target ${t}..."
|
echo "Starting make based build for target ${t}..."
|
||||||
for v in ${!build_platforms[@]}; do
|
for v in "ArduPlane" "ArduCopter" "APMrover2" "AntennaTracker"; do
|
||||||
if [[ ${build_platforms[$v]} != *$t* ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "Building $v for ${t}..."
|
echo "Building $v for ${t}..."
|
||||||
|
|
||||||
pushd $v
|
pushd $v
|
||||||
make clean
|
make clean
|
||||||
if [ ${build_extra_clean[$t]+_} ]; then
|
if [[ $t == "px4"* ]]; then
|
||||||
${build_extra_clean[$t]}
|
make px4-cleandep
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make $t ${build_concurrency[$t]}
|
make $t -j2
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $t == linux ]]; then
|
||||||
|
echo "Building Replay for ${t}..."
|
||||||
|
|
||||||
|
pushd "Tools/Replay"
|
||||||
|
make clean
|
||||||
|
if [[ $t == "px4"* ]]; then
|
||||||
|
make px4-cleandep
|
||||||
|
fi
|
||||||
|
|
||||||
|
make $t -j2
|
||||||
|
popd
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${waf_supported_boards[$t]} ]]; then
|
if [[ -n ${waf_supported_boards[$t]} ]]; then
|
||||||
echo "Starting waf build for board ${t}..."
|
echo "Starting waf build for board ${t}..."
|
||||||
$waf configure --board $t --enable-benchmarks --check-c-compiler="$c_compiler" --check-cxx-compiler="$cxx_compiler"
|
$waf configure --board $t --enable-benchmarks --check-c-compiler="$c_compiler" --check-cxx-compiler="$cxx_compiler"
|
||||||
$waf clean
|
$waf clean
|
||||||
$waf ${build_concurrency[$t]} all
|
$waf -j2 all
|
||||||
if [[ $t == linux ]]; then
|
if [[ $t == linux ]]; then
|
||||||
$waf check
|
$waf check
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue