Skip to content

Commit bc027b2

Browse files
committed
some more rpath
1 parent f04f94c commit bc027b2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pycode/memilio-simulation/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ if(APPLE)
1919
set(CMAKE_INSTALL_RPATH
2020
"@loader_path"
2121
"@loader_path/lib"
22-
"${CMAKE_BINARY_DIR}/lib"
23-
"${CMAKE_BINARY_DIR}/bin"
2422
)
2523
elseif(UNIX)
2624
set(CMAKE_INSTALL_RPATH
2725
"$ORIGIN"
2826
"$ORIGIN/lib"
29-
"${CMAKE_BINARY_DIR}/lib"
30-
"${CMAKE_BINARY_DIR}/bin"
3127
)
3228
endif()
3329

30+
# keep build RPATH separate and avoid putting build paths into installed wheels
31+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
32+
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
33+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
34+
3435
# Use a static spdlog so the wheel stays self-contained.
3536
set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "" FORCE)
3637

@@ -65,6 +66,11 @@ function(add_pymio_module target_name)
6566
target_link_libraries(${target_name} PRIVATE ${PYBIND11_MODULE_LINKED_LIBRARIES})
6667
target_include_directories(${target_name} PRIVATE memilio/simulation/bindings)
6768

69+
# Set RPATH so extension can find the C++ libraries in lib
70+
set_target_properties(${target_name} PROPERTIES
71+
INSTALL_RPATH "$ORIGIN/lib"
72+
)
73+
6874
# Make sure to install shared and static libraries (LIBRARY and ARCHIVE) and the executables (RUNTIME).
6975
# Destination "." refers to the value of wheel.install-dir in the pyproject.toml.
7076
install(TARGETS ${target_name}

0 commit comments

Comments
 (0)