From 44b2aeaba70f2609d73db27f81b13d63f317ca68 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 10 Feb 2023 22:41:18 -0700 Subject: [PATCH] Use vcpkg to find Catch2 --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ .gitmodules | 3 +++ CMakePresets.json | 1 + cmake/vcpkg | 1 + tests/CMakeLists.txt | 2 -- tests/FindCatch2.cmake | 12 ------------ vcpkg.json | 7 +++++++ 7 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 .gitmodules create mode 160000 cmake/vcpkg delete mode 100644 tests/FindCatch2.cmake create mode 100644 vcpkg.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4da39d1..b1c5643 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Vcpkg + run: ./cmake/vcpkg/bootstrap-vcpkg.sh - name: Configure run: cmake --preset dev ${{matrix.platform.flags}} -DBUILD_SHARED_LIBS=${{matrix.type.flags}} -DCMAKE_BUILD_TYPE=${{matrix.config.name}} -DCMAKE_VERBOSE_MAKEFILE=ON @@ -58,6 +63,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Vcpkg + run: ./cmake/vcpkg/bootstrap-vcpkg.sh - name: Configure run: cmake --preset coverage @@ -87,6 +97,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Vcpkg + run: ./cmake/vcpkg/bootstrap-vcpkg.sh - name: Configure run: cmake --preset clang-tools @@ -103,6 +118,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Vcpkg + run: ./cmake/vcpkg/bootstrap-vcpkg.sh - name: Configure run: cmake --preset clang-tools @@ -124,6 +144,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Vcpkg + run: ./cmake/vcpkg/bootstrap-vcpkg.sh - name: Configure run: cmake --preset ${{matrix.sanitizer.preset}} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8bd5c3b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = cmake/vcpkg + url = git@github.com:Microsoft/vcpkg.git diff --git a/CMakePresets.json b/CMakePresets.json index 10558a4..7a0aeb2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,6 +5,7 @@ "name": "dev", "binaryDir": "build", "installDir": "build/install", + "toolchainFile": "cmake/vcpkg/scripts/buildsystems/vcpkg.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "CMAKE_CXX_EXTENSIONS": "OFF", diff --git a/cmake/vcpkg b/cmake/vcpkg new file mode 160000 index 0000000..3508985 --- /dev/null +++ b/cmake/vcpkg @@ -0,0 +1 @@ +Subproject commit 3508985146f1b1d248c67ead13f8f54be5b4f5da diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3c30062..3d6a2cf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,3 @@ -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - find_package(Catch2 3.6.0 REQUIRED) include(Catch) diff --git a/tests/FindCatch2.cmake b/tests/FindCatch2.cmake deleted file mode 100644 index 03ff0f0..0000000 --- a/tests/FindCatch2.cmake +++ /dev/null @@ -1,12 +0,0 @@ -include(FetchContent) - -FetchContent_Declare(Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v${Catch2_FIND_VERSION} - GIT_SHALLOW ON) -FetchContent_MakeAvailable(Catch2) -set_target_properties(Catch2 PROPERTIES COMPILE_OPTIONS "" EXPORT_COMPILE_COMMANDS OFF) -set_target_properties(Catch2WithMain PROPERTIES EXPORT_COMPILE_COMMANDS OFF) -get_target_property(CATCH2_INCLUDE_DIRS Catch2 INTERFACE_INCLUDE_DIRECTORIES) -target_include_directories(Catch2 SYSTEM INTERFACE ${CATCH2_INCLUDE_DIRS}) -target_compile_features(Catch2 PRIVATE cxx_std_17) diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..02e66cb --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "argon", + "version-string": "0.12.0", + "dependencies": [ + "catch2" + ] +}