Skip to content

Commit 669ab4c

Browse files
committed
Update ldsctrlest CMake configuration
1 parent c71621b commit 669ab4c

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

‎python/ldsctrlest/CMakeLists.txt‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@ pybind11_add_module(gaussian MODULE gaussian.cpp)
33
pybind11_add_module(poisson MODULE poisson.cpp)
44
add_custom_target(python_modules DEPENDS base gaussian poisson)
55

6-
# need C++14 for CARMA
7-
set_property(TARGET base gaussian poisson PROPERTY CXX_STANDARD 14)
8-
set_property(TARGET base gaussian poisson PROPERTY CXX_STANDARD_REQUIRED ON)
9-
6+
# Set version info for all modules
107
target_compile_definitions(base PRIVATE VERSION_INFO=${PROJECT_VERSION})
118
target_compile_definitions(gaussian PRIVATE VERSION_INFO=${PROJECT_VERSION})
129
target_compile_definitions(poisson PRIVATE VERSION_INFO=${PROJECT_VERSION})
1310

14-
# carma already linked to main project
11+
# Link with main library
1512
target_link_libraries(base PUBLIC ${CMAKE_PROJECT_NAME})
1613
target_link_libraries(gaussian PUBLIC ${CMAKE_PROJECT_NAME})
1714
target_link_libraries(poisson PUBLIC ${CMAKE_PROJECT_NAME})
15+
16+
# Set RPATH so the extension modules can find the main library
17+
if(APPLE)
18+
set_target_properties(base gaussian poisson PROPERTIES
19+
INSTALL_RPATH "@loader_path"
20+
BUILD_WITH_INSTALL_RPATH TRUE)
21+
else()
22+
set_target_properties(base gaussian poisson PROPERTIES
23+
INSTALL_RPATH "$ORIGIN"
24+
BUILD_WITH_INSTALL_RPATH TRUE)
25+
endif()
26+
27+
# Install the Python modules
28+
install(TARGETS base gaussian poisson
29+
LIBRARY DESTINATION ldsctrlest
30+
RUNTIME DESTINATION ldsctrlest)

0 commit comments

Comments
 (0)