diff --git a/header_template.hpp.in b/header_template.hpp.in index 18673a37f9..3db4b0b17f 100644 --- a/header_template.hpp.in +++ b/header_template.hpp.in @@ -22,7 +22,7 @@ #ifndef @include_guard@ #define @include_guard@ -#pragma message("This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rdc") +#pragma message("This file is deprecated. Use file from include path /opt/rocm-ver/include/ and include as rdc/@header_name@") @include_statements@ #endif diff --git a/rdc-backward-compat.cmake b/rdc-backward-compat.cmake index b3d0a85828..0eba171a6f 100644 --- a/rdc-backward-compat.cmake +++ b/rdc-backward-compat.cmake @@ -23,6 +23,7 @@ set(RDC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(RDC_WRAPPER_DIR ${RDC_BUILD_DIR}/wrapper_dir) set(RDC_WRAPPER_INC_DIR ${RDC_WRAPPER_DIR}/include/rdc) set(RDC_WRAPPER_LIB_DIR ${RDC_WRAPPER_DIR}/lib) +set(RDC_WRAPPER_BIN_DIR ${RDC_WRAPPER_DIR}/bin) set(RDC_SRC_INC_DIR ${RDC_SRC_ROOT}/include/rdc) #use header template file and generate wrapper header files @@ -33,11 +34,12 @@ function(generate_wrapper_header) set(include_guard "RDC_WRAPPER_INCLUDE_RDC_H") #set #include statement set(file_name "rdc.h") + set(header_name ${file_name}) set(include_statements "#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/rdc/${file_name}\"\n") configure_file(${RDC_SRC_ROOT}/header_template.hpp.in ${RDC_WRAPPER_INC_DIR}/${file_name}) endfunction() -#function to create symlink to libraries +# function to create symlink to libraries function(create_library_symlink) file(MAKE_DIRECTORY ${RDC_WRAPPER_LIB_DIR}) set(LIB_RDC "librdc.so") @@ -69,12 +71,34 @@ function(create_library_symlink) COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/${RDC}/${file_name} ${RDC_WRAPPER_LIB_DIR}/${file_name}) endforeach() + # create symlink to rdc.service + set(file_name "rdc.service") + add_custom_target(link_${file_name} ALL + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E create_symlink + ../../${CMAKE_INSTALL_LIBEXECDIR}/${RDC}/${file_name} ${RDC_WRAPPER_LIB_DIR}/${file_name}) endfunction() -#Use template header file and generate wrapper header files +# function to create symlink to binaries +function(create_binary_symlink) + file(MAKE_DIRECTORY ${RDC_WRAPPER_BIN_DIR}) + # create symlink for rdcd and rdci + set(binary_files "rdcd" "rdci") + foreach(file_name ${binary_files}) + add_custom_target(link_${file_name} ALL + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E create_symlink + ../../${CMAKE_INSTALL_BINDIR}/${file_name} ${RDC_WRAPPER_BIN_DIR}/${file_name}) + endforeach() +endfunction() + +# Use template header file and generate wrapper header files generate_wrapper_header() install(DIRECTORY ${RDC_WRAPPER_INC_DIR} DESTINATION DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC}/include COMPONENT ${CLIENT_COMPONENT}) # Create symlink to library files create_library_symlink() install(DIRECTORY ${RDC_WRAPPER_LIB_DIR} DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC} COMPONENT ${CLIENT_COMPONENT}) +# Create symlink to library binaries +create_binary_symlink() +install(DIRECTORY ${RDC_WRAPPER_BIN_DIR} DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${RDC} COMPONENT ${CLIENT_COMPONENT}) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 6ab743e255..3702ea64e1 100755 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -89,7 +89,7 @@ link_directories(${RSMI_LIB_DIR} "${GRPC_ROOT}/lib" "${GRPC_ROOT}/lib64") ## Set RUNPATH if ROCM_RPATH is defined and passed by the environment ## RUNPATH should help to run "rdcd" without the usage of ldconfig if (DEFINED ENV{ROCM_RPATH}) - set (GRPC_RUNPATH "\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../lib/rdc:\$ORIGIN/../lib64/rdc;\$ORIGIN/../grpc/lib:\$ORIGIN/../grpc/lib64:\$ORIGIN/../lib/rdc/grpc/lib:\$ORIGIN/../lib/rdc/grpc/lib64") + set (GRPC_RUNPATH "\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../lib/rdc:\$ORIGIN/../lib64/rdc;\$ORIGIN/../grpc/lib:\$ORIGIN/../grpc/lib64:\$ORIGIN/../lib/rdc/grpc/lib:\$ORIGIN/../lib64/rdc/grpc/lib64") set (CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags -Wl,--no-as-needed -Wl,-z,origin") set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${GRPC_RUNPATH}") set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) @@ -122,7 +122,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SERVER_DAEMON_EXE} DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} COMPONENT ${SERVER_COMPONENT}) install(FILES ${PROJECT_BINARY_DIR}/${SERVICE_FILE_NAME} - DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/${RDC} COMPONENT ${SERVER_COMPONENT}) message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") diff --git a/server/rdc.service.in b/server/rdc.service.in index 4d08f95ccd..96d871f061 100755 --- a/server/rdc.service.in +++ b/server/rdc.service.in @@ -24,7 +24,7 @@ AmbientCapabilities=CAP_DAC_OVERRIDE # If we need to start anything before rdcd, use this # ExecStartPre= -ExecStart=/@RDC_CLIENT_INSTALL_PREFIX@/rdc/bin/rdcd +ExecStart=/@RDC_CLIENT_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/rdcd # If we need to start anything after rdcd use this # ExecStartPost= diff --git a/src/DEBIAN_postinst.in b/src/DEBIAN_postinst.in index 4d882255ef..c050ee9b40 100755 --- a/src/DEBIAN_postinst.in +++ b/src/DEBIAN_postinst.in @@ -22,7 +22,7 @@ case "$1" in configure) do_create_rdc_user #Symlink RDC Service - ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/lib/rdc.service /lib/systemd/system/rdc.service + ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rdc/rdc.service /lib/systemd/system/rdc.service reload_systemd exit 0 ;; diff --git a/src/RPM_rpm_post.in b/src/RPM_rpm_post.in index 514c00a727..c0a98daec7 100755 --- a/src/RPM_rpm_post.in +++ b/src/RPM_rpm_post.in @@ -19,7 +19,7 @@ reload_systemd() { do_create_rdc_user #Symlink RDC Service -ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/lib/rdc.service @DISTRO_ROOT@/rdc.service +ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rdc/rdc.service @DISTRO_ROOT@/rdc.service #Request systemctl to reload file since RDC is adding new file/service reload_systemd