Compile rdctst and improve CMakeLists

Main CMake improvements:

* Add rdctst with -DBUILD_TESTS=ON
* Set default ROCM_DIR to /opt/rocm/
* Split rdc_libs/CMakeLists.txt into subdirectories
* Package tests into rdc-tests.deb and .rpm

Misc improvements:

* Add .editorconfig to normalize code formatting
* Add .gitignore
* Expand RPATH for gRPC to reduce LD_LIBRARY_PATH usage
* Export compile_commands.json
* Show warning and do not install gRPC if GRPC_ROOT is left as default
* Move .in files into relevant subdirectories
* Move most variables into project CMakeLists.txt to avoid redefinitions
* Normalize CMakeLists.txt formatting (4 spaces indentation)
* Rename DIAGNOSTIC_LIB to RDC_ROCR_LIB
* Update gRPC version in README to 1.44.0
* Remove gtest source
* Pull gtest from github if not installed

Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Depends-On: I1039ef61247e3f0ff822925cc869fb0c2bf3af85
Change-Id: I879b21428e6642f19fda67092b365d8b78b7ba7b
This commit is contained in:
Galantsev, Dmitrii
2022-07-06 16:34:48 -05:00
parent 3214c21e6e
commit 2c171767b3
268 changed files with 842 additions and 109394 deletions
+49
View File
@@ -0,0 +1,49 @@
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
message(" Cmake RDC Lib-Bootstrap ")
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(INC_DIR "${RDC_LIB_INC_DIR}")
# need source dir for rocr
set(BOOTSTRAP_LIB_SRC_DIR "${SRC_DIR}" PARENT_SCOPE)
set(BOOTSTRAP_LIB_COMPONENT "lib${BOOTSTRAP_LIB}")
set(BOOTSTRAP_LIB_SRC_LIST
"${COMMON_DIR}/rdc_fields_supported.cc"
"${SRC_DIR}/RdcBootStrap.cc"
"${SRC_DIR}/RdcLibraryLoader.cc"
"${SRC_DIR}/RdcLogger.cc")
set(BOOTSTRAP_LIB_INC_LIST
"${COMMON_DIR}/rdc_fields_supported.h"
"${INC_DIR}/RdcHandler.h"
"${INC_DIR}/RdcLibraryLoader.h"
"${INC_DIR}/RdcLogger.h"
"${INC_DIR}/rdc_common.h"
"${PROJECT_SOURCE_DIR}/include/rdc/rdc.h")
message("BOOTSTRAP_LIB_INC_LIST=${BOOTSTRAP_LIB_INC_LIST}")
add_library(${BOOTSTRAP_LIB} SHARED ${BOOTSTRAP_LIB_SRC_LIST} ${BOOTSTRAP_LIB_INC_LIST})
target_link_libraries(${BOOTSTRAP_LIB} pthread dl)
target_include_directories(${BOOTSTRAP_LIB} PRIVATE
"${RSMI_INC_DIR}"
"${ROCM_DIR}/include"
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/include"
"${COMMON_DIR}")
target_include_directories(${BOOTSTRAP_LIB}
PUBLIC
"$<INSTALL_INTERFACE:${RDC_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}>")
# Set the VERSION and SOVERSION values
set_property(TARGET ${BOOTSTRAP_LIB} PROPERTY
SOVERSION "${VERSION_MAJOR}")
set_property(TARGET ${BOOTSTRAP_LIB} PROPERTY
VERSION "${SO_VERSION_STRING}")
# If the library is a release, strip the target library
if("${CMAKE_BUILD_TYPE}" STREQUAL Release)
add_custom_command(
TARGET ${BOOTSTRAP_LIB}
POST_BUILD COMMAND ${CMAKE_STRIP} ${BOOTSTRAP_LIB_COMPONENT}.so)
endif()