Skip to content

Commit 5048e9e

Browse files
committed
Add RPATH
1 parent fbcd1f5 commit 5048e9e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ FetchContent_Declare(
9696
# RHEL base container has multiple version of Python installed. By default
9797
# it seems like pybind will pickup v3.6, so we specifically assign it to
9898
# search for 3.12 here.
99+
set(RHEL_BUILD OFF)
99100
if(LINUX)
100101
file(STRINGS "/etc/os-release" DISTRO_ID_LIKE REGEX "ID_LIKE")
101102
if(${DISTRO_ID_LIKE} MATCHES "rhel|centos")
103+
set(RHEL_BUILD ON)
102104
set(PYBIND11_PYTHON_VERSION 3.12)
103105
endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos")
104106
endif(LINUX)
@@ -278,6 +280,23 @@ target_compile_options(
278280
)
279281
target_compile_definitions(triton-python-backend-stub PRIVATE TRITON_PB_STUB)
280282

283+
# RHEL assets are not released in a container environment nor do the current
284+
# Python lib versions in the manylinux base container match those currently
285+
# available for RHEL8 package managers. Therefore, we package the correct
286+
# python libs in the backend folder and adjust the stub executable to look
287+
# in its own folder at runtime.
288+
if(RHEL_BUILD)
289+
set_target_properties(
290+
triton-python-backend-stub
291+
PROPERTIES
292+
SKIP_BUILD_RPATH TRUE
293+
BUILD_WITH_INSTALL_RPATH TRUE
294+
INSTALL_RPATH_USE_LINK_PATH FALSE
295+
INSTALL_RPATH "$\{ORIGIN\}"
296+
)
297+
endif(RHEL_BUILD)
298+
299+
281300
# For WIN32 do not link Threads and DL_LIBS
282301
if(WIN32)
283302
target_link_libraries(

0 commit comments

Comments
 (0)