Skip to content

Commit

Permalink
Include python dependencies in Omniperf Debian package for automatic …
Browse files Browse the repository at this point in the history
…python lib installation.
  • Loading branch information
xuchen-amd committed Sep 26, 2024
1 parent e6747da commit e0085c1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,25 @@ set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")

# Dependencies
# Python Dependencies pointing to requirements.txt file
set(REQUIREMNTS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt")
set(PACKAGE_REQUIRES
"rocprofiler"
CACHE STRING "Package dependencies")

if(EXISTS ${REQUIREMNTS_FILE})
file(READ ${REQUIREMNTS_FILE} REQUIREMENTS_CONTENT)
# replace newlines with commas
string(REPLACE "\n" "," REQUIREMENTS_LIST ${REQUIREMENTS_CONTENT})
# remove trailing commas
STRING(REGEX REPLACE ", $|,$" "" REQUIREMENTS_LIST ${REQUIREMENTS_LIST})
# append to PACKAGE_REQUIRES
set(PACKAGE_REQUIRES
"${PACKAGE_REQUIRES},
${REQUIREMENTS_LIST}"
CACHE STRING "Updated PACKAGE_REQUIRES to include requirements.txt" FORCE)
endif()

set(CPACK_RPM_PACKAGE_REQUIRES ${PACKAGE_REQUIRES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_REQUIRES})

Expand Down

0 comments on commit e0085c1

Please sign in to comment.