From 45cb0955613d58011983365dc5ea721c0c652328 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Sun, 29 Oct 2023 19:02:11 +0100 Subject: [PATCH] Allow usage of mirrors for all dependencies --- 3rdParty/assimp/CMakeLists.txt | 6 +++++- 3rdParty/eigen/CMakeLists.txt | 6 +++++- 3rdParty/ftxui/CMakeLists.txt | 6 +++++- 3rdParty/glfw/CMakeLists.txt | 8 ++++++-- 3rdParty/glm/CMakeLists.txt | 6 +++++- 3rdParty/imgui/CMakeLists.txt | 6 +++++- 3rdParty/libarchive/CMakeLists.txt | 21 +++++++++++++++++---- 3rdParty/libstud-uuid/CMakeLists.txt | 6 +++++- 3rdParty/magic-enum/CMakeLists.txt | 6 +++++- 3rdParty/opencv/CMakeLists.txt | 9 +++++++-- 3rdParty/pugixml/CMakeLists.txt | 8 ++++++-- 3rdParty/spdlog/CMakeLists.txt | 8 ++++++-- 3rdParty/stb/CMakeLists.txt | 6 +++++- 3rdParty/tracy/CMakeLists.txt | 6 +++++- 3rdParty/utfcpp/CMakeLists.txt | 8 ++++++-- 3rdParty/yaml-cpp/CMakeLists.txt | 6 +++++- cmake/VarsFromFile.cmake | 13 +++++++++++++ 17 files changed, 111 insertions(+), 24 deletions(-) create mode 100644 cmake/VarsFromFile.cmake diff --git a/3rdParty/assimp/CMakeLists.txt b/3rdParty/assimp/CMakeLists.txt index 265ec49..6dd4dc7 100644 --- a/3rdParty/assimp/CMakeLists.txt +++ b/3rdParty/assimp/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED ASSIMP_REPO) + set(ASSIMP_REPO https://github.com/assimp/assimp.git) +endif () + FetchContent_Declare( assimp EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/assimp/assimp.git + GIT_REPOSITORY ${ASSIMP_REPO} GIT_TAG v5.0.1 GIT_SHALLOW TRUE ) diff --git a/3rdParty/eigen/CMakeLists.txt b/3rdParty/eigen/CMakeLists.txt index 01a8634..3cb01cd 100644 --- a/3rdParty/eigen/CMakeLists.txt +++ b/3rdParty/eigen/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED EIGEN_REPO) + set(EIGEN_REPO https://gitlab.com/libeigen/eigen.git) +endif () + FetchContent_Declare( eigen EXCLUDE_FROM_ALL - GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git + GIT_REPOSITORY ${EIGEN_REPO} GIT_TAG master GIT_SHALLOW TRUE ) diff --git a/3rdParty/ftxui/CMakeLists.txt b/3rdParty/ftxui/CMakeLists.txt index ee641e6..8fc318f 100644 --- a/3rdParty/ftxui/CMakeLists.txt +++ b/3rdParty/ftxui/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED FTXUI_REPO) + set(FTXUI_REPO https://github.com/ArthurSonzogni/ftxui.git) +endif () + FetchContent_Declare( ftxui EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui.git + GIT_REPOSITORY ${FTXUI_REPO} GIT_TAG v5.0.0 GIT_SHALLOW TRUE ) diff --git a/3rdParty/glfw/CMakeLists.txt b/3rdParty/glfw/CMakeLists.txt index 5ede4a1..86171ee 100644 --- a/3rdParty/glfw/CMakeLists.txt +++ b/3rdParty/glfw/CMakeLists.txt @@ -1,10 +1,14 @@ include(FetchContent) +if(NOT DEFINED GLFW_REPO) + set(GLFW_REPO https://github.com/glfw/glfw.git) +endif () + FetchContent_Declare( glfw EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/glfw/glfw.git - GIT_TAG 3.3.2 + GIT_REPOSITORY ${GLFW_REPO} + GIT_TAG 3.3.8 GIT_SHALLOW TRUE ) set(GLFW_BUILD_EXAMPLES OFF) diff --git a/3rdParty/glm/CMakeLists.txt b/3rdParty/glm/CMakeLists.txt index f52ebbb..afe0807 100644 --- a/3rdParty/glm/CMakeLists.txt +++ b/3rdParty/glm/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED GLM_REPO) + set(GLM_REPO https://github.com/g-truc/glm.git) +endif () + FetchContent_Declare( glm EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/g-truc/glm.git + GIT_REPOSITORY ${GLM_REPO} GIT_TAG 0.9.9.8 GIT_SHALLOW TRUE ) diff --git a/3rdParty/imgui/CMakeLists.txt b/3rdParty/imgui/CMakeLists.txt index 2a6d4c0..1682ca7 100644 --- a/3rdParty/imgui/CMakeLists.txt +++ b/3rdParty/imgui/CMakeLists.txt @@ -1,11 +1,15 @@ include(FetchContent) +if(NOT DEFINED IMGUI_REPO) + set(IMGUI_REPO https://github.com/ocornut/imgui.git) +endif () + project(imgui_internal VERSION 1.0 LANGUAGES C CXX) set(IMGUI_SRC_DIR ${CMAKE_BINARY_DIR}/3rdParty/imgui/imgui-src) FetchContent_Populate(imgui - GIT_REPOSITORY https://github.com/ocornut/imgui.git + GIT_REPOSITORY ${IMGUI_REPO} GIT_SHALLOW TRUE GIT_TAG v1.90-docking SOURCE_DIR ${IMGUI_SRC_DIR} diff --git a/3rdParty/libarchive/CMakeLists.txt b/3rdParty/libarchive/CMakeLists.txt index 44b5810..3a71897 100644 --- a/3rdParty/libarchive/CMakeLists.txt +++ b/3rdParty/libarchive/CMakeLists.txt @@ -2,8 +2,21 @@ cmake_minimum_required(VERSION 3.16) project(build_libarchive) include(ExternalProject) +if(NOT DEFINED ZLIB_REPO) + set(ZLIB_REPO https://github.com/madler/zlib.git) +endif () +if(NOT DEFINED ZSTD_REPO) + set(ZSTD_REPO https://github.com/facebook/zstd) +endif () +if(NOT DEFINED LZ4_REPO) + set(LZ4_REPO https://github.com/lz4/lz4) +endif () +if(NOT DEFINED LIBARCHIVE_REPO) + set(LIBARCHIVE_REPO https://github.com/libarchive/libarchive.git) +endif () + ExternalProject_Add(zlib - GIT_REPOSITORY https://github.com/madler/zlib.git + GIT_REPOSITORY {ZLIB_REPO} GIT_TAG v1.2.11 GIT_SHALLOW TRUE SOURCE_DIR zlib @@ -17,7 +30,7 @@ ExternalProject_Add(zlib ) ExternalProject_Add(zstd - GIT_REPOSITORY https://github.com/facebook/zstd + GIT_REPOSITORY ${ZSTD_REPO} GIT_TAG v1.5.1 GIT_SHALLOW TRUE SOURCE_DIR zstd @@ -33,7 +46,7 @@ ExternalProject_Add(zstd ) ExternalProject_Add(lz4 - GIT_REPOSITORY https://github.com/lz4/lz4 + GIT_REPOSITORY ${LZ4_REPO} GIT_TAG v1.9.3 GIT_SHALLOW TRUE SOURCE_DIR lz4 @@ -50,7 +63,7 @@ ExternalProject_Add(lz4 ExternalProject_Add( libarchive DEPENDS zlib zstd lz4 - GIT_REPOSITORY https://github.com/libarchive/libarchive.git + GIT_REPOSITORY ${LIBARCHIVE_REPO} GIT_TAG v3.7.0 GIT_SHALLOW TRUE SOURCE_DIR libarchive diff --git a/3rdParty/libstud-uuid/CMakeLists.txt b/3rdParty/libstud-uuid/CMakeLists.txt index e3396b9..1e9aae3 100644 --- a/3rdParty/libstud-uuid/CMakeLists.txt +++ b/3rdParty/libstud-uuid/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED LIBSTUD_REPO) + set(LIBSTUD_REPO https://github.com/GeorgH93/libstud-uuid.git) +endif () + FetchContent_Declare( libstud-uuid EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/GeorgH93/libstud-uuid.git + GIT_REPOSITORY ${LIBSTUD_REPO} GIT_SHALLOW TRUE ) diff --git a/3rdParty/magic-enum/CMakeLists.txt b/3rdParty/magic-enum/CMakeLists.txt index f63ecc8..8345cf8 100644 --- a/3rdParty/magic-enum/CMakeLists.txt +++ b/3rdParty/magic-enum/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED MAGICENUM_REPO) + set(MAGICENUM_REPO https://github.com/Neargye/magic_enum.git) +endif () + FetchContent_Declare( magic_enum EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/Neargye/magic_enum.git + GIT_REPOSITORY ${MAGICENUM_REPO} GIT_TAG v0.9.3 GIT_SHALLOW TRUE ) diff --git a/3rdParty/opencv/CMakeLists.txt b/3rdParty/opencv/CMakeLists.txt index 1713ee7..90983db 100644 --- a/3rdParty/opencv/CMakeLists.txt +++ b/3rdParty/opencv/CMakeLists.txt @@ -1,10 +1,15 @@ Find_Package(OpenCV) + +if(NOT DEFINED OPENCV_REPO) + set(OPENCV_REPO https://github.com/opencv/opencv.git) +endif () + if (NOT OpenCV_FOUND) FetchContent_Declare( opencv EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/opencv/opencv.git - GIT_TAG v4.5.0 + GIT_REPOSITORY ${OPENCV_REPO} + GIT_TAG v4.8.1 GIT_SHALLOW TRUE ) FetchContent_MakeAvailable(opencv) diff --git a/3rdParty/pugixml/CMakeLists.txt b/3rdParty/pugixml/CMakeLists.txt index 245a0ef..517122c 100644 --- a/3rdParty/pugixml/CMakeLists.txt +++ b/3rdParty/pugixml/CMakeLists.txt @@ -1,10 +1,14 @@ include(FetchContent) +if(NOT DEFINED PUGIXML_REPO) + set(PUGIXML_REPO https://github.com/zeux/pugixml.git) +endif () + FetchContent_Declare( pugixml EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/zeux/pugixml.git - GIT_TAG v1.11.4 + GIT_REPOSITORY ${PUGIXML_REPO} + GIT_TAG v1.14 GIT_SHALLOW TRUE ) set(BUILD_SHARED_LIBS OFF) diff --git a/3rdParty/spdlog/CMakeLists.txt b/3rdParty/spdlog/CMakeLists.txt index 8a6819f..ce75979 100644 --- a/3rdParty/spdlog/CMakeLists.txt +++ b/3rdParty/spdlog/CMakeLists.txt @@ -1,10 +1,14 @@ include(FetchContent) +if(NOT DEFINED SPDLOG_REPO) + set(SPDLOG_REPO https://github.com/gabime/spdlog.git) +endif () + FetchContent_Declare( spdlog EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/gabime/spdlog.git - GIT_TAG v1.8.1 + GIT_REPOSITORY ${SPDLOG_REPO} + GIT_TAG v1.10.0 GIT_SHALLOW TRUE ) FetchContent_MakeAvailable(spdlog) diff --git a/3rdParty/stb/CMakeLists.txt b/3rdParty/stb/CMakeLists.txt index 3fa2144..4b3b421 100644 --- a/3rdParty/stb/CMakeLists.txt +++ b/3rdParty/stb/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED STB_REPO) + set(STB_REPO https://github.com/nothings/stb.git) +endif () + FetchContent_Declare( stb EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/nothings/stb.git + GIT_REPOSITORY ${STB_REPO} GIT_SHALLOW TRUE ) FetchContent_MakeAvailable(stb) diff --git a/3rdParty/tracy/CMakeLists.txt b/3rdParty/tracy/CMakeLists.txt index c1c906f..e1c43ba 100644 --- a/3rdParty/tracy/CMakeLists.txt +++ b/3rdParty/tracy/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED TRACY_REPO) + set(TRACY_REPO https://github.com/wolfpld/tracy.git) +endif () + FetchContent_Declare ( tracy EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/wolfpld/tracy.git + GIT_REPOSITORY ${TRACY_REPO} GIT_TAG master GIT_SHALLOW TRUE GIT_PROGRESS TRUE diff --git a/3rdParty/utfcpp/CMakeLists.txt b/3rdParty/utfcpp/CMakeLists.txt index b85a016..8f5b003 100644 --- a/3rdParty/utfcpp/CMakeLists.txt +++ b/3rdParty/utfcpp/CMakeLists.txt @@ -1,10 +1,14 @@ include(FetchContent) +if(NOT DEFINED UTFCPP_REPO) + set(UTFCPP_REPO https://github.com/nemtrif/utfcpp.git) +endif () + FetchContent_Declare( utfcpp EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/nemtrif/utfcpp.git - GIT_TAG v3.1.2 + GIT_REPOSITORY ${UTFCPP_REPO} + GIT_TAG v4.0.1 GIT_SHALLOW TRUE ) set(UTF8_TESTS OFF) diff --git a/3rdParty/yaml-cpp/CMakeLists.txt b/3rdParty/yaml-cpp/CMakeLists.txt index 9aa7d5a..2fdffde 100644 --- a/3rdParty/yaml-cpp/CMakeLists.txt +++ b/3rdParty/yaml-cpp/CMakeLists.txt @@ -1,9 +1,13 @@ include(FetchContent) +if(NOT DEFINED YAMLCPP_REPO) + set(YAMLCPP_REPO https://github.com/jbeder/yaml-cpp.git) +endif () + FetchContent_Declare( yaml-cpp EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git + GIT_REPOSITORY ${YAMLCPP_REPO} GIT_TAG 0.8.0 GIT_SHALLOW TRUE ) diff --git a/cmake/VarsFromFile.cmake b/cmake/VarsFromFile.cmake new file mode 100644 index 0000000..e41f577 --- /dev/null +++ b/cmake/VarsFromFile.cmake @@ -0,0 +1,13 @@ +function(VarsFromFile filename) + file(STRINGS ${filename} ConfigContents) + foreach(NameAndValue ${ConfigContents}) + # Strip leading spaces + string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue}) + # Find variable name + string(REGEX MATCH "^[^=]+" Name ${NameAndValue}) + # Find the value + string(REPLACE "${Name}=" "" Value ${NameAndValue}) + # Set the variable + set(${Name} "${Value}" PARENT_SCOPE) + endforeach() +endfunction(VarsFromFile) \ No newline at end of file