Make windows-configure.sh runnable without root/build

For when you want to set up a windows build dir, without doing the build
yet.
This commit is contained in:
Jason Rhinelander 2022-09-01 15:15:34 -03:00 committed by Jeff Becker
parent a02679b87a
commit 49b97f47cc
No known key found for this signature in database
GPG Key ID: 025C02EE3A092F2D

View File

@ -2,12 +2,25 @@
set -e
set -x
root=$(readlink -f "$1")
shift
mkdir -p "$1"
build=$(readlink -f "$1")
shift
cd "$build"
# Usage: windows-configure.sh [rootdir [builddir]] -DWHATEVER=BLAH ...
if [ $# -ge 1 ] && [[ "$1" != -* ]]; then
root="$1"
shift
else
root="$(dirname $0)"/..
fi
root="$(readlink -f "$root")"
if [ $# -ge 1 ] && [[ "$1" != -* ]]; then
build="$(readlink -f "$1")"
shift
else
build="$root/build/win32"
echo "Setting up build in $build"
fi
mkdir -p "$build"
cmake \
-S "$root" -B "$build" \
-G 'Unix Makefiles' \
@ -31,4 +44,4 @@ cmake \
-DFORCE_SPDLOG_SUBMODULE=ON \
-DFORCE_NLOHMANN_SUBMODULE=ON \
-DWITH_LTO=OFF \
$@
"$@"