-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
36 lines (30 loc) · 1.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
CMAKE_MINIMUM_REQUIRED(VERSION 3.10.2)
PROJECT(simple_cpp_python)
ENABLE_LANGUAGE(CXX)
SET(CMAKE_CXX_STANDARD 17) # C++-17 required for high-level code parallelization
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
FIND_PACKAGE(TBB REQUIRED) # TBB required by GCC's implementation of C++-17
FIND_PACKAGE(pybind11 REQUIRED)
FIND_PACKAGE(Catch2 REQUIRED)
FIND_PACKAGE(Backward)
PYBIND11_ADD_MODULE(__simple_cpp_python package.cc)
TARGET_LINK_LIBRARIES(__simple_cpp_python PRIVATE ${TBB_IMPORTED_TARGETS})
IF (TARGET Backward::Backward)
SET (BACKWARD_LIBS Backward::Backward)
SET (BACKWARD_INCLUDES ${BACKWARD_INCLUDE_DIRS})
SET (BACKWARD_DEFINITIONS ${BACKWARD_DEFITIONS} -DHAVE_BACKWARD)
ELSE ()
SET (BACKWARD_LIBS "")
SET (BACKWARD_INCLUDES "")
SET (BACKWARD_DEFINITIONS "")
ENDIF ()
INCLUDE(CTest)
INCLUDE(Catch)
ADD_EXECUTABLE(test-cpp-inner-loop tests.cc)
TARGET_INCLUDE_DIRECTORIES(test-cpp-inner-loop PRIVATE
${PYTHON_INCLUDE_DIRS} ${BACKWARD_INCLUDES})
TARGET_LINK_LIBRARIES(test-cpp-inner-loop PRIVATE
Catch2::Catch2 ${TBB_IMPORTED_TARGETS}
${PYTHON_LIBRARIES} ${BACKWARD_LIBS})
TARGET_COMPILE_DEFINITIONS(test-cpp-inner-loop PRIVATE ${BACKWARD_DEFINITIONS})
CATCH_DISCOVER_TESTS(test-cpp-inner-loop)