cmvr-es/scripts/build.sh
lgv 08d9a393be chore(build): unify scripts and add build/install entrypoint
Add a Debug-default build script with Release and RelWithDebInfo support and automatic output installation. Run bundled protobuf tools without requiring a prior install.

Consolidate scripts/, remove unused tools and meshes, and update documentation and test commands. Include the TCHL profile-position test target adjustment to 3 rad.
2026-10-27 11:32:41 +08:00

32 lines
875 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 [Debug|Release|RelWithDebInfo] (default: Debug)"
}
if [[ $# -eq 1 && ( $1 == --help || $1 == -h ) ]]; then
usage
exit 0
fi
if [[ $# -gt 1 ]]; then
usage >&2
exit 1
fi
cmvr_build_type="${1:-Debug}"
case "$cmvr_build_type" in
Debug|Release|RelWithDebInfo) ;;
*) usage >&2; exit 1 ;;
esac
cmvr_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
cmvr_build_dir="$cmvr_root/build/$cmvr_build_type"
cmake -S "$cmvr_root" -B "$cmvr_build_dir" -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="$cmvr_build_type" \
-DCMAKE_INSTALL_PREFIX="$cmvr_root/output"
cmake --build "$cmvr_build_dir" --parallel "${CMAKE_BUILD_PARALLEL_LEVEL:-4}"
cmake --install "$cmvr_build_dir" --prefix "$cmvr_root/output"
printf 'Built %s and installed to %s\n' "$cmvr_build_type" "$cmvr_root/output"