Skip to content

Commit 46757c8

Browse files
authored
Merge pull request #1357 from azeey/12_to_13
Merge sdf12 ➡️ sdf13
2 parents a20cf95 + edd5d0b commit 46757c8

File tree

5 files changed

+140
-97
lines changed

5 files changed

+140
-97
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
name: Ubuntu
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'sdf[0-9]?'
8+
- 'main'
49

510
jobs:
611
focal-ci:
712
runs-on: ubuntu-latest
813
name: Ubuntu Focal CI
914
steps:
1015
- name: Checkout
11-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1217
- name: Compile and test
1318
id: ci
1419
uses: gazebo-tooling/action-gz-ci@focal

.github/workflows/triage.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ jobs:
1414
with:
1515
project-url: https://github.com/orgs/gazebosim/projects/7
1616
github-token: ${{ secrets.TRIAGE_TOKEN }}
17-

Changelog.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,30 @@
462462

463463
## libsdformat 12.X
464464

465+
### libsdformat 12.7.2 (2023-09-01)
466+
467+
1. Fixed 1.9/light.sdf
468+
* [Pull request #1281](https://github.com/gazebosim/sdformat/pull/1281)
469+
470+
1. URDF->SDF handle links with no inertia or small mass
471+
* [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238)
472+
473+
1. Fix Element::Set method return value
474+
* [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256)
475+
476+
1. Add missing values in Surace ToElement method
477+
* [Pull request #1263](https://github.com/gazebosim/sdformat/pull/1263)
478+
479+
1. Rename COPYING to LICENSE
480+
* [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252)
481+
482+
1. Infrastructure
483+
* [Pull request #1245](https://github.com/gazebosim/sdformat/pull/1245)
484+
* [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271)
485+
486+
1. Allow relative paths in URDF
487+
* [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213)
488+
465489
### libsdformat 12.7.1 (2023-02-28)
466490

467491
1. Fix camera info topic default value
@@ -1539,6 +1563,27 @@
15391563

15401564
## libsdformat 9.X
15411565

1566+
### libsdformat 9.10.1 (2024-01-05)
1567+
1568+
1. URDF->SDF handle links with no inertia or small mass
1569+
* [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238)
1570+
1571+
1. Fix Element::Set method return value
1572+
* [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256)
1573+
1574+
1. Allowing relative paths in URDF
1575+
* [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213)
1576+
1577+
1. Use `File.exist?` for Ruby 3.2 compatibility
1578+
* [Pull request #1216](https://github.com/gazebosim/sdformat/pull/1216)
1579+
1580+
1. Infrastructure
1581+
* [Pull request #1217](https://github.com/gazebosim/sdformat/pull/1217)
1582+
* [Pull request #1225](https://github.com/gazebosim/sdformat/pull/1225)
1583+
* [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271)
1584+
* [Pull request #1345](https://github.com/gazebosim/sdformat/pull/1345)
1585+
* [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252)
1586+
15421587
### libsdformat 9.10.0 (2022-11-30)
15431588

15441589
1. Ign to gz header migration.

src/CMakeLists.txt

Lines changed: 68 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ gz_get_libsources_and_unittests(sources gtest_sources)
55
# Add the source file auto-generated into the build folder from sdf/CMakeLists.txt
66
list(APPEND sources EmbeddedSdf.cc)
77

8-
# Use interface library to deduplicate cmake logic for URDF linking
9-
add_library(using_parser_urdf INTERFACE)
8+
# When using the internal URDF parser, we build its sources with the core library
109
if (USE_INTERNAL_URDF)
11-
set(sources ${sources}
10+
set(urdf_internal_sources
1211
urdf/urdf_parser/model.cpp
1312
urdf/urdf_parser/link.cpp
1413
urdf/urdf_parser/joint.cpp
@@ -17,67 +16,48 @@ if (USE_INTERNAL_URDF)
1716
urdf/urdf_parser/urdf_model_state.cpp
1817
urdf/urdf_parser/urdf_sensor.cpp
1918
urdf/urdf_parser/world.cpp)
20-
target_include_directories(using_parser_urdf INTERFACE
21-
${CMAKE_CURRENT_SOURCE_DIR}/urdf)
22-
if (WIN32)
23-
target_compile_definitions(using_parser_urdf INTERFACE -D_USE_MATH_DEFINES)
24-
endif()
25-
else()
26-
target_link_libraries(using_parser_urdf INTERFACE
27-
GzURDFDOM::GzURDFDOM)
19+
set(sources ${sources} ${urdf_internal_sources})
2820
endif()
2921

30-
if (BUILD_TESTING)
31-
# Build this test file only if Gazebo Tools is installed.
32-
if (NOT GZ_PROGRAM)
33-
list(REMOVE_ITEM gtest_sources gz_TEST.cc)
34-
endif()
35-
36-
# Skip tests that don't work on Windows
37-
if (WIN32)
38-
list(REMOVE_ITEM gtest_sources Converter_TEST.cc)
39-
list(REMOVE_ITEM gtest_sources FrameSemantics_TEST.cc)
40-
list(REMOVE_ITEM gtest_sources ParamPassing_TEST.cc)
41-
list(REMOVE_ITEM gtest_sources Utils_TEST.cc)
42-
list(REMOVE_ITEM gtest_sources XmlUtils_TEST.cc)
43-
list(REMOVE_ITEM gtest_sources parser_urdf_TEST.cc)
44-
endif()
45-
46-
gz_build_tests(
47-
TYPE UNIT
48-
SOURCES ${gtest_sources}
49-
INCLUDE_DIRS
50-
${CMAKE_CURRENT_SOURCE_DIR}
51-
${PROJECT_SOURCE_DIR}/test
22+
gz_create_core_library(SOURCES ${sources}
23+
CXX_STANDARD 17
24+
LEGACY_PROJECT_PREFIX SDFormat
5225
)
5326

54-
if (TARGET UNIT_Converter_TEST)
55-
target_link_libraries(UNIT_Converter_TEST
56-
TINYXML2::TINYXML2)
57-
target_sources(UNIT_Converter_TEST PRIVATE
58-
Converter.cc
59-
EmbeddedSdf.cc
60-
Utils.cc
61-
XmlUtils.cc)
27+
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
28+
PUBLIC
29+
gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER}
30+
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
31+
PRIVATE
32+
TINYXML2::TINYXML2)
33+
34+
if (USE_INTERNAL_URDF)
35+
target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE
36+
${CMAKE_CURRENT_SOURCE_DIR}/urdf)
37+
if (WIN32)
38+
target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE -D_USE_MATH_DEFINES)
39+
endif()
40+
else()
41+
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE
42+
GzURDFDOM::GzURDFDOM)
6243
endif()
6344

64-
if (TARGET UNIT_gz_TEST)
65-
target_compile_definitions(UNIT_gz_TEST PRIVATE
66-
-DGZ_PATH="${GZ_PROGRAM}"
67-
-DDETAIL_GZ_CONFIG_PATH="${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>"
68-
-DGZ_TEST_LIBRARY_PATH="${PROJECT_BINARY_DIR}/src")
69-
endif()
45+
if (WIN32 AND USE_INTERNAL_URDF)
46+
target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE URDFDOM_STATIC)
47+
endif()
48+
49+
target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
50+
PRIVATE
51+
${CMAKE_CURRENT_SOURCE_DIR}
52+
)
7053

71-
if (TARGET UNIT_FrameSemantics_TEST)
72-
target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc)
73-
target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2)
54+
if (BUILD_TESTING)
55+
# Build this test file only if Gazebo Tools is installed.
56+
if (NOT GZ_PROGRAM)
57+
list(REMOVE_ITEM gtest_sources gz_TEST.cc)
7458
endif()
7559

