From 5b67d20c9107f6cbd20c1baa3097a3c8d5f9ad3b Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Sun, 1 Dec 2024 11:06:05 -0800 Subject: [PATCH] tweaked fetch content code - see https://discourse.cmake.org/t/prevent-fetchcontent-makeavailable for details --- README.md | 2 +- RELEASE.md | 4 ++++ blank-plugin/fetch_jamba.cmake | 20 +++++++++----------- cmake/JambaFetchContent.cmake | 31 +++++++++++++++++-------------- cmake/JambaFetchVST3.cmake | 2 +- jamba.cmake | 2 +- 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9a2311e..1404a8a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Check the [Quickstart](https://jamba.dev/quickstart/) section to getting started Latest Release -------------- -7.1.2 | 2024-11-26 | VST SDK 3.7.12+ +7.1.3 | 2024-12-01 | VST SDK 3.7.12+ [Release notes (local)](RELEASE.md) diff --git a/RELEASE.md b/RELEASE.md index ef3475a..0d0cd86 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,10 @@ Release Notes {#release-notes} Check the [Requirements](https://jamba.dev/requirements/) documentation for information about which VST3 SDK Jamba supports and how to get it. +## [7.1.3 | 2024-12-01](https://github.com/pongasoft/jamba/tree/v7.1.3) + +* Use `FetchContent_Populate`/`FetchContent_MakeAvailable` with `SOURCE_SUBDIR` option (see [CMake discussion](https://discourse.cmake.org/t/prevent-fetchcontent-makeavailable-to-execute-cmakelists-txt)) + ## [7.1.2 | 2024-11-26](https://github.com/pongasoft/jamba/tree/v7.1.2) * Fixes issues with some DAWs on Windows when using the bundle format diff --git a/blank-plugin/fetch_jamba.cmake b/blank-plugin/fetch_jamba.cmake index a386c7b..e4ba452 100644 --- a/blank-plugin/fetch_jamba.cmake +++ b/blank-plugin/fetch_jamba.cmake @@ -9,35 +9,33 @@ set(JAMBA_DOWNLOAD_URL_HASH "[-jamba_download_url_hash-]" CACHE STRING "Jamba do if(JAMBA_ROOT_DIR) message(STATUS "Using jamba from local ${JAMBA_ROOT_DIR}") - FetchContent_Populate(jamba - QUIET - SOURCE_DIR "${JAMBA_ROOT_DIR}" - BINARY_DIR "${CMAKE_BINARY_DIR}/jamba-build" + FetchContent_Declare(jamba + SOURCE_DIR "${JAMBA_ROOT_DIR}" + SOURCE_SUBDIR "do_not_make_available" # invalid folder to not execute jamba/CMakeLists.txt ) else() if(JAMBA_DOWNLOAD_URL STREQUAL "" OR JAMBA_DOWNLOAD_URL_HASH STREQUAL "") message(STATUS "Fetching jamba from ${JAMBA_GIT_REPO}/tree/${JAMBA_GIT_TAG}") - FetchContent_Populate(jamba - QUIET + FetchContent_Declare(jamba GIT_REPOSITORY ${JAMBA_GIT_REPO} GIT_TAG ${JAMBA_GIT_TAG} GIT_CONFIG advice.detachedHead=false GIT_SHALLOW true SOURCE_DIR "${CMAKE_BINARY_DIR}/jamba" - BINARY_DIR "${CMAKE_BINARY_DIR}/jamba-build" + SOURCE_SUBDIR "do_not_make_available" ) else() message(STATUS "Fetching jamba from ${JAMBA_DOWNLOAD_URL}") - FetchContent_Populate(jamba - QUIET + FetchContent_Declare(jamba URL "${JAMBA_DOWNLOAD_URL}" URL_HASH "${JAMBA_DOWNLOAD_URL_HASH}" DOWNLOAD_EXTRACT_TIMESTAMP true SOURCE_DIR "${CMAKE_BINARY_DIR}/jamba" - BINARY_DIR "${CMAKE_BINARY_DIR}/jamba-build" + SOURCE_SUBDIR "do_not_make_available" ) endif() endif() -set(JAMBA_ROOT_DIR ${jamba_SOURCE_DIR}) +FetchContent_MakeAvailable(jamba) +set(JAMBA_ROOT_DIR ${jamba_SOURCE_DIR}) diff --git a/cmake/JambaFetchContent.cmake b/cmake/JambaFetchContent.cmake index b56a3cd..8713d8c 100644 --- a/cmake/JambaFetchContent.cmake +++ b/cmake/JambaFetchContent.cmake @@ -18,6 +18,7 @@ cmake_minimum_required(VERSION 3.19) include(FetchContent) +# Note that this function only fetches the content and does NOT make it available function(jamba_fetch_content) set(oneValueArgs NAME GIT_REPO GIT_TAG DOWNLOAD_URL DOWNLOAD_URL_HASH ROOT_DIR) @@ -54,36 +55,38 @@ function(jamba_fetch_content) if(ARG_ROOT_DIR) message(STATUS "Using ${ARG_NAME} from local ${ARG_ROOT_DIR}") - FetchContent_Populate(${ARG_NAME} - QUIET - SOURCE_DIR "${ARG_ROOT_DIR}" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + FetchContent_Declare(${ARG_NAME} + SOURCE_DIR "${ARG_ROOT_DIR}" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + SOURCE_SUBDIR "do_not_make_available" # invalid folder to not execute CMakeLists.txt ) else() if(ARG_DOWNLOAD_URL) message(STATUS "Fetching ${ARG_NAME} from ${ARG_DOWNLOAD_URL}") - FetchContent_Populate( ${ARG_NAME} - QUIET + FetchContent_Declare( ${ARG_NAME} URL "${ARG_DOWNLOAD_URL}" URL_HASH "${ARG_DOWNLOAD_URL_HASH}" SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" DOWNLOAD_EXTRACT_TIMESTAMP true + SOURCE_SUBDIR "do_not_make_available" ) else() message(STATUS "Fetching ${ARG_NAME} from ${ARG_GIT_REPO}/tree/${ARG_GIT_TAG}") - FetchContent_Populate(${ARG_NAME} - QUIET - GIT_REPOSITORY ${ARG_GIT_REPO} - GIT_TAG ${ARG_GIT_TAG} - GIT_CONFIG advice.detachedHead=false - GIT_SHALLOW true - SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + FetchContent_Declare(${ARG_NAME} + GIT_REPOSITORY ${ARG_GIT_REPO} + GIT_TAG ${ARG_GIT_TAG} + GIT_CONFIG advice.detachedHead=false + GIT_SHALLOW true + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + SOURCE_SUBDIR "do_not_make_available" ) endif() endif() + FetchContent_MakeAvailable(${ARG_NAME}) + set(${ARG_NAME}_ROOT_DIR "${${ARG_NAME}_SOURCE_DIR}" PARENT_SCOPE) set(${ARG_NAME}_SOURCE_DIR "${${ARG_NAME}_SOURCE_DIR}" PARENT_SCOPE) set(${ARG_NAME}_BINARY_DIR "${${ARG_NAME}_BINARY_DIR}" PARENT_SCOPE) diff --git a/cmake/JambaFetchVST3.cmake b/cmake/JambaFetchVST3.cmake index ff365b2..14a12c2 100644 --- a/cmake/JambaFetchVST3.cmake +++ b/cmake/JambaFetchVST3.cmake @@ -84,7 +84,7 @@ if(EXISTS "${VST3_SDK_ROOT}/${VSTSDK3_KNOWN_FILE}") set(vst3sdk_SOURCE_DIR "${VST3_SDK_ROOT}") endif() elseif(JAMBA_DOWNLOAD_VSTSDK) - jamba_fetch_content(NAME vst3sdk GIT_REPO "${JAMBA_VST3SDK_GIT_REPO}" GIT_TAG "${JAMBA_VST3SDK_GIT_TAG}") +jamba_fetch_content(NAME vst3sdk GIT_REPO "${JAMBA_VST3SDK_GIT_REPO}" GIT_TAG "${JAMBA_VST3SDK_GIT_TAG}") if(EXISTS "${JAMBA_VST3SDK_PATCH_DIR}") internal_jamba_patch_vst3sdk("${JAMBA_VST3SDK_PATCH_DIR}" "${vst3sdk_SOURCE_DIR}") else() diff --git a/jamba.cmake b/jamba.cmake index 194531e..d2b2be4 100644 --- a/jamba.cmake +++ b/jamba.cmake @@ -46,7 +46,7 @@ endif() #------------------------------------------------------------------------ set(JAMBA_MAJOR_VERSION 7) set(JAMBA_MINOR_VERSION 1) -set(JAMBA_PATCH_VERSION 2) +set(JAMBA_PATCH_VERSION 3) execute_process(COMMAND git describe --long --dirty --abbrev=10 --tags RESULT_VARIABLE result OUTPUT_VARIABLE JAMBA_GIT_VERSION