Skip to content

Commit e7d7cef

Browse files
authored
Merge pull request #1359 from gazebosim/13_to_14
Merge 13 ➡️ 14
2 parents 4726a53 + c3960a5 commit e7d7cef

29 files changed

+757
-279
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
jammy-ci:
712
runs-on: ubuntu-latest
813
name: Ubuntu Jammy 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@jammy

.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-

BUILD.bazel

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
load(
2+
"@gz//bazel/skylark:build_defs.bzl",
3+
"GZ_FEATURES",
4+
"GZ_ROOT",
5+
"GZ_VISIBILITY",
6+
"add_lint_tests",
7+
"gz_configure_file",
8+
"gz_configure_header",
9+
"gz_export_header",
10+
"gz_include_header",
11+
"gz_py_binary",
12+
)
13+
14+
package(
15+
default_visibility = GZ_VISIBILITY,
16+
features = GZ_FEATURES,
17+
)
18+
19+
licenses(["notice"])
20+
21+
exports_files(["LICENSE"])
22+
23+
gz_configure_header(
24+
name = "config",
25+
src = "include/sdf/config.hh.in",
26+
cmakelists = ["CMakeLists.txt"],
27+
defines = {
28+
"CMAKE_INSTALL_FULL_DATAROOTDIR": "unused",
29+
},
30+
package = "sdformat",
31+
)
32+
33+
gz_py_binary(
34+
name = "embed_sdf",
35+
srcs = ["sdf/embedSdf.py"],
36+
main = "sdf/embedSdf.py",
37+
)
38+
39+
genrule(
40+
name = "embed_sdf_genrule",
41+
srcs = glob([
42+
"sdf/**/*.sdf",
43+
"sdf/**/*.convert",
44+
]),
45+
outs = ["EmbeddedSdf.cc"],
46+
cmd = "$(execpath :embed_sdf) --output-file $@ --sdf-root sdformat/sdf/ --input-files $(SRCS)", # noqa
47+
tools = [":embed_sdf"],
48+
)
49+
50+
public_headers_no_gen = glob([
51+
"include/sdf/*.h",
52+
"include/sdf/*.hh",
53+
])
54+
55+
private_headers = glob(["src/*.hh"])
56+
57+
sources = glob(
58+
["src/*.cc"],
59+
exclude = [
60+
"src/*_TEST.cc",
61+
"src/gz.cc",
62+
],
63+
)
64+
65+
gz_export_header(
66+
name = "include/sdf/Export.hh",
67+
export_base = "GZ_SDFORMAT",
68+
lib_name = "sdf",
69+
visibility = ["//visibility:private"],
70+
)
71+
72+
gz_include_header(
73+
name = "sdformat_hh_genrule",
74+
out = "include/sdformat.hh",
75+
hdrs = public_headers_no_gen + [
76+
"include/sdf/config.hh",
77+
"include/sdf/Export.hh",
78+
],
79+
)
80+
81+
public_headers = public_headers_no_gen + [
82+
"include/sdf/Export.hh",
83+
"include/sdf/config.hh",
84+
"include/sdformat.hh",
85+
]
86+
87+
cc_library(
88+
name = "urdf",
89+
srcs = [
90+
"src/urdf/urdf_parser/joint.cpp",
91+
"src/urdf/urdf_parser/link.cpp",
92+
"src/urdf/urdf_parser/model.cpp",
93+
"src/urdf/urdf_parser/pose.cpp",
94+
"src/urdf/urdf_parser/twist.cpp",
95+
"src/urdf/urdf_parser/urdf_model_state.cpp",
96+
"src/urdf/urdf_parser/urdf_sensor.cpp",
97+
"src/urdf/urdf_parser/world.cpp",
98+
],
99+
hdrs = glob(
100+
["src/urdf/**/*.h"],
101+
),
102+
copts = ["-Wno-unknown-pragmas"],
103+
includes = ["src/urdf"],
104+
deps = [
105+
"@tinyxml2",
106+
],
107+
)
108+
109+
cc_library(
110+
name = "sdformat",
111+
srcs = sources + private_headers + ["EmbeddedSdf.cc"],
112+
hdrs = public_headers,
113+
defines = [
114+
'SDF_SHARE_PATH=\\".\\"',
115+
'SDF_VERSION_PATH=\\"sdformat\\"',
116+
],
117+
includes = [
118+
"include",
119+
"src",
120+
],
121+
deps = [
122+
":urdf",
123+
GZ_ROOT + "math",
124+
GZ_ROOT + "utils",
125+
"@tinyxml2",
126+
],
127+
)
128+
129+
cc_library(
130+
name = "sdformat_internal",
131+
srcs = [
132+
"src/gz.cc",
133+
"src/gz.hh",
134+
],
135+
visibility = ["//visibility:private"],
136+
deps = [":sdformat"],
137+
)
138+
139+
test_sources = glob(
140+
["src/*_TEST.cc"],
141+
exclude = ["src/gz_TEST.cc"],
142+
)
143+
144+
[cc_test(
145+
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
146+
srcs = [src],
147+
data = [
148+
"sdf",
149+
GZ_ROOT + "sdformat/test:integration",
150+
GZ_ROOT + "sdformat/test:sdf",
151+
],
152+
env = {
153+
"GZ_BAZEL": "1",
154+
"GZ_BAZEL_PATH": "sdformat",
155+
},
156+
deps = [
157+
":sdformat",
158+
GZ_ROOT + "sdformat/test:test_utils",
159+
"@gtest",
160+
"@gtest//:gtest_main",
161+
],
162+
) for src in test_sources]
163+
164+
gz_configure_file(
165+
name = "sdformat.rb",
166+
src = "src/cmd/cmdsdformat.rb.in",
167+
out = "cmdsdformat.rb",
168+
cmakelists = ["CMakeLists.txt"],
169+
defines = [
170+
"library_location=libgz-sdformat.so",
171+
],
172+
package = "sdformat",
173+
visibility = [GZ_ROOT + "tools:__pkg__"],
174+
)
175+
176+
gz_configure_file(
177+
name = "sdformat_yaml",
178+
src = "conf/sdformat.yaml.in",
179+
out = "sdformat.yaml",
180+
cmakelists = ["CMakeLists.txt"],
181+
defines = [
182+
"gz_library_path=gz/sdformat/cmdsdformat.rb",
183+
],
184+
package = "sdformat",
185+
visibility = [GZ_ROOT + "tools:__pkg__"],
186+
)
187+
188+
cc_binary(
189+
name = "libgz-sdformat.so",
190+
srcs = [":sdformat_internal"],
191+
linkshared = True,
192+
visibility = [GZ_ROOT + "tools:__pkg__"],
193+
deps = [
194+
":sdformat",
195+
],
196+
)
197+
198+
exports_files(["sdf"])
199+
200+
add_lint_tests()

