Skip to content

Commit 55316eb

Browse files
Support DPCTL_WITH_REDIST for Cython extensions
1 parent 96ffff0 commit 55316eb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dpctl/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ function(build_dpctl_ext _trgt _src _dest)
146146
get_filename_component(_generated_src_dir_dir ${_generated_src_dir} DIRECTORY)
147147
# TODO: do not set directory if we did not generate header
148148
target_include_directories(${_trgt} INTERFACE ${_generated_src_dir_dir})
149+
set(_rpath_value "$ORIGIN")
150+
if (DPCTL_WITH_REDIST)
151+
get_filename_component(_src_dir ${_src} DIRECTORY)
152+
cmake_path(RELATIVE_PATH CMAKE_SOURCE_DIR BASE_DIRECTORY ${_src_dir} OUTPUT_VARIABLE _relative_path)
153+
string(JOIN ":" _expanded_rpath_value ${_rpath_value} "$ORIGIN/${_relative_path}/../../")
154+
set(_rpath_value ${_expanded_rpath_value})
155+
endif()
156+
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value})
149157

150158
install(TARGETS ${_trgt}
151159
LIBRARY DESTINATION ${_dest})

0 commit comments

Comments
 (0)