76-
if (TARGET UNIT_ParamPassing_TEST)
77-
target_link_libraries(UNIT_ParamPassing_TEST
78-
TINYXML2::TINYXML2
79-
using_parser_urdf)
80-
target_sources(UNIT_ParamPassing_TEST PRIVATE
60+
add_library(library_for_tests OBJECT
8161
Converter.cc
8262
EmbeddedSdf.cc
8363
FrameSemantics.cc
@@ -86,51 +66,47 @@ if (BUILD_TESTING)
8666
Utils.cc
8767
XmlUtils.cc
8868
parser.cc
89-
parser_urdf.cc)
90-
endif()
69+
parser_urdf.cc
70+
)
9171

92-
if (TARGET UNIT_Utils_TEST)
93-
target_sources(UNIT_Utils_TEST PRIVATE Utils.cc)
94-
target_link_libraries(UNIT_Utils_TEST TINYXML2::TINYXML2)
72+
if (USE_INTERNAL_URDF)
73+
target_sources(library_for_tests PRIVATE ${urdf_internal_sources})
9574
endif()
9675

97-
if (TARGET UNIT_XmlUtils_TEST)
98-
target_link_libraries(UNIT_XmlUtils_TEST
99-
TINYXML2::TINYXML2)
100-
target_sources(UNIT_XmlUtils_TEST PRIVATE XmlUtils.cc)
101-
endif()
76+
# Link against the publicly and privately linked libraries of the core library
77+
target_link_libraries(library_for_tests
78+
$<TARGET_PROPERTY:${PROJECT_LIBRARY_TARGET_NAME},LINK_LIBRARIES>
79+
)
10280

