File: CMakeLists.txt

package info (click to toggle)
python-cmake-build-extension 0.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 484 kB
  • sloc: python: 504; cpp: 70; sh: 13; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 753 bytes parent folder | download
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
find_package(pybind11 REQUIRED)
find_package(Eigen3 REQUIRED NO_MODULE)

# =======
# Library
# =======

# Create the pybind11 library
pybind11_add_module(pybind11_bindings MODULE bindings.cpp)

target_link_libraries(pybind11_bindings
    PRIVATE MyMath::mymath Eigen3::Eigen)

# The name of the shared library must match the module name
set_target_properties(pybind11_bindings PROPERTIES
    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mymath
    OUTPUT_NAME "bindings")

# =======
# Install
# =======

# Install the pybind11 library
install(
    TARGETS pybind11_bindings
    COMPONENT bindings
    LIBRARY DESTINATION ${MYMATH_INSTALL_PREFIX}
    ARCHIVE DESTINATION ${MYMATH_INSTALL_PREFIX}
    RUNTIME DESTINATION ${MYMATH_INSTALL_PREFIX})