Cache library deps on Windows

Besides the immediate performance improvement, reducing
the frequency of downloads should make spurious
failures (network, rate-limiting...) less bothersome.
This commit is contained in:
ISSOtm
2026-03-19 02:51:51 +01:00
committed by Eldred Habert
parent 91fdfcd179
commit 6b0658fb59
7 changed files with 70 additions and 53 deletions

View File

@@ -140,26 +140,13 @@ endif()
## Dependencies.
include(FetchContent)
FetchContent_Declare(PNG
URL https://download.sourceforge.net/libpng/libpng-1.6.55.tar.xz
URL_HASH SHA256=d925722864837ad5ae2a82070d4b2e0603dc72af44bd457c3962298258b8e82d
FIND_PACKAGE_ARGS 1.5.4)
FetchContent_Declare(ZLIB
URL https://www.zlib.net/zlib-1.3.2.tar.xz
URL_HASH SHA256=d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3
# libpng documents requiring "zlib 1.0.4 or later (1.2.13 or later recommended for performance and security reasons)".
# We thus enforce 1.0.4, but note that the libpng source code mentions that "it may work with versions as old as zlib 0.95".
FIND_PACKAGE_ARGS 1.0.4)
set(ZLIB_BUILD_SHARED ON CACHE INTERNAL "")
set(ZLIB_BUILD_STATIC OFF CACHE INTERNAL "")
include(cmake/deps.cmake)
FetchContent_MakeAvailable(ZLIB)
if(NOT DEFINED ZLIB_INCLUDE_DIRS)
set(ZLIB_INCLUDE_DIRS "${zlib_BINARY_DIR};${zlib_SOURCE_DIR}") # libpng's `genout` script relies on this variable to be set.
endif()
set(PNG_TESTS OFF CACHE INTERNAL "") # We do not care for these two (and they can even cause compile errors!)
set(PNG_TOOLS OFF CACHE INTERNAL "")
set(PNG_SHARED ON CACHE INTERNAL "") # Upstream seems to favour the dynamic lib over the static one?
set(PNG_STATIC OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(PNG)
if(NOT TARGET PNG::PNG)
if(PNG_SHARED)