103-
if (TARGET UNIT_parser_urdf_TEST)
104-
target_link_libraries(UNIT_parser_urdf_TEST
105-
TINYXML2::TINYXML2
106-
using_parser_urdf)
107-
target_sources(UNIT_parser_urdf_TEST PRIVATE
108-
SDFExtension.cc
109-
XmlUtils.cc
110-
parser_urdf.cc)
111-
endif()
112-
endif()
81+
# Use the include flags from the core library
82+
target_include_directories(library_for_tests PUBLIC
83+
$<TARGET_PROPERTY:${PROJECT_LIBRARY_TARGET_NAME},INCLUDE_DIRECTORIES>
84+
)
11385

114-
gz_create_core_library(SOURCES ${sources}
115-
CXX_STANDARD 17
116-
LEGACY_PROJECT_PREFIX SDFormat
86+
# Use the private compile flags from the core library. Also set GZ_SDFORMAT_STATIC_DEFINE to avoid
87+
# inconsistent linkage issues on windows. Setting the define will cause the SDFORMAT_VISIBLE/SDFORMAT_HIDDEN macros
88+
# to expand to nothing when building a static library
89+
target_compile_definitions(library_for_tests PUBLIC
90+
$<TARGET_PROPERTY:${PROJECT_LIBRARY_TARGET_NAME},COMPILE_DEFINITIONS>
91+
-DGZ_SDFORMAT_STATIC_DEFINE
11792
)
11893

119-
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
120-
PUBLIC
121-
gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER}
122-
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
123-
PRIVATE
124-
TINYXML2::TINYXML2
125-
using_parser_urdf)
94+
gz_build_tests(
95+
TYPE UNIT
96+
SOURCES ${gtest_sources}
97+
INCLUDE_DIRS
98+
${CMAKE_CURRENT_SOURCE_DIR}
99+
${PROJECT_SOURCE_DIR}/test
100+
LIB_DEPS
101+
library_for_tests
102+
)
126103

127-
if (WIN32)
128-
target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE URDFDOM_STATIC)
104+
if (TARGET UNIT_gz_TEST)
105+
target_compile_definitions(UNIT_gz_TEST PRIVATE
106+
-DGZ_PATH="${GZ_PROGRAM}"
107+
-DDETAIL_GZ_CONFIG_PATH="${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>"
108+
-DGZ_TEST_LIBRARY_PATH="${PROJECT_BINARY_DIR}/src")
109+
endif()
129110
endif()
130111

131-
target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
132-
PRIVATE
133-
${CMAKE_CURRENT_SOURCE_DIR}
134-
)
135-
136112
add_subdirectory(cmd)

src/ParamPassing_TEST.cc

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ TEST(ParamPassing, GetElementByNameWarningOutput)
101101
sdf::testing::RedirectConsoleStream redir(
102102
sdf::Console::Instance()->GetMsgStream(), &buffer);
103103

104+
#ifdef _WIN32
105+
sdf::Console::Instance()->SetQuiet(false);
106+
sdf::testing::ScopeExit revertSetQuiet(
107+
[]
108+
{
109+
sdf::Console::Instance()->SetQuiet(true);
110+
});
111+
#endif
112+
104113
std::ostringstream stream;
105114
stream << "<?xml version=\"1.0\"?>"
106115
<< "<sdf version='1.8'>"
@@ -149,7 +158,7 @@ TEST(ParamPassing, GetElementByNameWarningOutput)
149158
EXPECT_NE(std::string::npos, buffer.str().find(
150159
"The original element [model] contains the attribute 'name' but none "
151160
"was provided in the element modifier. The assumed element to be "
152-
"modified is: <model name='test_model'>"));
161+
"modified is: <model name='test_model'>")) << buffer.str();
153162
}
154163

155164
////////////////////////////////////////
@@ -160,6 +169,15 @@ TEST(ParamPassing, ModifyChildrenNameWarningOutput)
160169
sdf::testing::RedirectConsoleStream redir(
161170
sdf::Console::Instance()->GetMsgStream(), &buffer);
162171

172+
#ifdef _WIN32
173+
sdf::Console::Instance()->SetQuiet(false);
174+
sdf::testing::ScopeExit revertSetQuiet(
175+
[]
176+
{
177+
sdf::Console::Instance()->SetQuiet(true);
178+
});
179+
#endif
180+
163181
std::ostringstream stream;
164182
stream << "<?xml version=\"1.0\"?>"
165183
<< "<sdf version='1.8'>"
@@ -212,5 +230,5 @@ TEST(ParamPassing, ModifyChildrenNameWarningOutput)
212230
EXPECT_NE(std::string::npos, buffer.str().find(
213231
"No modifications for element <model name=\"test\"/>\n provided, "
214232
"skipping modification for:\n<sdf version=\"1.8\">\n"
215-
" <model name=\"test\"/>\n</sdf>"));
233+
" <model name=\"test\"/>\n</sdf>")) << buffer.str();
216234
}

0 commit comments

Comments
 (0)