2024-06-19 15:40:07 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
case $1 in
|
2024-10-12 15:26:01 +03:00
|
|
|
debug|build)
|
2024-06-19 15:40:07 +03:00
|
|
|
;;
|
|
|
|
*)
|
2024-10-12 15:26:01 +03:00
|
|
|
echo "Usage: build_run.sh [type] where is type is 'debug' or 'build'" >&2
|
2024-06-19 15:40:07 +03:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Setup build directory
|
2024-10-12 15:26:01 +03:00
|
|
|
BASEDIR=$(cd "$(dirname $0)" && pwd)
|
|
|
|
cd "${BASEDIR}" || return
|
2024-06-19 15:40:07 +03:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Build application
|
|
|
|
type=$1
|
2024-10-12 15:26:01 +03:00
|
|
|
[[ ${type} == "build" ]] && release_param+=(--release)
|
|
|
|
cargo --config profile.release.incremental=true build "${release_param[@]}"
|
2024-06-19 15:40:07 +03:00
|
|
|
|
|
|
|
# Start application
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2024-10-12 15:26:01 +03:00
|
|
|
path=${type}
|
|
|
|
[[ ${type} == "build" ]] && path="release"
|
|
|
|
./target/"${path}"/grim
|
|
|
|
fi
|