chore: add build script
This commit is contained in:
parent
b8a52790eb
commit
9da4401406
26
build.sh
Normal file
26
build.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
BUILD_DIR=./build/
|
||||
TARGET=all
|
||||
|
||||
while getopts "b:t:" option; do
|
||||
case $option in
|
||||
b) BUILD_DIR=$OPTARG ;;
|
||||
t) TARGET=$OPTARG ;;
|
||||
?)
|
||||
echo "Error: invalid option"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -d "$BUILD_DIR" ]; then
|
||||
mkdir "$BUILD_DIR"
|
||||
if [ ! -d "$BUILD_DIR" ]; then
|
||||
echo "Error: could not create folder '$BUILD_DIR'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cmake -S . -B "$BUILD_DIR"
|
||||
cmake --build "$BUILD_DIR" --target "$TARGET"
|
||||
Loading…
x
Reference in New Issue
Block a user