diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b7cb2493a..64d84bca65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,7 @@ endif() # I don't know how to enable warnings properly so that they are enabled in Xcode projects as well if(${CMAKE_GENERATOR} STREQUAL "Xcode") + set (CMAKE_XCODE_GENERATE_SCHEME YES) set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY YES) set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION YES) @@ -264,9 +265,40 @@ set(MEMORYCHECK_COMMAND_OPTIONS "--track-origins=yes --leak-check=full --trace-c # library so we can actually build the tests. option(BUILD_TESTING "Build the testing tree." OFF) +# ROS2 build use BUILD_TESTING but it makes (1) little sense to include the Cyclone tests +# in a ROS2 test run, and (2) some variant of the Windows CI platform ran into: +# +# Auto build dll exports +# +# $P: error MSB3073: The command "setlocal [C:\ci\ws\build\cyclonedds\src\core\ddsc.vcxproj] +# $P: error MSB3073: cd C:\ci\ws\build\cyclonedds\src\core [C:\ci\ws\build\cyclonedds\src\core\ddsc.vcxproj] +# $P: error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\ci\ws\build\cyclonedds\src\core\ddsc.vcxproj] +# ... +# +# where P = C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\ +# ...Microsoft\VC\v160\Microsoft.CppCommon.targets(150,5) +set(CYCLONEDDS_BUILD_TESTING "AUTO" CACHE STRING "Override regular BUILD_TESTING") +set_property(CACHE CYCLONEDDS_BUILD_TESTING PROPERTY STRINGS ON OFF AUTO) +if(NOT CYCLONEDDS_BUILD_TESTING STREQUAL "AUTO") + if(CYCLONEDDS_BUILD_TESTING) + if(NOT BUILD_TESTING) + message(WARNING "Enabling test code: CYCLONEDDS_BUILD_TESTING and not BUILD_TESTING") + set(BUILD_TESTING TRUE) + endif() + else() + if(BUILD_TESTING) + message(WARNING "Disabling test code: not CYCLONEDDS_BUILD_TESTING and BUILD_TESTING") + set(BUILD_TESTING FALSE) + endif() + endif() +endif() + # For special-purpose builds it can be useful to export all symbols from the library, # like we do when building the tests. option(EXPORT_ALL_SYMBOLS "Export all symbols from the library." OFF) +if(BUILD_TESTING OR EXPORT_ALL_SYMBOLS) + message(STATUS "Exporting all symbols from library") +endif() # Include the xtests for idlc. These tests use the idl compiler (C back-end) to # compile an idl file at (test) runtime, and use the C compiler to build a test diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87a563dc76..6ef8fae74b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,17 +19,17 @@ variables: jobs: - job: build_and_test - displayName: Build and test Cyclone + displayName: 'B&T' pool: vmImage: $(image) strategy: matrix: - 'Ubuntu 22.04 (Release, x86_64)': + 'Ub 22.04 (Rel, x86_64)': image: ubuntu-22.04 build_type: Release sanitizer: undefined cc: gcc - 'Ubuntu 24.04 (Debug, x86_64, Iceoryx)': + 'Ub 24.04 (Deb, x86_64, Iceoryx)': image: ubuntu-24.04 # No address sanitizer because of this in test run: # Shadow memory range interleaves with an existing memory mapping. @@ -40,7 +40,7 @@ jobs: iceoryx: on cc: gcc coverage: on - 'Ubuntu 24.04 (Debug, x86_64, Iceoryx2)': + 'Ub 24.04 (Deb, x86_64, Iceoryx2)': image: ubuntu-24.04 # No address sanitizer because of this in test run: # Shadow memory range interleaves with an existing memory mapping. @@ -51,13 +51,13 @@ jobs: iceoryx2: on cc: gcc coverage: on - 'Ubuntu 24.04 (Release, x86_64)': + 'Ub 24.04 (Rel, x86_64)': image: ubuntu-24.04 build_type: Release sanitizer: undefined cc: gcc-14 cxx: g++-14 - 'Ubuntu 24.04 with GCC 12 (Debug, x86_64, security only)': + 'Ub 24.04 + GCC 12 (Deb, x86_64, security only)': image: ubuntu-24.04 sanitizer: address,undefined ssl: off @@ -67,62 +67,62 @@ jobs: topic_discovery: off idlc_xtests: off # temporary disabled because of passing -t option to idlc in this test for recursive types cc: gcc-12 - 'Ubuntu 24.04 with GCC 12 (Debug, x86_64, no tests)': + 'Ub 24.04 + GCC 12 (Deb, x86_64, no tests)': image: ubuntu-24.04 cc: gcc-12 testing: off idlc_xtests: off - 'Ubuntu 24.04 with Clang (Debug, x86_64)': + 'Ub 24.04 + Clang (Deb, x86_64)': image: ubuntu-24.04 analyzer: on sanitizer: address,undefined cc: clang - 'Ubuntu 24.04 with Clang (Debug, x86_64, no security)': + 'Ub 24.04 + Clang (Deb, x86_64, no security)': image: ubuntu-24.04 sanitizer: address,undefined security: off cc: clang - 'Ubuntu 24.04 with Clang (Release, x86_64, no topic discovery)': + 'Ub 24.04 + Clang (Rel, x86_64, no topic discovery)': image: ubuntu-24.04 build_type: Release sanitizer: undefined topic_discovery: off idlc_xtests: off # temporary disabled because of passing -t option to idlc in this test for recursive types cc: clang - 'macOS 14 with Clang (Debug, x86_64)': + 'macOS 14 + Clang (Deb, x86_64)': image: macos-14 sanitizer: address,undefined deadline_update_skip: on cc: clang coverage: on - 'macOS 14 with Clang (Release, x86_64)': + 'macOS 14 + Clang (Rel, x86_64)': image: macos-14 build_type: Release sanitizer: undefined cc: clang - 'macOS 14 with GCC 14 (Debug, analyzer, x86_64)': + 'macOS 14 + GCC 14 (Deb, analyzer, x86_64)': image: macos-14 cc: gcc-14 analyzer: on # 32-bit Windows: without SSL/security because Chocolateley only provides 64-bit OpenSSL - 'Windows 2025 with Visual Studio 2022 (Debug, x86, no security)': + 'Win 2025 + VS 2022 (Deb, x86, no security)': arch: x86 image: windows-2025 ssl: off security: off idlc_xtests: off generator: 'Visual Studio 17 2022' - 'Windows 2025 with Visual Studio 2022 (Debug, x86_64)': + 'Win 2025 + VS 2022 (Deb, x86_64)': image: windows-2025 idlc_xtests: off generator: 'Visual Studio 17 2022' - 'Windows 2025 with Visual Studio 2022 (Release, x86_64, no tests)': + 'Win 2025 + VS 2022 (Rel, x86_64, no tests)': image: windows-2025 build_type: Release testing: off idlc_xtests: off generator: 'Visual Studio 17 2022' - 'Windows 2022 with Visual Studio 2022 (RelWithDebInfo, x86_64)': + 'Win 2022 + VS 2022 (RelWithDebInfo, x86_64)': image: windows-2022 build_type: RelWithDebInfo idlc_xtests: off @@ -134,7 +134,7 @@ jobs: # generator: 'MinGW Makefiles' # cc: 'C:/msys64/mingw64/bin/gcc.exe' # cxx: 'C:/msys64/mingw64/bin/g++.exe' - 'Ubuntu 24.04 with default GCC (Release, Iceoryx, Static, x86_64)': + 'Ub 24.04 Static (Rel, Iceoryx, x86_64)': image: ubuntu-24.04 idlc_xtests: off build_type: Release diff --git a/cmake/Modules/Generate.cmake b/cmake/Modules/Generate.cmake index b1ab72709d..3bc3a158e8 100644 --- a/cmake/Modules/Generate.cmake +++ b/cmake/Modules/Generate.cmake @@ -227,8 +227,15 @@ function(IDLC_GENERATE_GENERIC) endforeach() add_custom_target("${_target}_generate" DEPENDS "${_outputs}") + if(${CMAKE_GENERATOR} MATCHES "Xcode") + set_target_properties("${_target}_generate" PROPERTIES XCODE_GENERATE_SCHEME NO) + endif() + add_library(${_target} INTERFACE) target_sources(${_target} INTERFACE ${_outputs}) target_include_directories(${_target} INTERFACE "${_dir}") add_dependencies(${_target} "${_target}_generate") + if(${CMAKE_GENERATOR} MATCHES "Xcode") + set_target_properties("${_target}" PROPERTIES XCODE_GENERATE_SCHEME NO) + endif() endfunction() diff --git a/colcon.pkg b/colcon.pkg index b7468da973..e0baf42507 100644 --- a/colcon.pkg +++ b/colcon.pkg @@ -1,3 +1,3 @@ { - "cmake-args": [ "-DBUILD_IDLC=AUTO" ] + "cmake-args": [ "-DBUILD_IDLC=AUTO", "-DBUILD_TESTING=0" ] } diff --git a/src/core/ddsc/tests/cdrstream.c b/src/core/ddsc/tests/cdrstream.c index 124034a467..0419d44c7e 100644 --- a/src/core/ddsc/tests/cdrstream.c +++ b/src/core/ddsc/tests/cdrstream.c @@ -2135,7 +2135,7 @@ CU_Test (ddsc_cdrstream, check_string_invalid) { D(t2, true, {'a','b'}, "cd", 3), 0,NULL, CDR(32,3) }, { D(t3, true, { "a", {'c','d'} }, 5), 0,NULL, CDR(32,5) }, { D(t4, true, CSEQ0, STRSB({'c','d'}), 7), 0,NULL, CDR(32,7) }, - { D(t5, true, { 2, { .ws1 = "ab" } }, 11), 0,NULL, CDR(32,11) }, + { D(t5, true, { 2, { .ws1 = {'a','b'} } }, 11), 0,NULL, CDR(32,11) }, { D(t5, true, { 4, { .ws1bs = STRSB({'c','d'}) } }, 13), 0,NULL, CDR(32,13) }, { D(t5, true, { 5, { .ws1a = { "a", {'c','d'} } } }, 17), 0,NULL, CDR(32,17) }, { D(t5, true, { 6, { .ws1abs = { CSEQ0, STRSB({'c','d'}) } } }, 19), 0,NULL, CDR(32,19) },