Add cmake target for RDC
RDC will provide cmake files exporting the INCLUDE/LIBRARY targets. Change-Id: I8e8aeff426c45eae823d988f6473424ccf29687c
This commit is contained in:
+37
-1
@@ -206,7 +206,7 @@ set(CLIENT_COMPONENT "client")
|
||||
if(BUILD_STANDALONE)
|
||||
install(DIRECTORY ${GRPC_ROOT}/lib
|
||||
USE_SOURCE_PERMISSIONS
|
||||
DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/grpc
|
||||
DESTINATION {RDC_CLIENT_INSTALL_PREFIX}/${RDC}/grpc
|
||||
COMPONENT ${SERVER_COMPONENT})
|
||||
# Also include dev setup for people do not want to build grpc
|
||||
install(DIRECTORY ${GRPC_ROOT}/bin
|
||||
@@ -237,6 +237,42 @@ endif()
|
||||
# Folders for both standalone and embedded
|
||||
add_subdirectory("rdc_libs")
|
||||
add_subdirectory("example")
|
||||
|
||||
# Create cmake target
|
||||
# Add all targets to the build-tree export set
|
||||
export(TARGETS ${BOOTSTRAP_LIB} ${RDC_LIB} ${RDCCLIENT_LIB}
|
||||
FILE "${PROJECT_BINARY_DIR}/rdc_libs.cmake")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
# (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE rdc)
|
||||
# Create the rdc-config.cmake and rdc-config-version 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 "librdc_bootstrap.so")
|
||||
configure_file(rdc-config.cmake.in
|
||||
"${PROJECT_BINARY_DIR}/rdc-config.cmake" @ONLY)
|
||||
# ... for the install tree
|
||||
set(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}${RDC_CLIENT_INSTALL_PREFIX}/rdc/include")
|
||||
set(CONF_LIB_DIR "${CMAKE_INSTALL_PREFIX}${RDC_CLIENT_INSTALL_PREFIX}/rdc/lib")
|
||||
set(CONF_LIBS "librdc_bootstrap.so")
|
||||
|
||||
configure_file(rdc-config.cmake.in
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/rdc-config.cmake" @ONLY)
|
||||
# ... for both
|
||||
configure_file(rdc-config-version.cmake.in
|
||||
"${PROJECT_BINARY_DIR}/rdc-config-version.cmake" @ONLY)
|
||||
# Install the rdc-config.cmake and rdc-config-version.cmake
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/rdc-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/rdc-config-version.cmake"
|
||||
DESTINATION "${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/lib/cmake" COMPONENT dev)
|
||||
# Install the export set for use with the install-tree
|
||||
install(EXPORT rdcTargets DESTINATION
|
||||
"${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/lib/cmake" COMPONENT dev)
|
||||
|
||||
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/python_binding
|
||||
DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC}
|
||||
COMPONENT ${CLIENT_COMPONENT})
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
set(PACKAGE_VERSION "@RDC_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,19 @@
|
||||
# - Config file for the rdc package
|
||||
# It defines the following variables
|
||||
# RDC_INCLUDE_DIRS - include directories for rdc
|
||||
# RDC_LIBRARIES - libraries to link against
|
||||
|
||||
# Compute paths
|
||||
get_filename_component(RDC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
set(ROCM_RDC_INCLUDE_DIR "@CONF_INCLUDE_DIRS@")
|
||||
set(ROCM_RDC_LIB_DIR "@CONF_LIB_DIR@")
|
||||
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
if(NOT TARGET rdc_libs AND NOT rdc_BINARY_DIR)
|
||||
include("${RDC_CMAKE_DIR}/rdcTargets.cmake")
|
||||
endif()
|
||||
|
||||
# These are IMPORTED targets created by rdcTargets.cmake
|
||||
set(ROCM_RDC_LIBRARIES "@CONF_LIBS@")
|
||||
|
||||
@@ -265,13 +265,22 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# use the target_include_directories() command to specify the include directories for the target
|
||||
target_include_directories(${BOOTSTRAP_LIB}
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${RDC_CLIENT_INSTALL_PREFIX}/rdc/include>"
|
||||
)
|
||||
|
||||
## Add the install directives for the runtime library.
|
||||
if(BUILD_STANDALONE)
|
||||
install(TARGETS ${BOOTSTRAP_LIB} ${RDC_LIB} ${RDCCLIENT_LIB}
|
||||
EXPORT rdcTargets
|
||||
LIBRARY DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/lib
|
||||
COMPONENT ${CLIENT_COMPONENT})
|
||||
else()
|
||||
install(TARGETS ${BOOTSTRAP_LIB} ${RDC_LIB}
|
||||
EXPORT rdcTargets
|
||||
LIBRARY DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/lib
|
||||
COMPONENT ${CLIENT_COMPONENT})
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user