From 730df73cb356f81748f46ab7764fe8bee43dbbfc Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Sat, 13 Nov 2021 17:31:27 -0800 Subject: [PATCH] MoltenVK: Don't run fetchDependencies unnecessarily --- Externals/MoltenVK/CMakeLists.txt | 2 +- Externals/MoltenVK/configure.sh | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 Externals/MoltenVK/configure.sh 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 /fetchDependencies --macos + CONFIGURE_COMMAND ${CMAKE_CURRENT_LIST_DIR}/configure.sh ${MOLTENVK_VERSION} BUILD_COMMAND make -C 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 +# + +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