Skip to content

Commit

Permalink
build: bump pybind, stop using FindPkgConfig for Catch2 (dashpay#41)
Browse files Browse the repository at this point in the history
* depends: move amalgamated catch2 to match include structure

* build: don't attempt detection of local catch2, use vendor copy

* build: fix VS2022 compilation by bumping pybind11 to 2.9.1
  • Loading branch information
kwvg authored Sep 20, 2022
1 parent 1bdef34 commit 610307c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 16 deletions.
33 changes: 33 additions & 0 deletions depends/catch2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
File renamed without changes.
2 changes: 1 addition & 1 deletion python-bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
19 changes: 5 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,12 @@ install(FILES ${HEADERS} DESTINATION include/bls-dash)
install(FILES $<TARGET_FILE:bls-dash> 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}/../contrib/catch)
endif()
target_link_libraries(runtest PRIVATE bls-dash)
target_link_libraries(runtest
PRIVATE bls-dash
PRIVATE catch2)
endif()

if(BUILD_BLS_BENCHMARKS)
Expand Down
3 changes: 2 additions & 1 deletion src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#include <thread>

#include "bls.hpp"
#include "catch.hpp"
#include <catch2/catch.hpp>

extern "C" {
#include "relic.h"
}
Expand Down

0 comments on commit 610307c

Please sign in to comment.