Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump pybind, stop using FindPkgConfig for Catch2 #41

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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