Adds commercial RTI 6.6 Pro library

This commit is contained in:
torsten committed 2026-11-02 17:43:52 +00:00
1 parent 8ebcac4253
commit 4806883cf3
2 files changed
+129 -45

No files matched your search

@@ -18,6 +18,10 @@ ENDIF()
IF(POLICY CMP0072)
CMAKE_POLICY(SET CMP0072 NEW) # cmake >= 3.11.0 - prefer libOpenGL.so over legacy libGL.so
ENDIF()
# Set policy CMP0111 unconditionally - imported targets require location property
IF(POLICY CMP0111)
CMAKE_POLICY(SET CMP0111 NEW)
ENDIF()
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -725,9 +729,11 @@ IF(BUILD_RTI)
IF(DEFINED ENV{DDS_PATH})
SET(RTI_INSTALL_DIR "$ENV{DDS_PATH}" CACHE PATH "RTI Connext DDS installation directory")
ELSE()
# In Docker container: /workspace/external/rti_connext_dds-7.7.0
# In Docker container: /repo/external/rti_connext_dds-7.7.0 (current) or /workspace/external/rti_connext_dds-7.7.0 (old)
# On host: ${CMAKE_SOURCE_DIR}/../../../external/rti_connext_dds-7.7.0
IF(EXISTS "/workspace/external/rti_connext_dds-7.7.0")
IF(EXISTS "/repo/external/rti_connext_dds-7.7.0")
SET(RTI_INSTALL_DIR "/repo/external/rti_connext_dds-7.7.0" CACHE PATH "RTI Connext DDS installation directory")
ELSEIF(EXISTS "/workspace/external/rti_connext_dds-7.7.0")
SET(RTI_INSTALL_DIR "/workspace/external/rti_connext_dds-7.7.0" CACHE PATH "RTI Connext DDS installation directory")
ELSEIF(EXISTS "${CMAKE_SOURCE_DIR}/../../../external/rti_connext_dds-7.7.0")
SET(RTI_INSTALL_DIR "${CMAKE_SOURCE_DIR}/../../../external/rti_connext_dds-7.7.0" CACHE PATH "RTI Connext DDS installation directory")
@@ -35,6 +35,11 @@ if(POLICY CMP0153)
cmake_policy(SET CMP0153 OLD)
endif()
# Set policy for imported target location requirements - must be set before any imported targets are created
if(POLICY CMP0111)
cmake_policy(SET CMP0111 NEW)
endif()
# Check if RTI_DIR is not set OR is empty (cached empty string from previous failed detection)
IF(NOT RTI_DIR OR RTI_DIR STREQUAL "")
# First check RTI_INSTALL_DIR CMake variable (set by parent CMakeLists.txt)
@@ -96,17 +101,23 @@ IF(NOT RTI_DIR OR RTI_DIR STREQUAL "")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0.0)
# Prefer newer gcc-based RTI builds; try a sequence then fall back to any x64Linux4gcc* dir found under RTI lib
# RTI 7.7 Pro uses resource/app/lib structure instead of lib/
IF(EXISTS "${_RTI_DIR}/resource/app/lib")
SET(_rti_lib_dir "${_RTI_DIR}/resource/app/lib")
ELSE()
SET(_rti_lib_dir "${_RTI_DIR}/lib")
ENDIF()
SET(_preferred_archs "x64Linux4gcc8.5.0;x64Linux4gcc7.3.0;x64Linux3gcc5.4.0")
SET(_found_arch "")
foreach(_cand IN LISTS _preferred_archs)
if(EXISTS "${_RTI_DIR}/lib/${_cand}")
if(EXISTS "${_rti_lib_dir}/${_cand}")
SET(_found_arch "${_cand}")
break()
endif()
endforeach()
if(_found_arch STREQUAL "")
# fallback: pick any x64Linux* directory under lib
file(GLOB _rti_arch_dirs RELATIVE "${_RTI_DIR}/lib" "${_RTI_DIR}/lib/x64Linux*")
file(GLOB _rti_arch_dirs RELATIVE "${_rti_lib_dir}" "${_rti_lib_dir}/x64Linux*")
list(LENGTH _rti_arch_dirs _rti_arch_dirs_len)
if(_rti_arch_dirs_len GREATER 0)
list(GET _rti_arch_dirs 0 _found_arch)
@@ -131,17 +142,23 @@ ELSE()
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0.0)
# Prefer newer gcc-based RTI builds; try a sequence then fall back to any x64Linux4gcc* dir found under RTI lib
# RTI 7.7 Pro uses resource/app/lib structure instead of lib/
IF(EXISTS "${RTI_DIR}/resource/app/lib")
SET(_rti_lib_dir "${RTI_DIR}/resource/app/lib")
ELSE()
SET(_rti_lib_dir "${RTI_DIR}/lib")
ENDIF()
SET(_preferred_archs "x64Linux4gcc8.5.0;x64Linux4gcc7.3.0;x64Linux3gcc5.4.0")
SET(_found_arch "")
foreach(_cand IN LISTS _preferred_archs)
if(EXISTS "${RTI_DIR}/lib/${_cand}")
if(EXISTS "${_rti_lib_dir}/${_cand}")
SET(_found_arch "${_cand}")
break()
endif()
endforeach()
if(_found_arch STREQUAL "")
# fallback: pick any x64Linux* directory under lib
file(GLOB _rti_arch_dirs RELATIVE "${RTI_DIR}/lib" "${RTI_DIR}/lib/x64Linux*")
file(GLOB _rti_arch_dirs RELATIVE "${_rti_lib_dir}" "${_rti_lib_dir}/x64Linux*")
list(LENGTH _rti_arch_dirs _rti_arch_dirs_len)
if(_rti_arch_dirs_len GREATER 0)
list(GET _rti_arch_dirs 0 _found_arch)
@@ -207,7 +224,14 @@ ENDIF()
IF(NOT RTI_DDSGEN_EXECUTABLE)
FIND_PROGRAM(RTI_DDSGEN_EXECUTABLE NAMES rtiddsgen rtiddsgen.bat HINTS ${RTI_DIR}/scripts ${RTI_DIR}/bin)
# RTI 7.7 Pro uses resource/app/bin structure
IF(EXISTS "${RTI_DIR}/resource/app/bin/${_rti_gcc_arch}")
FIND_PROGRAM(RTI_DDSGEN_EXECUTABLE NAMES rtiddsgen rtiddsgen2 rtiddsgen.bat
HINTS ${RTI_DIR}/resource/app/bin/${_rti_gcc_arch} ${RTI_DIR}/bin)
ELSE()
FIND_PROGRAM(RTI_DDSGEN_EXECUTABLE NAMES rtiddsgen rtiddsgen.bat
HINTS ${RTI_DIR}/scripts ${RTI_DIR}/bin)
ENDIF()
ENDIF()
IF(NOT RTI_VERSION_MAJOR)
EXEC_PROGRAM(${RTI_DDSGEN_EXECUTABLE} ARGS -version OUTPUT_VARIABLE _dds_version_output)
@@ -231,9 +255,15 @@ SET(_libs "")
SET(_lib_vars "")
# Build list of library search paths including arch-specific subdirs
set(_rti_lib_search_paths "${RTI_DIR}/lib" "${RTI_DIR}/lib/${_rti_gcc_arch}")
# RTI 7.7 Pro uses resource/app/lib structure instead of lib/
IF(EXISTS "${RTI_DIR}/resource/app/lib")
SET(_rti_lib_base "${RTI_DIR}/resource/app/lib")
ELSE()
SET(_rti_lib_base "${RTI_DIR}/lib")
ENDIF()
set(_rti_lib_search_paths "${_rti_lib_base}" "${_rti_lib_base}/${_rti_gcc_arch}")
# Also scan for any arch subdirs under lib/
file(GLOB _rti_arch_dirs "${RTI_DIR}/lib/*")
file(GLOB _rti_arch_dirs "${_rti_lib_base}/*")
foreach(_arch_dir IN LISTS _rti_arch_dirs)
if(IS_DIRECTORY "${_arch_dir}")
list(APPEND _rti_lib_search_paths "${_arch_dir}")
@@ -242,35 +272,69 @@ endforeach()
FOREACH(_lib ${_RTI_LIBS})
SET(_libname "RTI_${_lib}_LIBRARY")
SET(_libname_release "RTI_${_lib}_LIBRARY_RELEASE")
SET(_libname_debug "RTI_${_lib}_LIBRARY_DEBUG")
SET(_libname_release "RTI_${_lib}_LIBRARY_RELEASE")
SET(_libname_debug "RTI_${_lib}_LIBRARY_DEBUG")
# Build explicit search paths for this library
# RTI 7.7 Pro uses resource/app/lib structure instead of lib/
IF(EXISTS "${RTI_DIR}/resource/app/lib")
SET(_rti_lib_base "${RTI_DIR}/resource/app/lib")
ELSE()
SET(_rti_lib_base "${RTI_DIR}/lib")
ENDIF()
set(_lib_search_paths
"${RTI_DIR}/lib/${_rti_gcc_arch}"
"${RTI_DIR}/lib"
"${_rti_lib_base}/${_rti_gcc_arch}"
"${_rti_lib_base}"
)
MESSAGE(STATUS "Finding RTI library '${_lib}': searching in ${_lib_search_paths}")
MESSAGE(STATUS " _rti_lib_base=${_rti_lib_base}, _rti_gcc_arch=${_rti_gcc_arch}")
# Find release library (no suffix)
FIND_LIBRARY(${_libname_release}
NAMES ${_lib}
PATHS ${_lib_search_paths}
NO_DEFAULT_PATH)
MESSAGE(STATUS " Result: ${_libname_release}=${${_libname_release}}")
# Find debug library (d suffix on Linux)
FIND_LIBRARY(${_libname_debug}
NAMES ${_lib}d
PATHS ${_lib_search_paths}
NO_DEFAULT_PATH)
# Set combined library variable
IF(${_libname_release})
SET(${_libname} "${${_libname_release}}" CACHE STRING "RTI ${_lib} library" FORCE)
ELSEIF(${_libname_debug})
SET(${_libname} "${${_libname_debug}}" CACHE STRING "RTI ${_lib} library" FORCE)
# Use temporary variables to avoid double-dereference issues in IF conditions
SET(_release_path "${${_libname_release}}")
SET(_debug_path "${${_libname_debug}}")
# Set combined library variable - use simple SET without CACHE to avoid conflicts
IF(_release_path AND NOT _release_path MATCHES "NOTFOUND")
SET(${_libname} "${_release_path}")
ELSEIF(_debug_path AND NOT _debug_path MATCHES "NOTFOUND")
SET(${_libname} "${_debug_path}")
ENDIF()
SET(_tgt_name RTI::${_lib})
# Check if libraries are found BEFORE creating the target
SET(_release_found FALSE)
SET(_debug_found FALSE)
IF(_release_path AND NOT _release_path MATCHES "NOTFOUND")
SET(_release_found TRUE)
ENDIF()
IF(_debug_path AND NOT _debug_path MATCHES "NOTFOUND")
SET(_debug_found TRUE)
ENDIF()
MESSAGE(STATUS "DEBUG ${_lib}: _release_path=${_release_path}, _release_found=${_release_found}, _debug_found=${_debug_found}")
# Only create target if at least one library is found
IF(NOT _release_found AND NOT _debug_found)
MESSAGE(WARNING "RTI library ${_lib} not found in ${RTI_DIR}")
SET(${_libname} "" CACHE STRING "RTI ${_lib} library (not found)" FORCE)
CONTINUE()
ENDIF()
IF(NOT TARGET ${_tgt_name})
ADD_LIBRARY(${_tgt_name} UNKNOWN IMPORTED)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${RTI_INCLUDE_DIRS}")
@@ -286,35 +350,42 @@ FOREACH(_lib ${_RTI_LIBS})
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY INTERFACE_COMPILE_DEFINITIONS "RTI_WIN32;NDDS_DLL_VARIABLE" )
ENDIF()
ENDIF()
# Set library locations - use release for both configs if debug not found
IF(${_libname}_RELEASE AND ${_libname}_DEBUG)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE "${${_libname}_RELEASE}")
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_DEBUG "${${_libname}_DEBUG}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${${_libname}_RELEASE}")
ELSEIF(${_libname}_RELEASE)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE "${${_libname}_RELEASE}")
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_DEBUG "${${_libname}_RELEASE}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${${_libname}_RELEASE}")
ELSEIF(${_libname}_DEBUG)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE "${${_libname}_DEBUG}")
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_DEBUG "${${_libname}_DEBUG}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${${_libname}_DEBUG}")
ELSE()
# No library found - skip creating this target
MESSAGE(WARNING "RTI library ${_lib} not found in ${RTI_DIR}")
SET(${_libname} "" CACHE STRING "RTI ${_lib} library (not found)" FORCE)
CONTINUE()
ENDIF()
ENDIF()
LIST(APPEND _libs "${${_libname}}")
# Set library locations - use release for both configs if debug not found
# Use pre-computed _release_path and _debug_path variables to avoid double-dereference issues
# IMPORTANT: This must be outside the TARGET creation block to handle multiple find_package calls
IF(_release_found AND _debug_found)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG RelWithDebInfo)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE "${_release_path}")
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_DEBUG "${_debug_path}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${_release_path}")
# Set RelWithDebInfo to use release library
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RelWithDebInfo "${_release_path}")
ELSEIF(_release_found)
# Only release library found - don't list DEBUG in configurations
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS RELEASE RelWithDebInfo)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE "${_release_path}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${_release_path}")
# Set RelWithDebInfo to use release library
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RelWithDebInfo "${_release_path}")
ELSEIF(_debug_found)
# Only debug library found - don't list RELEASE in configurations
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_CONFIGURATIONS DEBUG RelWithDebInfo)
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_DEBUG "${_debug_path}")
# Set default IMPORTED_LOCATION for non-configured builds
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION "${_debug_path}")
# Set RelWithDebInfo to use debug library
SET_PROPERTY(TARGET ${_tgt_name} PROPERTY IMPORTED_LOCATION_RelWithDebInfo "${_debug_path}")
ENDIF()
# Use the combined library variable value
SET(_lib_path "${${_libname}}")
IF(_lib_path)
LIST(APPEND _libs "${_lib_path}")
ENDIF()
# rtiroutingservice is optional - only add required libs to _lib_vars for FIND_PACKAGE_HANDLE_STANDARD_ARGS
IF(NOT "${_lib}" STREQUAL "rtiroutingservice")
LIST(APPEND _lib_vars "${_libname}")
@@ -331,3 +402,10 @@ MARK_AS_ADVANCED(RTI_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG RTI_DIR RTI_INCLUDE_DIR RTI_DDSGEN_EXECUTABLE ${_lib_vars})
# Explicitly set RTI_FOUND to TRUE when all required components are found
# This ensures CMakeLists.txt fallback code doesn't create placeholder targets
IF(RTI_DIR AND RTI_INCLUDE_DIR AND RTI_DDSGEN_EXECUTABLE AND RTI_LIBRARIES)
SET(RTI_FOUND TRUE CACHE BOOL "RTI found" FORCE)
MESSAGE(STATUS "RTI Connext DDS found: ${RTI_DIR} (libraries: ${RTI_LIBRARIES})")
ENDIF()