From 0762044f4e15e7a3d8bde5ef045fec96db3fc4bf Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:36:34 +0200 Subject: [PATCH] Replace git-clone with HTTP get of an archive git-clone fetches the entire history of a repository. There is a GIT_SHALLOW option in CMake's ExternalProject, but reportedly it can only be used to get "named" commits (tags, branches). ExternalProject provides an alternative way of fetching this, via URL combined with github's ability to generate a zip archive of any arbitrary commit hash. DOWNLOAD_EXTRACT_TIMESTAMP must be set to avoid warnings from CMake. Set to True, the timestamps of the extracted files will match those in the archive. I didn't add URL_HASH support mainly because this is more or less a PoC PR, but if you choose to go this route, it should be added at some point. For now I can provide md5 and sha256 hashes for your convenience. --- cmake/FetchDependencies.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/FetchDependencies.cmake b/cmake/FetchDependencies.cmake index 68a196e4..ee8e589b 100644 --- a/cmake/FetchDependencies.cmake +++ b/cmake/FetchDependencies.cmake @@ -30,8 +30,8 @@ function(fetch_dependency name default_url default_tag) FetchContent_Declare( ${name} - GIT_REPOSITORY "${${VAR_NAME}_REPOSITORY_URL}" - GIT_TAG "${${VAR_NAME}_REPOSITORY_TAG}" + URL "${${VAR_NAME}_REPOSITORY_URL}/archive/${${VAR_NAME}_REPOSITORY_TAG}.zip" + DOWNLOAD_EXTRACT_TIMESTAMP true ) FetchContent_GetProperties(${name}) @@ -39,7 +39,7 @@ endfunction() fetch_dependency(melonDS "https://github.com/melonDS-emu/melonDS" "824eb37") fetch_dependency(libretro-common "https://github.com/JesseTG/libretro-common" "8e2b884") -fetch_dependency("embed-binaries" "https://github.com/andoalon/embed-binaries.git" "21f28ca") +fetch_dependency("embed-binaries" "https://github.com/andoalon/embed-binaries" "21f28ca") fetch_dependency(glm "https://github.com/g-truc/glm" "33b4a62") fetch_dependency(libslirp "https://github.com/JesseTG/libslirp-mirror" "e61dbd4") fetch_dependency(pntr "https://github.com/robloach/pntr" "650237a")