diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 655220fca..e553e8f32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,11 @@ name: Ubuntu -on: [push, pull_request] +on: + pull_request: + push: + branches: + - 'sdf[0-9]?' + - 'main' jobs: focal-ci: @@ -8,7 +13,7 @@ jobs: name: Ubuntu Focal CI steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile and test id: ci uses: gazebo-tooling/action-gz-ci@focal diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 2c94852da..2332244bf 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -14,4 +14,3 @@ jobs: with: project-url: https://github.com/orgs/gazebosim/projects/7 github-token: ${{ secrets.TRIAGE_TOKEN }} - diff --git a/Changelog.md b/Changelog.md index 8d94d03e9..5c59f7e7f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -462,6 +462,30 @@ ## libsdformat 12.X +### libsdformat 12.7.2 (2023-09-01) + +1. Fixed 1.9/light.sdf + * [Pull request #1281](https://github.com/gazebosim/sdformat/pull/1281) + +1. URDF->SDF handle links with no inertia or small mass + * [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238) + +1. Fix Element::Set method return value + * [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256) + +1. Add missing values in Surace ToElement method + * [Pull request #1263](https://github.com/gazebosim/sdformat/pull/1263) + +1. Rename COPYING to LICENSE + * [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252) + +1. Infrastructure + * [Pull request #1245](https://github.com/gazebosim/sdformat/pull/1245) + * [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271) + +1. Allow relative paths in URDF + * [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213) + ### libsdformat 12.7.1 (2023-02-28) 1. Fix camera info topic default value @@ -1539,6 +1563,27 @@ ## libsdformat 9.X +### libsdformat 9.10.1 (2024-01-05) + +1. URDF->SDF handle links with no inertia or small mass + * [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238) + +1. Fix Element::Set method return value + * [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256) + +1. Allowing relative paths in URDF + * [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213) + +1. Use `File.exist?` for Ruby 3.2 compatibility + * [Pull request #1216](https://github.com/gazebosim/sdformat/pull/1216) + +1. Infrastructure + * [Pull request #1217](https://github.com/gazebosim/sdformat/pull/1217) + * [Pull request #1225](https://github.com/gazebosim/sdformat/pull/1225) + * [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271) + * [Pull request #1345](https://github.com/gazebosim/sdformat/pull/1345) + * [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252) + ### libsdformat 9.10.0 (2022-11-30) 1. Ign to gz header migration. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 408add0c5..dfd569186 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,10 +5,9 @@ gz_get_libsources_and_unittests(sources gtest_sources) # Add the source file auto-generated into the build folder from sdf/CMakeLists.txt list(APPEND sources EmbeddedSdf.cc) -# Use interface library to deduplicate cmake logic for URDF linking -add_library(using_parser_urdf INTERFACE) +# When using the internal URDF parser, we build its sources with the core library if (USE_INTERNAL_URDF) - set(sources ${sources} + set(urdf_internal_sources urdf/urdf_parser/model.cpp urdf/urdf_parser/link.cpp urdf/urdf_parser/joint.cpp @@ -17,67 +16,48 @@ if (USE_INTERNAL_URDF) urdf/urdf_parser/urdf_model_state.cpp urdf/urdf_parser/urdf_sensor.cpp urdf/urdf_parser/world.cpp) - target_include_directories(using_parser_urdf INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/urdf) - if (WIN32) - target_compile_definitions(using_parser_urdf INTERFACE -D_USE_MATH_DEFINES) - endif() -else() - target_link_libraries(using_parser_urdf INTERFACE - GzURDFDOM::GzURDFDOM) + set(sources ${sources} ${urdf_internal_sources}) endif() -if (BUILD_TESTING) - # Build this test file only if Gazebo Tools is installed. - if (NOT GZ_PROGRAM) - list(REMOVE_ITEM gtest_sources gz_TEST.cc) - endif() - - # Skip tests that don't work on Windows - if (WIN32) - list(REMOVE_ITEM gtest_sources Converter_TEST.cc) - list(REMOVE_ITEM gtest_sources FrameSemantics_TEST.cc) - list(REMOVE_ITEM gtest_sources ParamPassing_TEST.cc) - list(REMOVE_ITEM gtest_sources Utils_TEST.cc) - list(REMOVE_ITEM gtest_sources XmlUtils_TEST.cc) - list(REMOVE_ITEM gtest_sources parser_urdf_TEST.cc) - endif() - - gz_build_tests( - TYPE UNIT - SOURCES ${gtest_sources} - INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/test +gz_create_core_library(SOURCES ${sources} + CXX_STANDARD 17 + LEGACY_PROJECT_PREFIX SDFormat ) - if (TARGET UNIT_Converter_TEST) - target_link_libraries(UNIT_Converter_TEST - TINYXML2::TINYXML2) - target_sources(UNIT_Converter_TEST PRIVATE - Converter.cc - EmbeddedSdf.cc - Utils.cc - XmlUtils.cc) +target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} + PUBLIC + gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER} + gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} + PRIVATE + TINYXML2::TINYXML2) + + if (USE_INTERNAL_URDF) + target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/urdf) + if (WIN32) + target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE -D_USE_MATH_DEFINES) + endif() + else() + target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE + GzURDFDOM::GzURDFDOM) endif() - if (TARGET UNIT_gz_TEST) - target_compile_definitions(UNIT_gz_TEST PRIVATE - -DGZ_PATH="${GZ_PROGRAM}" - -DDETAIL_GZ_CONFIG_PATH="${CMAKE_BINARY_DIR}/test/conf/$" - -DGZ_TEST_LIBRARY_PATH="${PROJECT_BINARY_DIR}/src") - endif() +if (WIN32 AND USE_INTERNAL_URDF) + target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE URDFDOM_STATIC) +endif() + +target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) - if (TARGET UNIT_FrameSemantics_TEST) - target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc) - target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2) +if (BUILD_TESTING) + # Build this test file only if Gazebo Tools is installed. + if (NOT GZ_PROGRAM) + list(REMOVE_ITEM gtest_sources gz_TEST.cc) endif() - if (TARGET UNIT_ParamPassing_TEST) - target_link_libraries(UNIT_ParamPassing_TEST - TINYXML2::TINYXML2 - using_parser_urdf) - target_sources(UNIT_ParamPassing_TEST PRIVATE + add_library(library_for_tests OBJECT Converter.cc EmbeddedSdf.cc FrameSemantics.cc @@ -86,51 +66,47 @@ if (BUILD_TESTING) Utils.cc XmlUtils.cc parser.cc - parser_urdf.cc) - endif() + parser_urdf.cc + ) - if (TARGET UNIT_Utils_TEST) - target_sources(UNIT_Utils_TEST PRIVATE Utils.cc) - target_link_libraries(UNIT_Utils_TEST TINYXML2::TINYXML2) + if (USE_INTERNAL_URDF) + target_sources(library_for_tests PRIVATE ${urdf_internal_sources}) endif() - if (TARGET UNIT_XmlUtils_TEST) - target_link_libraries(UNIT_XmlUtils_TEST - TINYXML2::TINYXML2) - target_sources(UNIT_XmlUtils_TEST PRIVATE XmlUtils.cc) - endif() + # Link against the publicly and privately linked libraries of the core library + target_link_libraries(library_for_tests + $ + ) - if (TARGET UNIT_parser_urdf_TEST) - target_link_libraries(UNIT_parser_urdf_TEST - TINYXML2::TINYXML2 - using_parser_urdf) - target_sources(UNIT_parser_urdf_TEST PRIVATE - SDFExtension.cc - XmlUtils.cc - parser_urdf.cc) - endif() -endif() + # Use the include flags from the core library + target_include_directories(library_for_tests PUBLIC + $ + ) -gz_create_core_library(SOURCES ${sources} - CXX_STANDARD 17 - LEGACY_PROJECT_PREFIX SDFormat + # Use the private compile flags from the core library. Also set GZ_SDFORMAT_STATIC_DEFINE to avoid + # inconsistent linkage issues on windows. Setting the define will cause the SDFORMAT_VISIBLE/SDFORMAT_HIDDEN macros + # to expand to nothing when building a static library + target_compile_definitions(library_for_tests PUBLIC + $ + -DGZ_SDFORMAT_STATIC_DEFINE ) -target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} - PUBLIC - gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER} - gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} - PRIVATE - TINYXML2::TINYXML2 - using_parser_urdf) + gz_build_tests( + TYPE UNIT + SOURCES ${gtest_sources} + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/test + LIB_DEPS + library_for_tests + ) -if (WIN32) - target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE URDFDOM_STATIC) + if (TARGET UNIT_gz_TEST) + target_compile_definitions(UNIT_gz_TEST PRIVATE + -DGZ_PATH="${GZ_PROGRAM}" + -DDETAIL_GZ_CONFIG_PATH="${CMAKE_BINARY_DIR}/test/conf/$" + -DGZ_TEST_LIBRARY_PATH="${PROJECT_BINARY_DIR}/src") + endif() endif() -target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - add_subdirectory(cmd) diff --git a/src/ParamPassing_TEST.cc b/src/ParamPassing_TEST.cc index 00f9ff48a..16f24c208 100644 --- a/src/ParamPassing_TEST.cc +++ b/src/ParamPassing_TEST.cc @@ -101,6 +101,15 @@ TEST(ParamPassing, GetElementByNameWarningOutput) sdf::testing::RedirectConsoleStream redir( sdf::Console::Instance()->GetMsgStream(), &buffer); + #ifdef _WIN32 + sdf::Console::Instance()->SetQuiet(false); + sdf::testing::ScopeExit revertSetQuiet( + [] + { + sdf::Console::Instance()->SetQuiet(true); + }); + #endif + std::ostringstream stream; stream << "" << "" @@ -149,7 +158,7 @@ TEST(ParamPassing, GetElementByNameWarningOutput) EXPECT_NE(std::string::npos, buffer.str().find( "The original element [model] contains the attribute 'name' but none " "was provided in the element modifier. The assumed element to be " - "modified is: ")); + "modified is: ")) << buffer.str(); } //////////////////////////////////////// @@ -160,6 +169,15 @@ TEST(ParamPassing, ModifyChildrenNameWarningOutput) sdf::testing::RedirectConsoleStream redir( sdf::Console::Instance()->GetMsgStream(), &buffer); + #ifdef _WIN32 + sdf::Console::Instance()->SetQuiet(false); + sdf::testing::ScopeExit revertSetQuiet( + [] + { + sdf::Console::Instance()->SetQuiet(true); + }); + #endif + std::ostringstream stream; stream << "" << "" @@ -212,5 +230,5 @@ TEST(ParamPassing, ModifyChildrenNameWarningOutput) EXPECT_NE(std::string::npos, buffer.str().find( "No modifications for element \n provided, " "skipping modification for:\n\n" - " \n")); + " \n")) << buffer.str(); }