summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOatmealDome <julian@oatmealdome.me>2021-11-13 17:31:27 -0800
committerOatmealDome <julian@oatmealdome.me>2021-11-24 16:56:33 -0500
commit730df73cb356f81748f46ab7764fe8bee43dbbfc (patch)
tree138686416c0551260b7d903cd6ff9128796ed974
parentf1f08536591ed869a2f90bab2a22d6301fb44c15 (diff)
MoltenVK: Don't run fetchDependencies unnecessarily
-rw-r--r--Externals/MoltenVK/CMakeLists.txt2
-rwxr-xr-xExternals/MoltenVK/configure.sh20
2 files changed, 21 insertions, 1 deletions
diff --git a/Externals/MoltenVK/CMakeLists.txt b/Externals/MoltenVK/CMakeLists.txt
index 70929b882c..5202e95970 100644
--- a/Externals/MoltenVK/CMakeLists.txt
+++ b/Externals/MoltenVK/CMakeLists.txt
@@ -6,7 +6,7 @@ ExternalProject_Add(MoltenVK
GIT_REPOSITORY https://github.com/KhronosGroup/MoltenVK.git
GIT_TAG ${MOLTENVK_VERSION}
- CONFIGURE_COMMAND <SOURCE_DIR>/fetchDependencies --macos
+ CONFIGURE_COMMAND ${CMAKE_CURRENT_LIST_DIR}/configure.sh <LOG_DIR> <SOURCE_DIR> ${MOLTENVK_VERSION}
BUILD_COMMAND make -C <SOURCE_DIR> macos
BUILD_IN_SOURCE ON
diff --git a/Externals/MoltenVK/configure.sh b/Externals/MoltenVK/configure.sh
new file mode 100755
index 0000000000..5049026117
--- /dev/null
+++ b/Externals/MoltenVK/configure.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# To lower build times, we avoid running the fetchDependencies script if the MoltenVK
+# version didn't change. The last-built MoltenVK version is stored inside a file in
+# the timestamp directory. If the file doesn't exist or the file contains a different
+# MoltenVK version, fetchDependencies is ran.
+#
+# Usage: configure.sh <timestamp directory> <source directory> <MoltenVK version>
+#
+
+set -e
+
+VERSION_PATH="$1/MoltenVK-last-version.txt"
+CURRENT_VERSION="$3"
+LAST_VERSION=$(cat "$VERSION_PATH" || true)
+
+if ! [ "$LAST_VERSION" = "$3" ]; then
+ $2/fetchDependencies --macos
+ echo $CURRENT_VERSION > $VERSION_PATH
+fi