From f2bb61bce004163aacd1aad390f0eabfb5db9963 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 13 Mar 2023 23:35:10 +0100 Subject: Use FetchContent to handle dependencies --- .gitlab-ci.yml | 12 ++++++++++++ CMakeLists.txt | 9 +++------ contrib/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 53fc7bd..8337c56 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,12 @@ build-linux: artifacts: paths: - build-linux/ + cache: + key: + files: + - contrib/CMakeLists.txt + paths: + - build-linux/_deps build-windows: stage: build @@ -23,6 +29,12 @@ build-windows: artifacts: paths: - build-windows/ + cache: + key: + files: + - contrib/CMakeLists.txt + paths: + - build-windows/_deps test-linux: stage: test diff --git a/CMakeLists.txt b/CMakeLists.txt index e07cd2c..fee45df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,16 +8,13 @@ set(STEAM_APPID $ENV{STEAM_APPID} CACHE STRING "App ID for steam deployment") set(STEAM_DEPOTID_WINDOWS $ENV{STEAM_DEPOTID_WINDOWS} CACHE STRING "Steam Depot ID for Windows builds") set(STEAM_DEPOTID_LINUX $ENV{STEAM_DEPOTID_LINUX} CACHE STRING "Steam Depot ID for Linux builds") set(CMAKE_INSTALL_BINDIR .) -set(raylib_USE_STATIC_LIBS Yes) enable_testing() -find_package(EnTT 3 REQUIRED) -find_package(GTest 1 REQUIRED) -find_package(nlohmann_json 3 REQUIRED) -find_package(raylib 4 REQUIRED) include(AddResources) include(AddVersionFile) +include(FetchContent) +include(GoogleTest) +add_subdirectory(contrib) # Out of order to handle dependencies. add_subdirectory(campaign) -add_subdirectory(contrib) add_subdirectory(engine) add_subdirectory(kurator) add_subdirectory(sim) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index a61ecb5..97b0708 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1 +1,33 @@ +set(BUILD_SHARED_LIBS No) +set(BUILD_GMOCK No) +set(INSTALL_GTEST No) add_subdirectory(imgui) +FetchContent_Declare( + EnTT + GIT_REPOSITORY https://github.com/skypjack/entt.git + GIT_TAG v3.11.1 + GIT_SHALLOW Yes + OVERRIDE_FIND_PACKAGE +) +FetchContent_Declare( + GTest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.13.0 + GIT_SHALLOW Yes + OVERRIDE_FIND_PACKAGE +) +FetchContent_Declare( + nlohmann_json + GIT_REPOSITORY https://github.com/nlohmann/json.git + GIT_TAG v3.11.2 + GIT_SHALLOW Yes + OVERRIDE_FIND_PACKAGE +) +FetchContent_Declare( + raylib + GIT_REPOSITORY https://github.com/raysan5/raylib.git + GIT_TAG 4.2.0 + GIT_SHALLOW Yes + OVERRIDE_FIND_PACKAGE +) +FetchContent_MakeAvailable(EnTT GTest nlohmann_json raylib) -- cgit v1.1