Skip to content

Commit

Permalink
build: RHEL8 Python Backend (#385)
Browse files Browse the repository at this point in the history
* PYBE RHEL
  • Loading branch information
fpetrini15 authored Oct 31, 2024
1 parent a2564ea commit 682db01
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ FetchContent_Declare(
GIT_TAG "aa304c9c7d725ffb9d10af08a3b34cb372307020"
GIT_SHALLOW ON
)

# RHEL base container has multiple version of Python installed. By default
# it seems like pybind will pickup v3.6, so we specifically assign it to
# search for 3.12 here.
set(RHEL_BUILD OFF)
if(LINUX)
file(STRINGS "/etc/os-release" DISTRO_ID_LIKE REGEX "ID_LIKE")
if(${DISTRO_ID_LIKE} MATCHES "rhel|centos")
set(RHEL_BUILD ON)
set(PYBIND11_PYTHON_VERSION 3.12)
endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos")
endif(LINUX)
FetchContent_MakeAvailable(pybind11)

#
Expand Down Expand Up @@ -268,6 +280,23 @@ target_compile_options(
)
target_compile_definitions(triton-python-backend-stub PRIVATE TRITON_PB_STUB)

# RHEL assets are not released in a container environment nor do the current
# Python lib versions in the manylinux base container match those currently
# available for RHEL8 package managers. Therefore, we package the correct
# python libs in the backend folder and adjust the stub executable to look
# in its own folder at runtime.
if(RHEL_BUILD)
set_target_properties(
triton-python-backend-stub
PROPERTIES
SKIP_BUILD_RPATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH "$\{ORIGIN\}"
)
endif(RHEL_BUILD)


# For WIN32 do not link Threads and DL_LIBS
if(WIN32)
target_link_libraries(
Expand Down

0 comments on commit 682db01

Please sign in to comment.