Skip to content

Commit d76343c

Browse files
committed
[ciwi] Play nice with dep source caching
1 parent 20e68d6 commit d76343c

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

CMakeLists.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,52 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.txt "${VMPC_VERSION}")
5656

5757
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
5858

59+
function(resolve_fetchcontent_source_dir dep_key default_path out_var)
60+
string(TOUPPER "${dep_key}" dep_upper)
61+
set(dep_var "FETCHCONTENT_SOURCE_DIR_${dep_upper}")
62+
if(DEFINED ${dep_var} AND NOT "${${dep_var}}" STREQUAL "")
63+
set(dep_source_dir "${${dep_var}}")
64+
else()
65+
set(dep_source_dir "${default_path}")
66+
endif()
67+
set(${out_var} "${dep_source_dir}" PARENT_SCOPE)
68+
endfunction()
69+
70+
resolve_fetchcontent_source_dir("JUCE" "${CMAKE_SOURCE_DIR}/editables/JUCE" VMPC_JUCE_SOURCE_DIR)
71+
resolve_fetchcontent_source_dir("MELATONIN_BLUR" "${CMAKE_CURRENT_BINARY_DIR}/melatonin_blur" VMPC_MELATONIN_BLUR_SOURCE_DIR)
72+
resolve_fetchcontent_source_dir("JUCE_RAW_KEYBOARD_INPUT_MODULE" "${CMAKE_SOURCE_DIR}/editables/juce-raw-keyboard-input-module" VMPC_RAW_KBD_SOURCE_DIR)
73+
resolve_fetchcontent_source_dir("JSON" "${CMAKE_CURRENT_BINARY_DIR}/json-src" VMPC_JSON_SOURCE_DIR)
74+
resolve_fetchcontent_source_dir("MPC" "${CMAKE_SOURCE_DIR}/editables/mpc" VMPC_MPC_SOURCE_DIR)
75+
resolve_fetchcontent_source_dir("MINIZ" "${CMAKE_SOURCE_DIR}/deps/miniz" VMPC_MINIZ_SOURCE_DIR)
76+
5977
FetchContent_Declare(JUCE
6078
GIT_REPOSITORY https://github.com/izzyreal/JUCE.git
6179
GIT_TAG 7.0.9-vmpc
62-
SOURCE_DIR ${CMAKE_SOURCE_DIR}/editables/JUCE
80+
SOURCE_DIR ${VMPC_JUCE_SOURCE_DIR}
6381
GIT_SHALLOW ON
6482
)
6583

6684
FetchContent_Declare(melatonin_blur
6785
GIT_REPOSITORY https://github.com/sudara/melatonin_blur.git
6886
GIT_TAG origin/main
69-
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/melatonin_blur)
87+
SOURCE_DIR ${VMPC_MELATONIN_BLUR_SOURCE_DIR})
7088

7189
FetchContent_Declare(juce-raw-keyboard-input-module
7290
GIT_REPOSITORY https://github.com/izzyreal/juce-raw-keyboard-input-module.git
7391
GIT_TAG external-focus-provider
74-
SOURCE_DIR ${CMAKE_SOURCE_DIR}/editables/juce-raw-keyboard-input-module
92+
SOURCE_DIR ${VMPC_RAW_KBD_SOURCE_DIR}
7593
)
7694

7795
FetchContent_Declare(json
7896
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
97+
SOURCE_DIR ${VMPC_JSON_SOURCE_DIR}
7998
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
8099
)
81100

82101
FetchContent_Declare(mpc
83102
GIT_REPOSITORY https://github.com/izzyreal/mpc.git
84103
GIT_TAG master
85-
SOURCE_DIR ${CMAKE_SOURCE_DIR}/editables/mpc
104+
SOURCE_DIR ${VMPC_MPC_SOURCE_DIR}
86105
)
87106

88107
set(BUILD_EXAMPLES OFF)
@@ -94,7 +113,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
94113
FetchContent_Declare(miniz
95114
GIT_REPOSITORY https://github.com/richgel999/miniz
96115
GIT_TAG master
97-
SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps/miniz
116+
SOURCE_DIR ${VMPC_MINIZ_SOURCE_DIR}
98117
GIT_SHALLOW ON
99118
)
100119
message(STATUS "Downloading miniz...")

0 commit comments

Comments
 (0)