Add build.sh ci option to allow for easier co-operation of native and devcontainer builds in the same workspace

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-01-12 19:15:36 +01:00
parent 41ebe5ec51
commit 1ef587f552

View File

@@ -12,6 +12,9 @@
# Abort script if one command returns a non-zero value # Abort script if one command returns a non-zero value
set -e set -e
# Set builddir
builddir="cmake/"
# Parse arguments # Parse arguments
for var in "$@" for var in "$@"
do do
@@ -20,6 +23,7 @@ do
"-C" | "CLEAN" ) clean=1 && nobuild=1;; "-C" | "CLEAN" ) clean=1 && nobuild=1;;
"-i" | "install" ) install=1;; "-i" | "install" ) install=1;;
"-t" | "test" ) test=1;; "-t" | "test" ) test=1;;
"ci" ) builddir="cmake_ci/";;
esac esac
done done
@@ -27,7 +31,7 @@ done
if [[ -n "${clean}" ]]; then if [[ -n "${clean}" ]]; then
echo "Cleaning build environment" echo "Cleaning build environment"
# Remove build directory # Remove build directory
rm -rf cmake/ rm -rf "${builddir}"
if [[ -n ${nobuild} ]]; then if [[ -n ${nobuild} ]]; then
exit 0 exit 0
fi fi
@@ -59,8 +63,8 @@ done
# Configure build, pass CMake CACHE entries if present # Configure build, pass CMake CACHE entries if present
# Wrap multiple options in "" as first argument to ./build.sh: # Wrap multiple options in "" as first argument to ./build.sh:
# ./build.sh "-DA=1 -DB=2" install # ./build.sh "-DA=1 -DB=2" install
mkdir -p cmake mkdir -p "${builddir}"
cd cmake cd "${builddir}"
if [[ "${1}" == "-D"* ]]; then if [[ "${1}" == "-D"* ]]; then
cmake "${1}" .. cmake "${1}" ..
else else