Add cmake target for rocm_smi
rocm_smi will provide cmake files exporting the INCLUDE/LIBRARY targets.
Change-Id: I1943a3142bdc0abd8f03ff62e12e947aac835401
(cherry picked from commit 088fe48d12)
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
Shuzhou Liu
γονέας
1447c8327d
υποβολή
e6692c08d3
@@ -137,6 +137,41 @@ set(CMN_INC_LIST ${CMN_INC_LIST} "${SHR_MUTEX_DIR}/shared_mutex.h")
|
|||||||
add_subdirectory("rocm_smi")
|
add_subdirectory("rocm_smi")
|
||||||
add_subdirectory("oam")
|
add_subdirectory("oam")
|
||||||
|
|
||||||
|
# Create cmake target
|
||||||
|
# Add all targets to the build-tree export set
|
||||||
|
export(TARGETS ${ROCM_SMI_TARGET} ${OAM_TARGET}
|
||||||
|
FILE "${PROJECT_BINARY_DIR}/rcom_smi_target.cmake")
|
||||||
|
|
||||||
|
# Export the package for use from the build-tree
|
||||||
|
# (this registers the build-tree with a global CMake-registry)
|
||||||
|
export(PACKAGE rocm_smi)
|
||||||
|
# Create the rocm_smiConfig.cmake and rocm_smiConfigVersion files
|
||||||
|
# ... for the build tree
|
||||||
|
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
|
||||||
|
set(CONF_LIB_DIR "${PROJECT_BINARY_DIR}")
|
||||||
|
set(CONF_LIBS "${ROCM_SMI_LIB_NAME}.so")
|
||||||
|
configure_file(rocm_smi-config.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}/rocm_smi-config.cmake" @ONLY)
|
||||||
|
# ... for the install tree
|
||||||
|
set(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/rocm_smi/include")
|
||||||
|
set(CONF_LIB_DIR "${CMAKE_INSTALL_PREFIX}/rocm_smi/lib")
|
||||||
|
set(CONF_LIBS "${ROCM_SMI_LIB_NAME}.so")
|
||||||
|
configure_file(rocm_smi-config.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/rocm_smi-config.cmake" @ONLY)
|
||||||
|
# ... for both
|
||||||
|
configure_file(rocm_smi-config-version.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}/rocm_smi-config-version.cmake" @ONLY)
|
||||||
|
# Install the rocm_smi-config.cmake and rocm_smi-config-version.cmake
|
||||||
|
install(FILES
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/rocm_smi-config.cmake"
|
||||||
|
"${PROJECT_BINARY_DIR}/rocm_smi-config-version.cmake"
|
||||||
|
DESTINATION "${ROCM_SMI}/lib/cmake" COMPONENT dev)
|
||||||
|
# Install the export set for use with the install-tree
|
||||||
|
install(EXPORT rocm_smiTargets DESTINATION
|
||||||
|
"${ROCM_SMI}/lib/cmake" COMPONENT dev)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Packaging directives
|
# Packaging directives
|
||||||
###########################
|
###########################
|
||||||
|
|||||||
@@ -91,8 +91,16 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
|
|||||||
endif()
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# use the target_include_directories() command to specify the include directories for the target
|
||||||
|
target_include_directories(${OAM_TARGET}
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||||
|
"$<INSTALL_INTERFACE:{OAM_NAME}/include>")
|
||||||
|
|
||||||
|
|
||||||
## Add the install directives for the runtime library.
|
## Add the install directives for the runtime library.
|
||||||
install(TARGETS ${OAM_TARGET}
|
install(TARGETS ${OAM_TARGET}
|
||||||
|
EXPORT rocm_smiTargets
|
||||||
LIBRARY DESTINATION ${OAM_NAME}/lib
|
LIBRARY DESTINATION ${OAM_NAME}/lib
|
||||||
ARCHIVE DESTINATION ${OAM_NAME}/lib
|
ARCHIVE DESTINATION ${OAM_NAME}/lib
|
||||||
COMPONENT ${OAM_COMPONENT})
|
COMPONENT ${OAM_COMPONENT})
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
set(PACKAGE_VERSION "@ROCM_SMI_VERSION@")
|
||||||
|
|
||||||
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# - Config file for the rocm_smi package
|
||||||
|
# It defines the following variables
|
||||||
|
# ROCM_SMI_INCLUDE_DIRS - include directories for rocm_smi
|
||||||
|
# ROCM_SMI_LIBRARIES - libraries to link against
|
||||||
|
|
||||||
|
# Compute paths
|
||||||
|
get_filename_component(ROCM_SMI_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
set(ROCM_SMI_INCLUDE_DIR "@CONF_INCLUDE_DIRS@")
|
||||||
|
set(ROCM_SMI_LIB_DIR "@CONF_LIB_DIR@")
|
||||||
|
|
||||||
|
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||||
|
if(NOT TARGET rocm_smi AND NOT rocm_smi_BINARY_DIR)
|
||||||
|
include("${ROCM_SMI_CMAKE_DIR}/rocm_smiTargets.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# These are IMPORTED targets created by RocmSmiTargets.cmake
|
||||||
|
set(ROCM_SMI_LIBRARIES "@CONF_LIBS@")
|
||||||
|
|
||||||
@@ -80,6 +80,14 @@ target_link_libraries(${ROCM_SMI_TARGET} pthread rt)
|
|||||||
target_include_directories(${ROCM_SMI_TARGET} PRIVATE
|
target_include_directories(${ROCM_SMI_TARGET} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR} ${COMMON_PROJ_ROOT}/common/shared_mutex)
|
${CMAKE_CURRENT_SOURCE_DIR} ${COMMON_PROJ_ROOT}/common/shared_mutex)
|
||||||
|
|
||||||
|
# use the target_include_directories() command to specify the include directories for the target
|
||||||
|
target_include_directories(${ROCM_SMI_TARGET}
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||||
|
"$<INSTALL_INTERFACE:${ROCM_SMI}/include>"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
## Set the VERSION and SOVERSION values
|
## Set the VERSION and SOVERSION values
|
||||||
set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
|
set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
|
||||||
SOVERSION "${VERSION_MAJOR}")
|
SOVERSION "${VERSION_MAJOR}")
|
||||||
@@ -113,6 +121,7 @@ if(${BUILD_SHARED_LIBS})
|
|||||||
endif()
|
endif()
|
||||||
## Add the install directives for the runtime library.
|
## Add the install directives for the runtime library.
|
||||||
install(TARGETS ${ROCM_SMI_TARGET}
|
install(TARGETS ${ROCM_SMI_TARGET}
|
||||||
|
EXPORT rocm_smiTargets
|
||||||
LIBRARY DESTINATION ${ROCM_SMI}/lib
|
LIBRARY DESTINATION ${ROCM_SMI}/lib
|
||||||
ARCHIVE DESTINATION ${ROCM_SMI}/lib
|
ARCHIVE DESTINATION ${ROCM_SMI}/lib
|
||||||
COMPONENT ${ROCM_SMI_COMPONENT})
|
COMPONENT ${ROCM_SMI_COMPONENT})
|
||||||
|
|||||||
Αναφορά σε νέο ζήτημα
Block a user