Support for not building ROCr

Add cmake variable BUILD_ROCR so that user can elect to not
build ROCr.

Change-Id: I73bd28cde9430ba86aed50fb88ec2e42b3443dbb


[ROCm/ROCR-Runtime commit: a676d8639c]
这个提交包含在:
Chris Freehill
2024-09-04 09:45:02 -05:00
提交者 Chris Freehill
父节点 8d1fe1f7ea
当前提交 f0baa90369
+14 -9
查看文件
@@ -46,10 +46,12 @@ cmake_minimum_required(VERSION 3.7)
# Set the project name # Set the project name
project("rocr") project("rocr")
# option(BUILD_TESTS "Build tests" OFF)
set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_VERBOSE_MAKEFILE ON)
if (NOT DEFINED BUILD_ROCR)
set(BUILD_ROCR ON)
endif()
function(add_rocm_subdir subdir subdir_assigns) function(add_rocm_subdir subdir subdir_assigns)
message("add_rocm_subdir() -- " ${subdir}) message("add_rocm_subdir() -- " ${subdir})
# message(" subdir_assigns before:" ${subdir_assigns} "EOM") # message(" subdir_assigns before:" ${subdir_assigns} "EOM")
@@ -93,16 +95,20 @@ set_target_properties(hsakmt PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/runtime") RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/runtime")
add_rocm_subdir(runtime/hsa-runtime "${ROCR_DEFINITIONS}") if (BUILD_ROCR)
set_target_properties(hsa-runtime64 PROPERTIES add_rocm_subdir(runtime/hsa-runtime "${ROCR_DEFINITIONS}")
set_target_properties(hsa-runtime64 PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/archive" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/archive"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/runtime") RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rocr/runtime")
if (BUILD_SHARED_LIBS)
add_dependencies(hsa-runtime64 hsakmt) if (BUILD_SHARED_LIBS)
else() add_dependencies(hsa-runtime64 hsakmt)
add_dependencies(hsa-runtime64 hsakmt-staticdrm) else()
add_dependencies(hsa-runtime64 hsakmt-staticdrm)
endif()
endif() endif()
# Optionally record the package's find module in the user's package cache. # Optionally record the package's find module in the user's package cache.
if ( NOT DEFINED EXPORT_TO_USER_PACKAGE_REGISTRY ) if ( NOT DEFINED EXPORT_TO_USER_PACKAGE_REGISTRY )
set ( EXPORT_TO_USER_PACKAGE_REGISTRY "off") set ( EXPORT_TO_USER_PACKAGE_REGISTRY "off")
@@ -117,7 +123,6 @@ if(${EXPORT_TO_USER_PACKAGE_REGISTRY})
export(PACKAGE ${CORE_RUNTIME_NAME}) export(PACKAGE ${CORE_RUNTIME_NAME})
endif() endif()
## Packaging directives ## Packaging directives
set(CPACK_VERBOSE 1) set(CPACK_VERBOSE 1)
set(CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build") set(CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build")