Changelog.md

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

526526
## libsdformat 12.X
527527

528+
### libsdformat 12.7.2 (2023-09-01)
529+
530+
1. Fixed 1.9/light.sdf
531+
* [Pull request #1281](https://github.com/gazebosim/sdformat/pull/1281)
532+
533+
1. URDF->SDF handle links with no inertia or small mass
534+
* [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238)
535+
536+
1. Fix Element::Set method return value
537+
* [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256)
538+
539+
1. Add missing values in Surace ToElement method
540+
* [Pull request #1263](https://github.com/gazebosim/sdformat/pull/1263)
541+
542+
1. Rename COPYING to LICENSE
543+
* [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252)
544+
545+
1. Infrastructure
546+
* [Pull request #1245](https://github.com/gazebosim/sdformat/pull/1245)
547+
* [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271)
548+
549+
1. Allow relative paths in URDF
550+
* [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213)
551+
528552
### libsdformat 12.7.1 (2023-02-28)
529553

530554
1. Fix camera info topic default value
@@ -1602,6 +1626,27 @@
16021626

16031627
## libsdformat 9.X
16041628

1629+
### libsdformat 9.10.1 (2024-01-05)
1630+
1631+
1. URDF->SDF handle links with no inertia or small mass
1632+
* [Pull request #1238](https://github.com/gazebosim/sdformat/pull/1238)
1633+
1634+
1. Fix Element::Set method return value
1635+
* [Pull request #1256](https://github.com/gazebosim/sdformat/pull/1256)
1636+
1637+
1. Allowing relative paths in URDF
1638+
* [Pull request #1213](https://github.com/gazebosim/sdformat/pull/1213)
1639+
1640+
1. Use `File.exist?` for Ruby 3.2 compatibility
1641+
* [Pull request #1216](https://github.com/gazebosim/sdformat/pull/1216)
1642+
1643+
1. Infrastructure
1644+
* [Pull request #1217](https://github.com/gazebosim/sdformat/pull/1217)
1645+
* [Pull request #1225](https://github.com/gazebosim/sdformat/pull/1225)
1646+
* [Pull request #1271](https://github.com/gazebosim/sdformat/pull/1271)
1647+
* [Pull request #1345](https://github.com/gazebosim/sdformat/pull/1345)
1648+
* [Pull request #1252](https://github.com/gazebosim/sdformat/pull/1252)
1649+
16051650
### libsdformat 9.10.0 (2022-11-30)
16061651

16071652
1. Ign to gz header migration.

conf/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Used only for internal testing.
2-
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}")
2+
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/ruby/gz/cmd${PROJECT_NAME}")
33

44
# Generate a configuration file for internal testing.
55
# Note that the major version of the library is included in the name.
66
# Ex: sdformat0.yaml
77
configure_file(
88
"${PROJECT_NAME_NO_VERSION_LOWER}.yaml.in"
9-
"${CMAKE_BINARY_DIR}/test/conf/${PROJECT_NAME}.yaml" @ONLY)
9+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured" @ONLY)
10+
11+
file(GENERATE
12+
OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>/${PROJECT_NAME}.yaml"
13+
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured")
1014

1115
# Used for the installed version.
1216
set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${PROJECT_NAME}")

include/sdf/Param.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ namespace sdf
8585
: val(_val), precision(_precision) {}
8686
};
8787

88+
// Template deduction guide for ParamVariant
89+
template<typename ParamVariant>
90+
ParamStreamer(const ParamVariant &_val, int _precision)
91+
-> ParamStreamer<ParamVariant>;
92+
8893
template<class T>
8994
std::ostream& operator<<(std::ostream &os, ParamStreamer<T> s)
9095
{

include/sdf/config.hh.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747

4848
#cmakedefine SDFORMAT_DISABLE_CONSOLE_LOGFILE 1
4949

50+
#ifndef SDF_SHARE_PATH
5051
#define SDF_SHARE_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/"
51-
#define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${SDF_MAJOR_VERSION}/${SDF_PKG_VERSION}"
52+
#endif
53+
54+
#ifndef SDF_VERSION_PATH
55+
#define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${PROJECT_VERSION_MAJOR}/${PROJECT_VERSION}"
56+
#endif
5257

5358
#endif // #ifndef SDF_CONFIG_HH_

sdf/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (GZ_PROGRAM)
4040
add_custom_command(
4141
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf
4242
COMMAND
43-
${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf
43+
${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>
4444
${GZ_PROGRAM}
4545
ARGS sdf -d ${desc_ver} > ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf
4646
COMMENT "Generating full description for spec ${desc_ver}"

sdf/embedSdf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ def generate_map_content(paths: List[Path], relative_to: Optional[str] = None) -
161161
for path in paths:
162162
with open(path, "r", encoding="utf8") as input_sdf:
163163
file_content = input_sdf.read()
164-
165164
# Strip relative path if requested
166165
if relative_to is not None:
167-
path = path.relative_to(relative_to)
166+
_, relative_path = str(path).split(relative_to)
167+
path = relative_path
168168
# dir separator is hardcoded to '/' in C++ mapping
169169
posix_path = PurePosixPath(path)
170170
content.append(embed_sdf_content(str(posix_path), file_content))
@@ -203,4 +203,4 @@ def main(args=None) -> int:
203203

204204

205205
if __name__ == "__main__":
206-
sys.exit(main())
206+
sys.exit(main())

0 commit comments

Comments
 (0)