You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
868 B
43 lines
868 B
#!/bin/bash |
|
|
|
set -e -x |
|
|
|
DIR=$(cd "$(dirname "$0")"; pwd -P) |
|
|
|
TOOLCHAIN_IMAGE="esp32-toolchain:latest" |
|
BUILD_DIR="$DIR/cmake-build" |
|
DOCKERFILE="$DIR/Dockerfile" |
|
|
|
build_docker_container() { |
|
docker build -f "$DOCKERFILE" -t "$TOOLCHAIN_IMAGE" "$DIR" |
|
} |
|
|
|
build_docker() { |
|
build_docker_container |
|
docker run \ |
|
--volume="$DIR:/esp/uas-ugv" \ |
|
--interactive --tty --rm \ |
|
"$TOOLCHAIN_IMAGE" \ |
|
/esp/uas-ugv/build.sh cmake "$@" |
|
} |
|
|
|
build_cmake() { |
|
mkdir -p "$BUILD_DIR" |
|
cd "$BUILD_DIR" |
|
cmake -G Ninja "$DIR" |
|
cmake --build "$BUILD_DIR" -- "$@" |
|
} |
|
|
|
build_clean() { |
|
rm -rf "$BUILD_DIR" |
|
} |
|
|
|
CMD="$1"; shift |
|
|
|
case $CMD in |
|
docker_container) build_docker_container ;; |
|
docker) build_docker "$@" ;; |
|
cmake) build_cmake "$@" ;; |
|
clean) build_clean ;; |
|
*) echo "Usage: $0 <docker_container|docker|cmake>" ;; |
|
esac
|
|
|