From 49b97f47ccc5e3ca91b959d98726f73c65a81ab1 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 1 Sep 2022 15:15:34 -0300 Subject: [PATCH] Make windows-configure.sh runnable without root/build For when you want to set up a windows build dir, without doing the build yet. --- contrib/windows-configure.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/contrib/windows-configure.sh b/contrib/windows-configure.sh index 49668c7e7..f41ef3af8 100755 --- a/contrib/windows-configure.sh +++ b/contrib/windows-configure.sh @@ -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 \ - $@ + "$@"