From 77e7acb5ed8ce88c4a2052ada9bc356617dafef4 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 6 Sep 2022 00:03:35 +0530 Subject: [PATCH 1/3] depends: move amalgamated catch2 to match include structure --- {contrib/catch => depends/catch2/include/catch2}/catch.hpp | 0 src/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {contrib/catch => depends/catch2/include/catch2}/catch.hpp (100%) diff --git a/contrib/catch/catch.hpp b/depends/catch2/include/catch2/catch.hpp similarity index 100% rename from contrib/catch/catch.hpp rename to depends/catch2/include/catch2/catch.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index df56c5733..53cca56af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,7 +51,7 @@ if(BUILD_BLS_TESTS) list(TRANSFORM CATCH2_INCLUDE_DIRS APPEND /catch2) target_include_directories(runtest PRIVATE ${CATCH2_INCLUDE_DIRS}) else() - target_include_directories(runtest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/catch) + target_include_directories(runtest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../depends/catch2/include/catch2) endif() target_link_libraries(runtest PRIVATE bls-dash) endif() From 45f02ecda894f9fdb3b9863de7291a9aa52b6bd0 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sun, 4 Sep 2022 23:58:57 +0530 Subject: [PATCH 2/3] build: don't attempt detection of local catch2, use vendor copy --- depends/catch2/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 19 +++++-------------- src/test.cpp | 3 ++- 3 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 depends/catch2/CMakeLists.txt diff --git a/depends/catch2/CMakeLists.txt b/depends/catch2/CMakeLists.txt new file mode 100644 index 000000000..8fdfcf018 --- /dev/null +++ b/depends/catch2/CMakeLists.txt @@ -0,0 +1,33 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.14.0 FATAL_ERROR) + +set(PROJECT_NAME "catch2") + +project( + ${PROJECT_NAME} + VERSION 2.13 + LANGUAGES CXX +) + + +set( + ${PROJECT_NAME}_HEADERS + catch2/catch.hpp +) + +list( + TRANSFORM ${PROJECT_NAME}_HEADERS + PREPEND "${CMAKE_CURRENT_LIST_DIR}/include/" +) + +add_library( + ${PROJECT_NAME} + INTERFACE + "${${PROJECT_NAME}_HEADERS}" +) + +target_include_directories( + ${PROJECT_NAME} + INTERFACE + "$" + "$" +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 53cca56af..09744ca68 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,21 +39,12 @@ install(FILES ${HEADERS} DESTINATION include/bls-dash) install(FILES $ DESTINATION lib) if(BUILD_BLS_TESTS) + include(${CMAKE_CURRENT_SOURCE_DIR}/../depends/catch2/CMakeLists.txt) + add_executable(runtest test.cpp) - INCLUDE(FindPkgConfig) - pkg_check_modules(CATCH2 catch2) - if (CATCH2_FOUND) - # Adding "catch2" subdir to include dirs because "catch.hpp" is included - # instead of "catch2/catch.hpp" - if (NOT CATCH2_INCLUDE_DIRS) - set(CATCH2_INCLUDE_DIRS ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) - endif() - list(TRANSFORM CATCH2_INCLUDE_DIRS APPEND /catch2) - target_include_directories(runtest PRIVATE ${CATCH2_INCLUDE_DIRS}) - else() - target_include_directories(runtest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../depends/catch2/include/catch2) - endif() - target_link_libraries(runtest PRIVATE bls-dash) + target_link_libraries(runtest + PRIVATE bls-dash + PRIVATE catch2) endif() if(BUILD_BLS_BENCHMARKS) diff --git a/src/test.cpp b/src/test.cpp index 1ec7eef81..5875f22ff 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -17,7 +17,8 @@ #include #include "bls.hpp" -#include "catch.hpp" +#include + extern "C" { #include "relic.h" } From fc96a8af2e8ac3b9ba815c9951085fee639eb6bf Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Wed, 7 Sep 2022 00:37:49 +0530 Subject: [PATCH 3/3] build: fix VS2022 compilation by bumping pybind11 to 2.9.1 --- python-bindings/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-bindings/CMakeLists.txt b/python-bindings/CMakeLists.txt index 6bba03b40..e527afaa4 100644 --- a/python-bindings/CMakeLists.txt +++ b/python-bindings/CMakeLists.txt @@ -2,7 +2,7 @@ FetchContent_Declare( pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git - GIT_TAG v2.6.2 + GIT_TAG v2.9.1 ) FetchContent_MakeAvailable(pybind11 relic)