33 lines
885 B
Bash
33 lines
885 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
configuration="${1:-Release}"
|
||
|
|
case "${configuration}" in
|
||
|
|
Debug|Release) ;;
|
||
|
|
*)
|
||
|
|
echo "usage: bash scripts/build_demo.sh [Debug|Release] [cmake arguments...]" >&2
|
||
|
|
exit 2
|
||
|
|
;;
|
||
|
|
esac
|
||
|
|
shift || true
|
||
|
|
|
||
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
project_root="$(cd "${script_dir}/.." && pwd)"
|
||
|
|
configuration_lower="$(printf '%s' "${configuration}" | tr '[:upper:]' '[:lower:]')"
|
||
|
|
build_dir="${project_root}/build/linux-${configuration_lower}"
|
||
|
|
|
||
|
|
if command -v ninja >/dev/null 2>&1; then
|
||
|
|
generator="Ninja"
|
||
|
|
else
|
||
|
|
generator="Unix Makefiles"
|
||
|
|
fi
|
||
|
|
|
||
|
|
cmake -S "${project_root}" -B "${build_dir}" -G "${generator}" \
|
||
|
|
-DCMAKE_BUILD_TYPE="${configuration}" \
|
||
|
|
-DCMVR_WITH_MSQUIC=OFF \
|
||
|
|
"$@"
|
||
|
|
cmake --build "${build_dir}" --parallel
|
||
|
|
|
||
|
|
echo "Built: ${project_root}/bin/${configuration_lower}/CmvrControlStation"
|