1
0
Fork 0

docker: allow passing arguments to build

This commit is contained in:
Julian Foad 2024-08-26 22:50:47 +01:00
parent ab9eaef3fc
commit a8a99bc462

View file

@ -26,6 +26,7 @@ export GCC_ARM_PATH="gcc-arm-none-eabi-$GCC_ARM_VER"
main() {
local target="$1"
shift
mkdir -p "$TOOLS_DIR"
@ -35,7 +36,7 @@ main() {
mkdir -p "$BUILD_DIR"
CmakeGenerate
CmakeGenerate "$@"
CmakeBuild $target
BUILD_RESULT=$?
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
@ -68,13 +69,16 @@ CmakeGenerate() {
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
-DBUILD_DFU=1 \
-DBUILD_RESOURCES=1
-DBUILD_RESOURCES=1 \
"$@"
}
# CmakeBuild [target [CMAKE_ARGS...]]
# CMAKE_ARGS can include a '--' arg, with the same meaning as it has in 'cmake'.
CmakeBuild() {
local target="$1"
[ -n "$target" ] && target="--target $target"
cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
[ -n "$target" ] && target="--target $target" && shift
cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target "$@" -- -j$(nproc)
BUILD_RESULT=$?
return $BUILD_RESULT
}