-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (38 loc) · 1.08 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
37
38
39
40
41
42
43
44
45
46
47
#
# Preamble
#
cmake_minimum_required(VERSION 3.29)
set(CMAKE_EXPORT_COMPILE_COMMANDS
TRUE
CACHE BOOL "Export compile commands to build directory" FORCE)
#
# Dependencies
#
include(cmake/CPM.cmake)
cpmaddpackage("gh:pybind/[email protected]")
cpmaddpackage("gh:kokkos/mdspan#b885a2c60ad42f9e1aaa0d317a38105b950cbed0")
#
# Project setup
#
project(pybind11_numpy LANGUAGES CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#
# Build setup
#
find_package(OpenMP REQUIRED)
#
# PyBind11
#
# Numpy PyBind11 module
pybind11_add_module(pybind11_numpy
${CMAKE_CURRENT_SOURCE_DIR}/src/numpy_interface.cpp)
target_link_libraries(pybind11_numpy PUBLIC pybind11::headers)
target_link_libraries(pybind11_numpy PUBLIC OpenMP::OpenMP_CXX)
# Numpy -> std::mdspan module
pybind11_add_module(pybind11_mdspan
${CMAKE_CURRENT_SOURCE_DIR}/src/mdspan_interface.cpp)
target_link_libraries(pybind11_mdspan PUBLIC pybind11::headers mdspan)
target_link_libraries(pybind11_mdspan PUBLIC OpenMP::OpenMP_CXX)