From 68159a77525d3c78825e88c4fb256f130b7fb6fd Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 27 Aug 2024 21:32:34 +0200 Subject: [PATCH 01/16] Fix symbol checking test when compiled with debug symbols (#1474) * Fix symbol checking test The test that checks for prefixed binary symbols was broken when compiled with DebWithRelInfo since it was checking debugging symbols that broke the heuristics used. The commit fixes it doing a couple of actions: - Include the length of the namespace sdf: 3sdf - Check only dynamic symbols being exported Signed-off-by: Jose Luis Rivero * Update test/integration/all_symbols_have_version.bash.in Co-authored-by: Steve Peters Signed-off-by: Jose Luis Rivero --------- Signed-off-by: Jose Luis Rivero Co-authored-by: Steve Peters (cherry picked from commit 904706c2c02c5c333e916717e0a4ea6b3c74947e) --- test/integration/all_symbols_have_version.bash.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/integration/all_symbols_have_version.bash.in b/test/integration/all_symbols_have_version.bash.in index d69a58442..94912d34d 100644 --- a/test/integration/all_symbols_have_version.bash.in +++ b/test/integration/all_symbols_have_version.bash.in @@ -4,7 +4,13 @@ LIBPATH=$1 VERSIONED_NS=v@PROJECT_VERSION_MAJOR@ # Sanity check - there should be at least one symbol -NUM_SYMBOLS=$(nm $LIBPATH | grep -e "sdf" | wc -l) + +# nm options: +# -D to get only dynamic symbols exported +# 3 before the sdf is used by +# mangled symbols in C++ to check for the +# sdf namespace +NUM_SYMBOLS=$(nm -D $LIBPATH | grep -e "3sdf" | wc -l) if [ $NUM_SYMBOLS -eq 0 ] then @@ -13,7 +19,7 @@ then fi # There must be no unversioned symbols -UNVERSIONED_SYMBOLS=$(nm $LIBPATH | grep -e "sdf" | grep -e "$VERSIONED_NS" -v) +UNVERSIONED_SYMBOLS=$(nm -D $LIBPATH | grep -e "3sdf" | grep -e "$VERSIONED_NS" -v) UNVERSIONED_SYMBOL_CHARS=$(printf "$UNVERSIONED_SYMBOLS" | wc -m) if [ $UNVERSIONED_SYMBOL_CHARS -ne 0 ] From 22684cbe9144f9cf15e2df7dfa55457266caca44 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 29 Oct 2024 10:13:07 -0700 Subject: [PATCH 02/16] Improve installation instructions (#1490) * Refer to https://brew.sh instead of duplicating the brew installation command. * List cmake variables in a markdown table. * Combine Ubuntu and macOS installation instructions Signed-off-by: Steve Peters --- README.md | 71 ++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 0b6dfc324..c70b18b9b 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ which version you need, or leave it empty for version 1. ### macOS -On macOS, add OSRF packages: +On macOS, after installing the [Homebrew package manager](https://brew.sh), +add OSRF packages: ```sh - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew tap osrf/simulation ``` @@ -129,6 +129,25 @@ git clone https://github.com/gazebosim/sdformat -b sdf<#> Be sure to replace `<#>` with a number value, such as 14 or 15, depending on which version you need. +### Install dependencies + +#### Ubuntu + +```sh +cd sdformat +sudo apt -y install \ + $(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt' | tr '\n' ' ')) +``` + +#### macOS + +```sh +brew install --only-dependencies sdformat<#> +``` + +Be sure to replace `<#>` with a number value, such as 14 or 15, depending on +which version you need. + ### Build from Source Standard installation can be performed in UNIX systems using the following @@ -144,12 +163,10 @@ make install sdformat supported cmake parameters at configuring time: -* `USE_INTERNAL_URDF` (`bool`) [default `False`]
- Use an internal copy of urdfdom 1.0.0 instead of look for one - installed in the system -* `USE_UPSTREAM_CFLAGS` (`bool`) [default `True`]
- Use the sdformat team compilation flags instead of the common set defined - by cmake. +| Name | Type | Default | Description | +|-----------------------|------|----------|--------------------------------------| +| `USE_INTERNAL_URDF` | BOOL | False | Use an internal copy of urdfdom 1.0.0 instead of looking for one installed in the system | +| `USE_UPSTREAM_CFLAGS` | BOOL | True | Use the sdformat team compilation flags instead of the common set defined by cmake. | ## Uninstallation @@ -160,44 +177,6 @@ cd build make uninstall ``` -## macOS - -### Prerequisites - -Clone the repository -```sh -git clone https://github.com/gazebosim/sdformat -b sdf<#> -``` -Be sure to replace `<#>` with a number value, such as 14 or 15, depending on -which version you need. - -Install dependencies -```sh -brew install --only-dependencies sdformat<#> -``` - -### Build from Source - -1. Configure and build - ```sh - cd sdformat - mkdir build - cd build - cmake .. # Consider specifying -DCMAKE_INSTALL_PREFIX=... - make - ``` - -2. Optionally, install and uninstall - ```sh - sudo make install - ``` - - To uninstall the software installed with the previous steps: - ```sh - cd build/ - sudo make uninstall - ``` - ## Windows ### Prerequisites From bf36eb71974b5309b6903dd0b35a672d137a47e4 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Mon, 4 Nov 2024 15:31:25 -0600 Subject: [PATCH 03/16] Change sdf_config.h to sdf/config.hh everywhere (#1494) Signed-off-by: Michael Carroll --- include/sdf/Actor.hh | 2 +- include/sdf/AirPressure.hh | 2 +- include/sdf/AirSpeed.hh | 2 +- include/sdf/Altimeter.hh | 2 +- include/sdf/Atmosphere.hh | 2 +- include/sdf/Box.hh | 2 +- include/sdf/Camera.hh | 2 +- include/sdf/Capsule.hh | 2 +- include/sdf/Collision.hh | 2 +- include/sdf/Cone.hh | 2 +- include/sdf/Console.hh | 2 +- include/sdf/Cylinder.hh | 2 +- include/sdf/Element.hh | 2 +- include/sdf/Ellipsoid.hh | 2 +- include/sdf/Error.hh | 2 +- include/sdf/Exception.hh | 2 +- include/sdf/Filesystem.hh | 2 +- include/sdf/ForceTorque.hh | 2 +- include/sdf/Frame.hh | 2 +- include/sdf/Geometry.hh | 2 +- include/sdf/Gui.hh | 2 +- include/sdf/Heightmap.hh | 2 +- include/sdf/Imu.hh | 2 +- include/sdf/InstallationDirectories.hh | 2 +- include/sdf/InterfaceElements.hh | 2 +- include/sdf/InterfaceFrame.hh | 2 +- include/sdf/InterfaceJoint.hh | 2 +- include/sdf/InterfaceLink.hh | 2 +- include/sdf/InterfaceModel.hh | 2 +- include/sdf/InterfaceModelPoseGraph.hh | 2 +- include/sdf/Joint.hh | 2 +- include/sdf/JointAxis.hh | 2 +- include/sdf/Lidar.hh | 2 +- include/sdf/Light.hh | 2 +- include/sdf/Link.hh | 2 +- include/sdf/Magnetometer.hh | 2 +- include/sdf/Material.hh | 2 +- include/sdf/Mesh.hh | 2 +- include/sdf/Model.hh | 2 +- include/sdf/NavSat.hh | 2 +- include/sdf/Noise.hh | 2 +- include/sdf/OutputConfig.hh | 2 +- include/sdf/Param.hh | 2 +- include/sdf/ParserConfig.hh | 2 +- include/sdf/ParticleEmitter.hh | 2 +- include/sdf/Pbr.hh | 2 +- include/sdf/Physics.hh | 2 +- include/sdf/Plane.hh | 2 +- include/sdf/Plugin.hh | 2 +- include/sdf/Polyline.hh | 2 +- include/sdf/PrintConfig.hh | 2 +- include/sdf/Projector.hh | 2 +- include/sdf/Root.hh | 2 +- include/sdf/SDFImpl.hh | 2 +- include/sdf/Scene.hh | 2 +- include/sdf/SemanticPose.hh | 2 +- include/sdf/Sensor.hh | 2 +- include/sdf/Sky.hh | 2 +- include/sdf/Sphere.hh | 2 +- include/sdf/Surface.hh | 2 +- include/sdf/Types.hh | 2 +- include/sdf/Visual.hh | 2 +- include/sdf/World.hh | 2 +- include/sdf/parser.hh | 2 +- python/src/sdf/pybind11_helpers.hh | 2 +- src/Console.cc | 2 +- src/Converter.hh | 2 +- src/Error_TEST.cc | 2 +- src/FrameSemantics_TEST.cc | 2 +- src/InstallationDirectories.cc | 2 +- src/ParamPassing.cc | 2 +- src/Root.cc | 2 +- src/Root_TEST.cc | 2 +- src/SDF.cc | 2 +- src/SDFExtension.hh | 2 +- src/ScopedGraph.hh | 2 +- src/Surface.cc | 2 +- src/gz.cc | 2 +- src/gz.hh | 2 +- src/gz_TEST.cc | 2 +- src/parser.cc | 2 +- src/parser_private.hh | 2 +- src/parser_urdf.hh | 2 +- test/integration/frame.cc | 2 +- 84 files changed, 84 insertions(+), 84 deletions(-) diff --git a/include/sdf/Actor.hh b/include/sdf/Actor.hh index 509ae58a9..f3e76ae2c 100644 --- a/include/sdf/Actor.hh +++ b/include/sdf/Actor.hh @@ -28,7 +28,7 @@ #include "sdf/Link.hh" #include "sdf/Joint.hh" #include "sdf/Plugin.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/AirPressure.hh b/include/sdf/AirPressure.hh index 798474dd5..cf94e7d54 100644 --- a/include/sdf/AirPressure.hh +++ b/include/sdf/AirPressure.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/AirSpeed.hh b/include/sdf/AirSpeed.hh index 90a1be025..6fcbb3356 100644 --- a/include/sdf/AirSpeed.hh +++ b/include/sdf/AirSpeed.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Altimeter.hh b/include/sdf/Altimeter.hh index c27a6daf1..4405c326b 100644 --- a/include/sdf/Altimeter.hh +++ b/include/sdf/Altimeter.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Atmosphere.hh b/include/sdf/Atmosphere.hh index ed4042128..e4497be35 100644 --- a/include/sdf/Atmosphere.hh +++ b/include/sdf/Atmosphere.hh @@ -22,7 +22,7 @@ #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" diff --git a/include/sdf/Box.hh b/include/sdf/Box.hh index ae3515f39..10ff8cc1a 100644 --- a/include/sdf/Box.hh +++ b/include/sdf/Box.hh @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Camera.hh b/include/sdf/Camera.hh index bb564c057..71843ebfb 100644 --- a/include/sdf/Camera.hh +++ b/include/sdf/Camera.hh @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Capsule.hh b/include/sdf/Capsule.hh index 97f6dce0b..c385c1216 100644 --- a/include/sdf/Capsule.hh +++ b/include/sdf/Capsule.hh @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Collision.hh b/include/sdf/Collision.hh index 2ab4114ce..e2285a93c 100644 --- a/include/sdf/Collision.hh +++ b/include/sdf/Collision.hh @@ -27,7 +27,7 @@ #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/ParserConfig.hh" diff --git a/include/sdf/Cone.hh b/include/sdf/Cone.hh index 641c5a304..cc935a5e7 100644 --- a/include/sdf/Cone.hh +++ b/include/sdf/Cone.hh @@ -26,7 +26,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Console.hh b/include/sdf/Console.hh index 04856e900..539bb77cc 100644 --- a/include/sdf/Console.hh +++ b/include/sdf/Console.hh @@ -23,7 +23,7 @@ #include #include -#include +#include #include "sdf/system_util.hh" #ifdef _WIN32 diff --git a/include/sdf/Cylinder.hh b/include/sdf/Cylinder.hh index bba37ba24..9ea63c7a9 100644 --- a/include/sdf/Cylinder.hh +++ b/include/sdf/Cylinder.hh @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Element.hh b/include/sdf/Element.hh index 1f04c8a4a..9d7f1f624 100644 --- a/include/sdf/Element.hh +++ b/include/sdf/Element.hh @@ -28,7 +28,7 @@ #include "sdf/Error.hh" #include "sdf/Param.hh" #include "sdf/PrintConfig.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/Types.hh" diff --git a/include/sdf/Ellipsoid.hh b/include/sdf/Ellipsoid.hh index 33a046c2c..b328fcd8a 100644 --- a/include/sdf/Ellipsoid.hh +++ b/include/sdf/Ellipsoid.hh @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Error.hh b/include/sdf/Error.hh index 9664cc850..54cebf951 100644 --- a/include/sdf/Error.hh +++ b/include/sdf/Error.hh @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "sdf/Console.hh" #include "sdf/system_util.hh" diff --git a/include/sdf/Exception.hh b/include/sdf/Exception.hh index 303482017..271a885b1 100644 --- a/include/sdf/Exception.hh +++ b/include/sdf/Exception.hh @@ -25,7 +25,7 @@ #include #include -#include +#include #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Filesystem.hh b/include/sdf/Filesystem.hh index f8b049d6d..b15b683d8 100644 --- a/include/sdf/Filesystem.hh +++ b/include/sdf/Filesystem.hh @@ -22,7 +22,7 @@ #include #include -#include +#include #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/ForceTorque.hh b/include/sdf/ForceTorque.hh index 2a9a693ed..1ce09f5d4 100644 --- a/include/sdf/ForceTorque.hh +++ b/include/sdf/ForceTorque.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Frame.hh b/include/sdf/Frame.hh index cecb63ea9..f1a5e275e 100644 --- a/include/sdf/Frame.hh +++ b/include/sdf/Frame.hh @@ -24,7 +24,7 @@ #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Geometry.hh b/include/sdf/Geometry.hh index 5d75b860d..aec5076d0 100644 --- a/include/sdf/Geometry.hh +++ b/include/sdf/Geometry.hh @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/sdf/Gui.hh b/include/sdf/Gui.hh index 67435fdb0..d3201b1a8 100644 --- a/include/sdf/Gui.hh +++ b/include/sdf/Gui.hh @@ -21,7 +21,7 @@ #include "sdf/Element.hh" #include "sdf/Plugin.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Heightmap.hh b/include/sdf/Heightmap.hh index e4779f64b..364f7b43f 100644 --- a/include/sdf/Heightmap.hh +++ b/include/sdf/Heightmap.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Imu.hh b/include/sdf/Imu.hh index e3ced1181..a339f00d8 100644 --- a/include/sdf/Imu.hh +++ b/include/sdf/Imu.hh @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/InstallationDirectories.hh b/include/sdf/InstallationDirectories.hh index be3b0c678..e58084721 100644 --- a/include/sdf/InstallationDirectories.hh +++ b/include/sdf/InstallationDirectories.hh @@ -20,7 +20,7 @@ #include -#include +#include #include namespace sdf diff --git a/include/sdf/InterfaceElements.hh b/include/sdf/InterfaceElements.hh index aaeb7d614..ae8658394 100644 --- a/include/sdf/InterfaceElements.hh +++ b/include/sdf/InterfaceElements.hh @@ -28,7 +28,7 @@ #include "sdf/InterfaceModel.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/InterfaceFrame.hh b/include/sdf/InterfaceFrame.hh index 932e7c635..564fd8dd3 100644 --- a/include/sdf/InterfaceFrame.hh +++ b/include/sdf/InterfaceFrame.hh @@ -23,7 +23,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/InterfaceJoint.hh b/include/sdf/InterfaceJoint.hh index 92f9460d1..7bd513f5b 100644 --- a/include/sdf/InterfaceJoint.hh +++ b/include/sdf/InterfaceJoint.hh @@ -23,7 +23,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/InterfaceLink.hh b/include/sdf/InterfaceLink.hh index 91bf77217..36736a34e 100644 --- a/include/sdf/InterfaceLink.hh +++ b/include/sdf/InterfaceLink.hh @@ -23,7 +23,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/InterfaceModel.hh b/include/sdf/InterfaceModel.hh index 30c8a6c7a..3205e779d 100644 --- a/include/sdf/InterfaceModel.hh +++ b/include/sdf/InterfaceModel.hh @@ -32,7 +32,7 @@ #include "sdf/InterfaceModelPoseGraph.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/InterfaceModelPoseGraph.hh b/include/sdf/InterfaceModelPoseGraph.hh index fa0d05934..4846aa4e0 100644 --- a/include/sdf/InterfaceModelPoseGraph.hh +++ b/include/sdf/InterfaceModelPoseGraph.hh @@ -27,7 +27,7 @@ #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Joint.hh b/include/sdf/Joint.hh index 596e0a398..b62368160 100644 --- a/include/sdf/Joint.hh +++ b/include/sdf/Joint.hh @@ -24,7 +24,7 @@ #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/JointAxis.hh b/include/sdf/JointAxis.hh index eed7f8169..f0fb8b0a2 100644 --- a/include/sdf/JointAxis.hh +++ b/include/sdf/JointAxis.hh @@ -25,7 +25,7 @@ #include "sdf/Element.hh" #include "sdf/Exception.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Lidar.hh b/include/sdf/Lidar.hh index 89cfa612b..a3c000d8b 100644 --- a/include/sdf/Lidar.hh +++ b/include/sdf/Lidar.hh @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace sdf diff --git a/include/sdf/Light.hh b/include/sdf/Light.hh index fc19e02f1..e97a37b6a 100644 --- a/include/sdf/Light.hh +++ b/include/sdf/Light.hh @@ -26,7 +26,7 @@ #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Link.hh b/include/sdf/Link.hh index dfd02f69c..d692476fb 100644 --- a/include/sdf/Link.hh +++ b/include/sdf/Link.hh @@ -26,7 +26,7 @@ #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/ParserConfig.hh" #include "sdf/Error.hh" diff --git a/include/sdf/Magnetometer.hh b/include/sdf/Magnetometer.hh index 3f6d9ae74..2d83e3954 100644 --- a/include/sdf/Magnetometer.hh +++ b/include/sdf/Magnetometer.hh @@ -21,7 +21,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 6891a8899..e45afaa73 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -21,7 +21,7 @@ #include #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Mesh.hh b/include/sdf/Mesh.hh index c77cb7bff..0ce5c525e 100644 --- a/include/sdf/Mesh.hh +++ b/include/sdf/Mesh.hh @@ -26,7 +26,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 86cc3d422..fd6f5d615 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -29,7 +29,7 @@ #include "sdf/Plugin.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/NavSat.hh b/include/sdf/NavSat.hh index 9b1677d77..13341132e 100644 --- a/include/sdf/NavSat.hh +++ b/include/sdf/NavSat.hh @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include diff --git a/include/sdf/Noise.hh b/include/sdf/Noise.hh index 361e12f7e..c570908c4 100644 --- a/include/sdf/Noise.hh +++ b/include/sdf/Noise.hh @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/OutputConfig.hh b/include/sdf/OutputConfig.hh index 7b51876cb..5beef97e6 100644 --- a/include/sdf/OutputConfig.hh +++ b/include/sdf/OutputConfig.hh @@ -21,7 +21,7 @@ #include #include "sdf/InterfaceElements.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" diff --git a/include/sdf/Param.hh b/include/sdf/Param.hh index d0a952f4c..883df8777 100644 --- a/include/sdf/Param.hh +++ b/include/sdf/Param.hh @@ -42,7 +42,7 @@ #include "sdf/Console.hh" #include "sdf/PrintConfig.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/Types.hh" diff --git a/include/sdf/ParserConfig.hh b/include/sdf/ParserConfig.hh index 9baa677a0..a3741ef6f 100644 --- a/include/sdf/ParserConfig.hh +++ b/include/sdf/ParserConfig.hh @@ -28,7 +28,7 @@ #include "sdf/Error.hh" #include "sdf/InterfaceElements.hh" #include "sdf/CustomInertiaCalcProperties.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" diff --git a/include/sdf/ParticleEmitter.hh b/include/sdf/ParticleEmitter.hh index 0326f34c2..55b5fac2d 100644 --- a/include/sdf/ParticleEmitter.hh +++ b/include/sdf/ParticleEmitter.hh @@ -25,7 +25,7 @@ #include "sdf/Material.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Pbr.hh b/include/sdf/Pbr.hh index 19a238347..c872fbe54 100644 --- a/include/sdf/Pbr.hh +++ b/include/sdf/Pbr.hh @@ -21,7 +21,7 @@ #include #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Physics.hh b/include/sdf/Physics.hh index 0fa5ea5ef..c8b9a0565 100644 --- a/include/sdf/Physics.hh +++ b/include/sdf/Physics.hh @@ -22,7 +22,7 @@ #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Plane.hh b/include/sdf/Plane.hh index b3b3a98a1..913e975b0 100644 --- a/include/sdf/Plane.hh +++ b/include/sdf/Plane.hh @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Plugin.hh b/include/sdf/Plugin.hh index def211593..77804b2c1 100644 --- a/include/sdf/Plugin.hh +++ b/include/sdf/Plugin.hh @@ -25,7 +25,7 @@ #include #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #ifdef _WIN32 diff --git a/include/sdf/Polyline.hh b/include/sdf/Polyline.hh index f16de2c27..461185822 100644 --- a/include/sdf/Polyline.hh +++ b/include/sdf/Polyline.hh @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace sdf { diff --git a/include/sdf/PrintConfig.hh b/include/sdf/PrintConfig.hh index 826dc128e..9a57765d6 100644 --- a/include/sdf/PrintConfig.hh +++ b/include/sdf/PrintConfig.hh @@ -20,7 +20,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/Types.hh" diff --git a/include/sdf/Projector.hh b/include/sdf/Projector.hh index b13fd8797..959d9b292 100644 --- a/include/sdf/Projector.hh +++ b/include/sdf/Projector.hh @@ -27,7 +27,7 @@ #include "sdf/Plugin.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Root.hh b/include/sdf/Root.hh index 9ad5f1632..8a93192bf 100644 --- a/include/sdf/Root.hh +++ b/include/sdf/Root.hh @@ -25,7 +25,7 @@ #include "sdf/ParserConfig.hh" #include "sdf/SDFImpl.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/SDFImpl.hh b/include/sdf/SDFImpl.hh index fb7e96ea0..9fa7d4bac 100644 --- a/include/sdf/SDFImpl.hh +++ b/include/sdf/SDFImpl.hh @@ -26,7 +26,7 @@ #include "sdf/ParserConfig.hh" #include "sdf/PrintConfig.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #ifdef _WIN32 diff --git a/include/sdf/Scene.hh b/include/sdf/Scene.hh index e11f51596..83da62c62 100644 --- a/include/sdf/Scene.hh +++ b/include/sdf/Scene.hh @@ -23,7 +23,7 @@ #include "sdf/Element.hh" #include "sdf/Sky.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/SemanticPose.hh b/include/sdf/SemanticPose.hh index 3280d1e47..8ab81b4ec 100644 --- a/include/sdf/SemanticPose.hh +++ b/include/sdf/SemanticPose.hh @@ -24,7 +24,7 @@ #include #include -#include +#include #include "sdf/system_util.hh" #ifdef _WIN32 diff --git a/include/sdf/Sensor.hh b/include/sdf/Sensor.hh index 49bc336f9..7247fd7ab 100644 --- a/include/sdf/Sensor.hh +++ b/include/sdf/Sensor.hh @@ -25,7 +25,7 @@ #include "sdf/Plugin.hh" #include "sdf/SemanticPose.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index 4475cd0ee..2c998c1df 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -25,7 +25,7 @@ #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Sphere.hh b/include/sdf/Sphere.hh index 05eb072e3..a56f37b16 100644 --- a/include/sdf/Sphere.hh +++ b/include/sdf/Sphere.hh @@ -25,7 +25,7 @@ #include #include -#include +#include namespace sdf { diff --git a/include/sdf/Surface.hh b/include/sdf/Surface.hh index caec7d0cd..f26419ba7 100644 --- a/include/sdf/Surface.hh +++ b/include/sdf/Surface.hh @@ -21,7 +21,7 @@ #include #include "sdf/Element.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/Types.hh b/include/sdf/Types.hh index 26e25cdac..6b8cd60a4 100644 --- a/include/sdf/Types.hh +++ b/include/sdf/Types.hh @@ -26,7 +26,7 @@ #include #include -#include +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "sdf/Error.hh" diff --git a/include/sdf/Visual.hh b/include/sdf/Visual.hh index f8e46a2bf..409ecec20 100644 --- a/include/sdf/Visual.hh +++ b/include/sdf/Visual.hh @@ -31,7 +31,7 @@ #include "sdf/SemanticPose.hh" #include "sdf/Sphere.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/World.hh b/include/sdf/World.hh index 757f4f45d..8e75c19b5 100644 --- a/include/sdf/World.hh +++ b/include/sdf/World.hh @@ -32,7 +32,7 @@ #include "sdf/Plugin.hh" #include "sdf/Scene.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" namespace sdf diff --git a/include/sdf/parser.hh b/include/sdf/parser.hh index a96b484e3..c8f2423ab 100644 --- a/include/sdf/parser.hh +++ b/include/sdf/parser.hh @@ -20,7 +20,7 @@ #include #include "sdf/SDFImpl.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" /// \ingroup sdf_parser diff --git a/python/src/sdf/pybind11_helpers.hh b/python/src/sdf/pybind11_helpers.hh index 3e58d839a..cf2de2ca5 100644 --- a/python/src/sdf/pybind11_helpers.hh +++ b/python/src/sdf/pybind11_helpers.hh @@ -17,7 +17,7 @@ #ifndef SDFORMAT_PYTHON_PYBIND11_HELPERS_HH_ #define SDFORMAT_PYTHON_PYBIND11_HELPERS_HH_ -#include +#include #include diff --git a/src/Console.cc b/src/Console.cc index 558f10d87..c87ff536e 100644 --- a/src/Console.cc +++ b/src/Console.cc @@ -24,7 +24,7 @@ #include "sdf/Console.hh" #include "sdf/Filesystem.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include diff --git a/src/Converter.hh b/src/Converter.hh index cfba5413f..27865a934 100644 --- a/src/Converter.hh +++ b/src/Converter.hh @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include "sdf/system_util.hh" diff --git a/src/Error_TEST.cc b/src/Error_TEST.cc index d8bbc7747..63a127e0d 100644 --- a/src/Error_TEST.cc +++ b/src/Error_TEST.cc @@ -17,7 +17,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/Exception.hh" #include "sdf/Error.hh" #include "test_utils.hh" diff --git a/src/FrameSemantics_TEST.cc b/src/FrameSemantics_TEST.cc index 1bacb5633..22d6f66ac 100644 --- a/src/FrameSemantics_TEST.cc +++ b/src/FrameSemantics_TEST.cc @@ -29,7 +29,7 @@ #include "sdf/SDFImpl.hh" #include "sdf/World.hh" #include "sdf/parser.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "FrameSemantics.hh" #include "ScopedGraph.hh" diff --git a/src/InstallationDirectories.cc b/src/InstallationDirectories.cc index a260a32b4..df73fcac8 100644 --- a/src/InstallationDirectories.cc +++ b/src/InstallationDirectories.cc @@ -18,7 +18,7 @@ #include #include -#include +#include #include namespace sdf diff --git a/src/ParamPassing.cc b/src/ParamPassing.cc index 5bf0c97a9..f30eeb7ea 100644 --- a/src/ParamPassing.cc +++ b/src/ParamPassing.cc @@ -20,7 +20,7 @@ #include "sdf/Filesystem.hh" #include "sdf/parser.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "ParamPassing.hh" #include "parser_private.hh" diff --git a/src/Root.cc b/src/Root.cc index 03349d2af..34e2f2103 100644 --- a/src/Root.cc +++ b/src/Root.cc @@ -27,7 +27,7 @@ #include "sdf/Types.hh" #include "sdf/World.hh" #include "sdf/parser.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "FrameSemantics.hh" #include "ScopedGraph.hh" #include "Utils.hh" diff --git a/src/Root_TEST.cc b/src/Root_TEST.cc index 4bb518ad2..4a06de902 100644 --- a/src/Root_TEST.cc +++ b/src/Root_TEST.cc @@ -17,7 +17,7 @@ #include #include "sdf/Actor.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/Collision.hh" #include "sdf/Error.hh" #include "sdf/Link.hh" diff --git a/src/SDF.cc b/src/SDF.cc index d9fa57dbd..04fc53748 100644 --- a/src/SDF.cc +++ b/src/SDF.cc @@ -32,7 +32,7 @@ #include "sdf/InstallationDirectories.hh" #include "sdf/SDFImpl.hh" #include "SDFImplPrivate.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "EmbeddedSdf.hh" #include "Utils.hh" diff --git a/src/SDFExtension.hh b/src/SDFExtension.hh index 8fe3ac762..b3a3eb1e4 100644 --- a/src/SDFExtension.hh +++ b/src/SDFExtension.hh @@ -26,7 +26,7 @@ #include -#include +#include #include "sdf/Types.hh" namespace sdf diff --git a/src/ScopedGraph.hh b/src/ScopedGraph.hh index 3f4c2ab3c..41739f179 100644 --- a/src/ScopedGraph.hh +++ b/src/ScopedGraph.hh @@ -27,7 +27,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" namespace sdf { diff --git a/src/Surface.cc b/src/Surface.cc index 0d10e4e9e..a0343ecf5 100644 --- a/src/Surface.cc +++ b/src/Surface.cc @@ -22,7 +22,7 @@ #include "sdf/parser.hh" #include "sdf/Surface.hh" #include "sdf/Types.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" #include "Utils.hh" diff --git a/src/gz.cc b/src/gz.cc index 5b79685e4..54b4794d1 100644 --- a/src/gz.cc +++ b/src/gz.cc @@ -22,7 +22,7 @@ #include #include -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/Filesystem.hh" #include "sdf/Link.hh" #include "sdf/Model.hh" diff --git a/src/gz.hh b/src/gz.hh index e588721ef..6f3dbd2c6 100644 --- a/src/gz.hh +++ b/src/gz.hh @@ -20,7 +20,7 @@ #include -#include +#include #include "sdf/system_util.hh" // Inline bracket to help doxygen filtering. diff --git a/src/gz_TEST.cc b/src/gz_TEST.cc index d58121345..dc54a45d2 100644 --- a/src/gz_TEST.cc +++ b/src/gz_TEST.cc @@ -28,7 +28,7 @@ #include "sdf/Filesystem.hh" #include "sdf/parser.hh" #include "sdf/SDFImpl.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "test_config.hh" #include "test_utils.hh" diff --git a/src/parser.cc b/src/parser.cc index fea9f1ff6..6a39a9194 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -37,7 +37,7 @@ #include "sdf/World.hh" #include "sdf/parser.hh" #include "sdf/ParserConfig.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "Converter.hh" #include "FrameSemantics.hh" diff --git a/src/parser_private.hh b/src/parser_private.hh index 031f6aa51..5ced75389 100644 --- a/src/parser_private.hh +++ b/src/parser_private.hh @@ -22,7 +22,7 @@ #include #include "sdf/SDFImpl.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "sdf/system_util.hh" /// \ingroup sdf_parser diff --git a/src/parser_urdf.hh b/src/parser_urdf.hh index e3e2d3614..d45ada77c 100644 --- a/src/parser_urdf.hh +++ b/src/parser_urdf.hh @@ -18,7 +18,7 @@ #define SDFORMAT_URDF2SDF_HH_ #include -#include +#include #include diff --git a/test/integration/frame.cc b/test/integration/frame.cc index b080ae5d5..8590c0d14 100644 --- a/test/integration/frame.cc +++ b/test/integration/frame.cc @@ -30,7 +30,7 @@ #include "sdf/SDFImpl.hh" #include "sdf/World.hh" #include "sdf/parser.hh" -#include "sdf/sdf_config.h" +#include "sdf/config.hh" #include "test_config.hh" From 3dcdd55ee7a3ab0ac77b5cce56ba9629b79a70ac Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 5 Nov 2024 13:24:22 -0800 Subject: [PATCH 04/16] Permit building python bindings separately from libsdformat library (#1491) This allows the src/python_pybind11/CMakeLists.txt file to be built as a top-level cmake project against an external sdformat library, with documentation added to the README. The logic for finding pybind11 is also moved from the root CMakeLists.txt to python/CMakeLists.txt to reduce code duplication. When invoked through the root CMakeLists.txt, pybind11 is treated as an optional dependency, but when invoked from the python folder, pybind11 is treated as required by setting the variable CMAKE_REQUIRE_FIND_PACKAGE_pybind11 to TRUE. Signed-off-by: Steve Peters Signed-off-by: Silvio Traversaro Co-authored-by: Silvio Traversaro --- CMakeLists.txt | 12 +----------- README.md | 23 +++++++++++++++++++++++ python/CMakeLists.txt | 27 +++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1eed1eaa..3d4907834 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,16 +97,6 @@ if (BUILD_SDF) ) if (NOT Python3_Development_FOUND) GZ_BUILD_WARNING("Python development libraries are missing: Python interfaces are disabled.") - else() - set(PYBIND11_PYTHON_VERSION 3) - find_package(pybind11 2.4 CONFIG QUIET) - - if (pybind11_FOUND) - message (STATUS "Searching for pybind11 - found version ${pybind11_VERSION}.") - else() - GZ_BUILD_WARNING("pybind11 is missing: Python interfaces are disabled.") - message (STATUS "Searching for pybind11 - not found.") - endif() endif() endif() @@ -159,7 +149,7 @@ if (BUILD_SDF) add_subdirectory(sdf) add_subdirectory(conf) add_subdirectory(doc) - if (pybind11_FOUND AND NOT SKIP_PYBIND11) + if (Python3_Development_FOUND AND NOT SKIP_PYBIND11) add_subdirectory(python) endif() endif(BUILD_SDF) diff --git a/README.md b/README.md index c70b18b9b..e157f9a05 100644 --- a/README.md +++ b/README.md @@ -165,9 +165,32 @@ sdformat supported cmake parameters at configuring time: | Name | Type | Default | Description | |-----------------------|------|----------|--------------------------------------| +| `SKIP_PYBIND11` | BOOL | False | Skip generating Python bindings via pybind11 | | `USE_INTERNAL_URDF` | BOOL | False | Use an internal copy of urdfdom 1.0.0 instead of looking for one installed in the system | | `USE_UPSTREAM_CFLAGS` | BOOL | True | Use the sdformat team compilation flags instead of the common set defined by cmake. | +### Build python bindings separately from main library + +If you want to build Python bindings separately from the main libsdformat library +(for example if you want to build Python bindings for multiple versions of Python), +you can invoke cmake on the `python` folder instead of the root folder. +Specify the path to the python executable with which you wish to build bindings +in the `Python3_EXECUTABLE` cmake variable. +Specify the install path for the bindings in the `CMAKE_INSTALL_PREFIX` +variable, and be sure to set your `PYTHONPATH` accordingly after install. + +```bash +cd sdformat +mkdir build_python3 +cd build_python3 +cmake ../python \ + -DPython3_EXECUTABLE=/usr/local/bin/python3.12 \ + -DCMAKE_INSTALL_PREFIX= +``` + +See the homebrew [sdformat15 formula](https://github.com/osrf/homebrew-simulation/blob/027d06f5be49da1e40d01180aedae7f76dc7ff47/Formula/sdformat15.rb#L12-L56) +for an example of building bindings for multiple versions of Python. + ## Uninstallation To uninstall the software installed with the previous steps: diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 1ad2cc7a7..5baa66271 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,3 +1,27 @@ +# Detect if we are doing a standalone build of the bindings, using an external sdformat +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + cmake_minimum_required(VERSION 3.22.1) + set(SDF_VER 15) + project(sdformat${SDF_VER}-python VERSION ${SDF_VER}) + find_package(sdformat${SDF_VER} REQUIRED) + set(PROJECT_LIBRARY_TARGET_NAME "sdformat${PROJECT_VERSION_MAJOR}::sdformat${PROJECT_VERSION_MAJOR}") + # require python dependencies to be found + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + set(CMAKE_REQUIRE_FIND_PACKAGE_pybind11 TRUE) + include(GNUInstallDirs) + include(CTest) +endif() + +set(PYBIND11_PYTHON_VERSION 3) +find_package(pybind11 2.4 CONFIG QUIET) + +if (pybind11_FOUND) + message (STATUS "Searching for pybind11 - found version ${pybind11_VERSION}.") +else() + message(WARNING "pybind11 is missing: Python interfaces are disabled.") + return() +endif() + if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) if(NOT Python3_SITEARCH) # Get variable from Python3 module @@ -12,7 +36,7 @@ if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) endif() else() # If not a system installation, respect local paths - set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) + set(GZ_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/python) endif() # Set the build location and install location for a CPython extension @@ -108,7 +132,6 @@ if (BUILD_TESTING AND NOT WIN32) target_link_libraries(sdformattest PRIVATE ${PROJECT_LIBRARY_TARGET_NAME} - gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} ) set(python_tests From dcd3cd61402a2278db3ac021442a6e7458fa79b9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:48:43 -0800 Subject: [PATCH 05/16] Improve installation instructions (#1496) Backport of #1490. * Refer to https://brew.sh instead of duplicating the brew installation command. * List cmake variables in a markdown table. * Combine Ubuntu and macOS installation instructions (cherry picked from commit 22684cbe9144f9cf15e2df7dfa55457266caca44) Signed-off-by: Steve Peters Co-authored-by: Steve Peters --- README.md | 71 ++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 4a8a8cf60..4c7d10c9d 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ which version you need, or leave it empty for version 1. ### macOS -On macOS, add OSRF packages: +On macOS, after installing the [Homebrew package manager](https://brew.sh), +add OSRF packages: ```sh - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew tap osrf/simulation ``` @@ -129,6 +129,25 @@ git clone https://github.com/gazebosim/sdformat -b sdf<#> Be sure to replace `<#>` with a number value, such as 1 or 2, depending on which version you need. +### Install dependencies + +#### Ubuntu + +```sh +cd sdformat +sudo apt -y install \ + $(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt' | tr '\n' ' ')) +``` + +#### macOS + +```sh +brew install --only-dependencies sdformat<#> +``` + +Be sure to replace `<#>` with a number value, such as 14 or 15, depending on +which version you need. + ### Build from Source Standard installation can be performed in UNIX systems using the following @@ -144,12 +163,10 @@ make install sdformat supported cmake parameters at configuring time: -* `USE_INTERNAL_URDF` (`bool`) [default `False`]
- Use an internal copy of urdfdom 1.0.0 instead of look for one - installed in the system -* `USE_UPSTREAM_CFLAGS` (`bool`) [default `True`]
- Use the sdformat team compilation flags instead of the common set defined - by cmake. +| Name | Type | Default | Description | +|-----------------------|------|----------|--------------------------------------| +| `USE_INTERNAL_URDF` | BOOL | False | Use an internal copy of urdfdom 1.0.0 instead of looking for one installed in the system | +| `USE_UPSTREAM_CFLAGS` | BOOL | True | Use the sdformat team compilation flags instead of the common set defined by cmake. | ## Uninstallation @@ -160,44 +177,6 @@ cd build make uninstall ``` -## macOS - -### Prerequisites - -Clone the repository -```sh -git clone https://github.com/gazebosim/sdformat -b sdf<#> -``` -Be sure to replace `<#>` with a number value, such as 1 or 2, depending on -which version you need. - -Install dependencies -```sh -brew install --only-dependencies sdformat<#> -``` - -### Build from Source - -1. Configure and build - ```sh - cd sdformat - mkdir build - cd build - cmake .. # Consider specifying -DCMAKE_INSTALL_PREFIX=... - make - ``` - -2. Optionally, install and uninstall - ```sh - sudo make install - ``` - - To uninstall the software installed with the previous steps: - ```sh - cd build/ - sudo make uninstall - ``` - ## Windows ### Prerequisites From 9661794312763099cee6da1da613384210fae5db Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 6 Nov 2024 04:44:25 +0100 Subject: [PATCH 06/16] Only look for psutil if testing is enabled (#1495) This avoids an unnecessary CMake warning on builds where tests are disabled, such as [sdformat_vendor](https://github.com/gazebo-release/sdformat_vendor) Signed-off-by: Addisu Z. Taddese Co-authored-by: Steve Peters --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d4907834..74d38ad66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,9 +126,11 @@ if (BUILD_SDF) ################################################ # Find psutil python package for memory tests - find_python_module(psutil) - if (NOT PY_PSUTIL) - gz_build_warning("Python psutil package not found. Memory leak tests will be skipped") + if (BUILD_TESTING) + find_python_module(psutil) + if (NOT PY_PSUTIL) + gz_build_warning("Python psutil package not found. Memory leak tests will be skipped") + endif() endif() ######################################## From 91d9029b867a35349b3be85dbe9333feeb2b503c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:16:38 -0800 Subject: [PATCH 07/16] Permit building python bindings separately from libsdformat library (#1497) Backport of #1491 with adapted package finding logic and a note about requiring cmake 3.22.1. This allows the src/python_pybind11/CMakeLists.txt file to be built as a top-level cmake project against an external sdformat library, with documentation added to the README. The logic for finding pybind11 is also moved from the root CMakeLists.txt to python/CMakeLists.txt to reduce code duplication. When invoked through the root CMakeLists.txt, pybind11 is treated as an optional dependency, but when invoked from the python folder, pybind11 is treated as required by setting the variable CMAKE_REQUIRE_FIND_PACKAGE_pybind11 to TRUE. Signed-off-by: Steve Peters Signed-off-by: Silvio Traversaro Co-authored-by: Silvio Traversaro (cherry picked from commit 3dcdd55ee7a3ab0ac77b5cce56ba9629b79a70ac) --- CMakeLists.txt | 12 +----------- README.md | 25 +++++++++++++++++++++++++ python/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++-------- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b81c2acf0..6b0dd2f12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,16 +97,6 @@ if (BUILD_SDF) ) if (NOT Python3_Development_FOUND) GZ_BUILD_WARNING("Python development libraries are missing: Python interfaces are disabled.") - else() - set(PYBIND11_PYTHON_VERSION 3) - find_package(pybind11 2.4 CONFIG QUIET) - - if (pybind11_FOUND) - message (STATUS "Searching for pybind11 - found version ${pybind11_VERSION}.") - else() - GZ_BUILD_WARNING("pybind11 is missing: Python interfaces are disabled.") - message (STATUS "Searching for pybind11 - not found.") - endif() endif() endif() @@ -159,7 +149,7 @@ if (BUILD_SDF) add_subdirectory(sdf) add_subdirectory(conf) add_subdirectory(doc) - if (pybind11_FOUND AND NOT SKIP_PYBIND11) + if (Python3_Development_FOUND AND NOT SKIP_PYBIND11) add_subdirectory(python) endif() endif(BUILD_SDF) diff --git a/README.md b/README.md index 4c7d10c9d..bab39d1f3 100644 --- a/README.md +++ b/README.md @@ -165,9 +165,34 @@ sdformat supported cmake parameters at configuring time: | Name | Type | Default | Description | |-----------------------|------|----------|--------------------------------------| +| `SKIP_PYBIND11` | BOOL | False | Skip generating Python bindings via pybind11 | | `USE_INTERNAL_URDF` | BOOL | False | Use an internal copy of urdfdom 1.0.0 instead of looking for one installed in the system | | `USE_UPSTREAM_CFLAGS` | BOOL | True | Use the sdformat team compilation flags instead of the common set defined by cmake. | +### Build python bindings separately from main library + +If you want to build Python bindings separately from the main libsdformat library +(for example if you want to build Python bindings for multiple versions of Python), +you can invoke cmake on the `python` folder instead of the root folder. +This requires cmake version 3.22.1 due to the use of a `CMAKE_REQUIRE_FIND_PACKAGE_*` +variable, which is newer than the minimum required version of cmake for sdformat14. +Specify the path to the python executable with which you wish to build bindings +in the `Python3_EXECUTABLE` cmake variable. +Specify the install path for the bindings in the `CMAKE_INSTALL_PREFIX` +variable, and be sure to set your `PYTHONPATH` accordingly after install. + +```bash +cd sdformat +mkdir build_python3 +cd build_python3 +cmake ../python \ + -DPython3_EXECUTABLE=/usr/local/bin/python3.12 \ + -DCMAKE_INSTALL_PREFIX= +``` + +See the homebrew [sdformat15 formula](https://github.com/osrf/homebrew-simulation/blob/027d06f5be49da1e40d01180aedae7f76dc7ff47/Formula/sdformat15.rb#L12-L56) +for an example of building bindings for multiple versions of Python. + ## Uninstallation To uninstall the software installed with the previous steps: diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 864d38c18..41b511cc8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,15 +1,39 @@ -if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") - # pybind11 logic for setting up a debug build when both a debug and release - # python interpreter are present in the system seems to be pretty much broken. - # This works around the issue. - set(PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES}") +# Detect if we are doing a standalone build of the bindings, using an external sdformat +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + cmake_minimum_required(VERSION 3.22.1) + set(SDF_VER 14) + project(sdformat${SDF_VER}-python VERSION ${SDF_VER}) + find_package(sdformat${SDF_VER} REQUIRED) + set(PROJECT_LIBRARY_TARGET_NAME "sdformat${PROJECT_VERSION_MAJOR}::sdformat${PROJECT_VERSION_MAJOR}") + # require python dependencies to be found + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + set(CMAKE_REQUIRE_FIND_PACKAGE_pybind11 TRUE) + include(GNUInstallDirs) + include(CTest) +elseif(${CMAKE_VERSION} VERSION_LESS "3.12.0") + # TODO: remove once the minimum CMake version is increased + if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") + # pybind11 logic for setting up a debug build when both a debug and release + # python interpreter are present in the system seems to be pretty much broken. + # This works around the issue. + set(PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES}") + endif() endif() +set(PYBIND11_PYTHON_VERSION 3) +find_package(pybind11 2.4 CONFIG QUIET) + +if (pybind11_FOUND) + message (STATUS "Searching for pybind11 - found version ${pybind11_VERSION}.") +else() + message(WARNING "pybind11 is missing: Python interfaces are disabled.") + return() +endif() if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) if(${CMAKE_VERSION} VERSION_LESS "3.12.0") execute_process( - COMMAND "${PYTHON_EXECUTABLE}" -c "if True: + COMMAND "${Python3_EXECUTABLE}" -c "if True: from distutils import sysconfig as sc print(sc.get_python_lib(plat_specific=True))" OUTPUT_VARIABLE Python3_SITEARCH @@ -28,7 +52,7 @@ if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) endif() else() # If not a system installation, respect local paths - set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) + set(GZ_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/python) endif() # Set the build location and install location for a CPython extension @@ -124,7 +148,6 @@ if (BUILD_TESTING AND NOT WIN32) target_link_libraries(sdformattest PRIVATE ${PROJECT_LIBRARY_TARGET_NAME} - gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} ) set(python_tests From d0bcd405516678cb7840b245b9c62adfbaa083c9 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Tue, 12 Nov 2024 10:07:00 -0800 Subject: [PATCH 08/16] Support removing the actor, light, or model from the root (#1492) * Support removing the actor, light, or model from the root Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig --------- Signed-off-by: Nate Koenig Co-authored-by: Steve Peters --- include/sdf/Root.hh | 5 +++++ python/src/sdf/pyRoot.cc | 4 ++++ python/test/pyRoot_TEST.py | 28 +++++++++++++++++++++++++ src/Root.cc | 6 ++++++ src/Root_TEST.cc | 42 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+) diff --git a/include/sdf/Root.hh b/include/sdf/Root.hh index 9ad5f1632..75a25eb88 100644 --- a/include/sdf/Root.hh +++ b/include/sdf/Root.hh @@ -246,6 +246,11 @@ namespace sdf public: sdf::ElementPtr ToElement( const OutputConfig &_config = OutputConfig::GlobalConfig()) const; + /// \brief Remove the actor, light, or model if one of them exists. + /// The SDF Root object can only hold one, or none, from the set + /// [Actor, Light, Model]. + public: void ClearActorLightModel(); + /// \brief Private data pointer GZ_UTILS_IMPL_PTR(dataPtr) }; diff --git a/python/src/sdf/pyRoot.cc b/python/src/sdf/pyRoot.cc index 2da83830a..af94e78b5 100644 --- a/python/src/sdf/pyRoot.cc +++ b/python/src/sdf/pyRoot.cc @@ -96,6 +96,10 @@ void defineRoot(pybind11::object module) .def("set_light", &sdf::Root::SetLight, "Set the light object. This will override any existing model, " "actor, and light object.") + .def("clear_actor_light_model", &sdf::Root::ClearActorLightModel, + "Remove the actor, light, or model if one of them exists." + "The SDF Root object can only hold one, or none, from the set" + "[Actor, Light, Model].") .def("add_world", [](Root &self, const World &_world) { ThrowIfErrors(self.AddWorld(_world)); diff --git a/python/test/pyRoot_TEST.py b/python/test/pyRoot_TEST.py index 0a41bf667..785f94de3 100644 --- a/python/test/pyRoot_TEST.py +++ b/python/test/pyRoot_TEST.py @@ -358,5 +358,33 @@ def test_resolve_auto_inertials_with_save_calculation_configuration(self): self.assertEqual(len(inertialErr), 0) self.assertTrue(link.auto_inertia_saved()) + def test_clear_actor_light_model(self): + root = Root() + + # \TODO(anyone) Wrap the Actor class. + # self.assertEqual(None, root.actor()) + # actor1 = Actor() + # actor1.set_name("actor1") + # root.set_actor(actor1) + # self.assertNotEqual(None, root.actor()) + # root.clear_actor_light_model() + # self.assertEqual(None, root.actor()) + + self.assertEqual(None, root.light()) + light1 = Light() + light1.set_name("light1") + root.set_light(light1) + self.assertNotEqual(None, root.light()) + root.clear_actor_light_model() + self.assertEqual(None, root.light()) + + self.assertEqual(None, root.model()) + model1 = Model() + model1.set_name("model1") + root.set_model(model1) + self.assertNotEqual(None, root.model()) + root.clear_actor_light_model() + self.assertEqual(None, root.model()) + if __name__ == '__main__': unittest.main() diff --git a/src/Root.cc b/src/Root.cc index 03349d2af..6b5d4f618 100644 --- a/src/Root.cc +++ b/src/Root.cc @@ -644,3 +644,9 @@ sdf::ElementPtr Root::ToElement(const OutputConfig &_config) const return elem; } + +///////////////////////////////////////////////// +void Root::ClearActorLightModel() +{ + this->dataPtr->modelLightOrActor = std::monostate{}; +} diff --git a/src/Root_TEST.cc b/src/Root_TEST.cc index d48382276..b0b32cd32 100644 --- a/src/Root_TEST.cc +++ b/src/Root_TEST.cc @@ -670,3 +670,45 @@ TEST(DOMRoot, WorldByName) ASSERT_TRUE(root.WorldNameExists("world2")); EXPECT_EQ("world2", root.WorldByName("world2")->Name()); } + +///////////////////////////////////////////////// +TEST(DOMRoot, ClearActorLightModel) +{ + sdf::Root root; + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Actor actor1; + actor1.SetName("actor1"); + root.SetActor(actor1); + EXPECT_NE(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Light light1; + light1.SetName("light1"); + root.SetLight(light1); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_NE(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Model model1; + model1.SetName("model1"); + root.SetModel(model1); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_NE(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); +} From 87932fe70fe11327389b04cd956c5270cfc3d218 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 12 Nov 2024 14:55:04 -0600 Subject: [PATCH 09/16] Add bzlmod support to sdf15 (#1493) Signed-off-by: Michael Carroll Signed-off-by: Shameek Ganguly Co-authored-by: Shameek Ganguly --- .bazelrc | 12 + .bazelversion | 1 + .gitignore | 1 + BUILD.bazel | 990 ++++++++++++++-- MODULE.bazel | 27 + src/SDF_TEST.cc | 8 +- src/Sensor_TEST.cc | 10 +- src/bazel/InstallationDirectories.cc | 32 + src/parser_urdf.cc | 2 +- src/parser_urdf_TEST.cc | 1 - test/BUILD.bazel | 1004 ++++++++++++++++- test/integration/audio.cc | 2 +- test/integration/category_bitmask.cc | 2 +- .../cfm_damping_implicit_spring_damper.cc | 2 +- test/integration/converter.cc | 2 +- .../disable_fixed_joint_reduction.cc | 2 +- test/integration/element_memory_leak.cc | 2 +- test/integration/fixed_joint_reduction.cc | 5 +- test/integration/force_torque_sensor.cc | 2 +- test/integration/include.cc | 2 +- test/integration/joint_axis_frame.cc | 3 +- test/integration/link_light.cc | 2 +- test/integration/locale_fix.cc | 2 +- test/integration/locale_fix_cxx.cc | 2 +- test/integration/material.cc | 3 +- test/integration/material_pbr.cc | 8 +- test/integration/model_versions.cc | 2 +- test/integration/nested_model.cc | 11 +- test/integration/parser_error_detection.cc | 2 +- test/integration/plugin_attribute.cc | 2 +- test/integration/plugin_bool.cc | 2 +- test/integration/plugin_include.cc | 2 +- test/integration/precision.cc | 2 +- test/integration/print_config.cc | 12 +- test/integration/provide_feedback.cc | 2 +- test/integration/resolve_uris.cc | 10 +- test/integration/schema_test.cc | 2 +- test/integration/sdf_basic.cc | 2 +- test/integration/sdf_custom.cc | 6 +- test/integration/unknown.cc | 3 +- test/integration/urdf_gazebo_extensions.cc | 7 +- test/integration/urdf_joint_parameters.cc | 2 +- test/integration/urdf_to_sdf.cc | 5 +- test/test_config.hh.in | 10 +- 44 files changed, 2012 insertions(+), 201 deletions(-) create mode 100644 .bazelrc create mode 100644 .bazelversion create mode 100644 MODULE.bazel create mode 100644 src/bazel/InstallationDirectories.cc diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..f2d06137d --- /dev/null +++ b/.bazelrc @@ -0,0 +1,12 @@ +common --enable_bzlmod +common --lockfile_mode=off + +# Add C++17 compiler flags. +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 + +build --force_pic +build --strip=never +build --strict_system_includes +build --fission=dbg +build --features=per_object_debug_info diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..643916c03 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.3.1 diff --git a/.gitignore b/.gitignore index fe7c191e7..962b6a180 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build_* *.*.sw? .vscode __pycache__ +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel index 0e26e2c84..280adfd4a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,36 +1,43 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "add_lint_tests", - "gz_configure_file", - "gz_configure_header", - "gz_export_header", - "gz_include_header", - "gz_py_binary", -) +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") +load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header") +load("@rules_license//rules:license.bzl", "license") package( - default_visibility = GZ_VISIBILITY, - features = GZ_FEATURES, + default_applicable_licenses = [":license"], + features = ["layering_check"], +) + +license( + name = "license", + package_name = "sdformat", ) licenses(["notice"]) -exports_files(["LICENSE"]) +exports_files([ + "package.xml", + "LICENSE", + "MODULE.bazel", +]) + +gz_export_header( + name = "Export", + out = "include/sdf/Export.hh", + export_base = "GZ_SDFORMAT", + lib_name = "sdformat", +) gz_configure_header( - name = "config", + name = "Config", src = "include/sdf/config.hh.in", - cmakelists = ["CMakeLists.txt"], - defines = { - "CMAKE_INSTALL_FULL_DATAROOTDIR": "unused", - }, - package = "sdformat", + defines = [ + "CMAKE_INSTALL_FULL_DATAROOTDIR=unused", + "SDF_PROTOCOL_VERSION=1.12", + ], + package_xml = "package.xml", ) -gz_py_binary( +py_binary( name = "embed_sdf", srcs = ["sdf/embedSdf.py"], main = "sdf/embedSdf.py", @@ -43,49 +50,12 @@ genrule( "sdf/**/*.convert", ]), outs = ["EmbeddedSdf.cc"], - cmd = "$(execpath :embed_sdf) --output-file $@ --sdf-root sdformat/sdf/ --input-files $(SRCS)", # noqa + cmd = "$(execpath :embed_sdf) --output-file $@ --sdf-root sdf/ --input-files $(SRCS)", tools = [":embed_sdf"], ) -public_headers_no_gen = glob([ - "include/sdf/*.h", - "include/sdf/*.hh", -]) - -private_headers = glob(["src/*.hh"]) - -sources = glob( - ["src/*.cc"], - exclude = [ - "src/*_TEST.cc", - "src/gz.cc", - ], -) - -gz_export_header( - name = "include/sdf/Export.hh", - export_base = "GZ_SDFORMAT", - lib_name = "sdf", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "sdformat_hh_genrule", - out = "include/sdformat.hh", - hdrs = public_headers_no_gen + [ - "include/sdf/config.hh", - "include/sdf/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/sdf/Export.hh", - "include/sdf/config.hh", - "include/sdformat.hh", -] - cc_library( - name = "urdf", + name = "urdf_parser", srcs = [ "src/urdf/urdf_parser/joint.cpp", "src/urdf/urdf_parser/link.cpp", @@ -101,6 +71,7 @@ cc_library( ), copts = ["-Wno-unknown-pragmas"], includes = ["src/urdf"], + visibility = ["//visibility:public"], deps = [ "@tinyxml2", ], @@ -108,9 +79,28 @@ cc_library( cc_library( name = "sdformat", - srcs = sources + private_headers + ["EmbeddedSdf.cc"], - hdrs = public_headers, + srcs = glob( + include = [ + "src/*.cc", + "src/*.hh", + "src/bazel/*.cc", + ], + exclude = [ + "src/*_TEST.cc", + ], + ) + ["EmbeddedSdf.cc"], + hdrs = glob( + include = [ + "include/sdf/*.hh", + ], + exclude = [ + ], + ), + data = [ + "sdf", + ], defines = [ + "CMAKE_INSTALL_RELATIVE_DATAROOTDIR=\\\"\\\"", 'SDF_SHARE_PATH=\\".\\"', 'SDF_VERSION_PATH=\\"sdformat\\"', ], @@ -118,83 +108,853 @@ cc_library( "include", "src", ], + visibility = ["//visibility:public"], deps = [ - ":urdf", - GZ_ROOT + "math", - GZ_ROOT + "utils", - "@tinyxml2", + ":Config", + ":Export", + ":urdf_parser", + "@gz-math//:Angle", + "@gz-math//:Box", + "@gz-math//:Capsule", + "@gz-math//:Color", + "@gz-math//:Cone", + "@gz-math//:Cylinder", + "@gz-math//:Ellipsoid", + "@gz-math//:Graph", + "@gz-math//:Inertial", + "@gz-math//:Pose3", + "@gz-math//:SemanticVersion", + "@gz-math//:Sphere", + "@gz-math//:SphericalCoordinates", + "@gz-math//:Temperature", + "@gz-math//:Vector2", + "@gz-utils//:Environment", + "@gz-utils//:ImplPtr", ], ) -cc_library( - name = "sdformat_internal", +cc_test( + name = "Actor_TEST", + srcs = [ + "src/Actor_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "AirPressure_TEST", + srcs = [ + "src/AirPressure_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Airspeed_TEST", + srcs = [ + "src/Airspeed_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Altimeter_TEST", + srcs = [ + "src/Altimeter_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Atmosphere_TEST", + srcs = [ + "src/Atmosphere_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Box_TEST", + srcs = [ + "src/Box_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Camera_TEST", + srcs = [ + "src/Camera_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Capsule_TEST", + srcs = [ + "src/Capsule_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Collision_TEST", + srcs = [ + "src/Collision_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Cone_TEST", srcs = [ - "src/gz.cc", - "src/gz.hh", + "src/Cone_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", ], - visibility = ["//visibility:private"], - deps = [":sdformat"], ) -test_sources = glob( - ["src/*_TEST.cc"], - exclude = ["src/gz_TEST.cc"], +cc_test( + name = "Console_TEST", + srcs = [ + "src/Console_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], ) -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], +cc_test( + name = "Converter_TEST", + srcs = [ + "src/Converter_TEST.cc", + ], data = [ - "sdf", - GZ_ROOT + "sdformat/test:integration", - GZ_ROOT + "sdformat/test:sdf", + "sdf/1.10/1_9.convert", + "sdf/1.6/1_5.convert", + "sdf/1.7/1_6.convert", + "sdf/1.8/1_7.convert", + "sdf/1.9/1_8.convert", ], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "sdformat", - }, deps = [ ":sdformat", - GZ_ROOT + "sdformat/test:test_utils", - "@gtest", - "@gtest//:gtest_main", + "//test:test_utils", + "@googletest//:gtest_main", ], -) for src in test_sources] +) -gz_configure_file( - name = "sdformat.rb", - src = "src/cmd/cmdsdformat.rb.in", - out = "cmdsdformat.rb", - cmakelists = ["CMakeLists.txt"], - defines = [ - "library_location=libgz-sdformat.so", +cc_test( + name = "CustomInertiaCalcProperties_TEST", + srcs = [ + "src/CustomInertiaCalcProperties_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", ], - package = "sdformat", - visibility = [GZ_ROOT + "tools:__pkg__"], ) -gz_configure_file( - name = "sdformat_yaml", - src = "conf/sdformat.yaml.in", - out = "sdformat.yaml", - cmakelists = ["CMakeLists.txt"], - defines = [ - "gz_library_path=gz/sdformat/cmdsdformat.rb", +cc_test( + name = "Cylinder_TEST", + srcs = [ + "src/Cylinder_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Element_TEST", + srcs = [ + "src/Element_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Ellipsoid_TEST", + srcs = [ + "src/Ellipsoid_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Error_TEST", + srcs = [ + "src/Error_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Exception_TEST", + srcs = [ + "src/Exception_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Filesystem_TEST", + srcs = [ + "src/Filesystem_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ForceTorque_TEST", + srcs = [ + "src/ForceTorque_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Frame_TEST", + srcs = [ + "src/Frame_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "FrameSemantics_TEST", + srcs = [ + "src/FrameSemantics_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Geometry_TEST", + srcs = [ + "src/Geometry_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Gui_TEST", + srcs = [ + "src/Gui_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable once gz-utils exposes ExtraTestMacros.hh in bazel build. +# cc_test( +# name = "gz_TEST", +# srcs = [ +# "src/gz_TEST.cc", +# ], +# deps = [ +# ":sdformat", +# "//test:test_utils", +# "@googletest//:gtest_main", +# ], +#) + +cc_test( + name = "Heightmap_TEST", + srcs = [ + "src/Heightmap_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Imu_TEST", + srcs = [ + "src/Imu_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "InterfaceElements_TEST", + srcs = [ + "src/InterfaceElements_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", ], - package = "sdformat", - visibility = [GZ_ROOT + "tools:__pkg__"], ) -cc_binary( - name = "libgz-sdformat.so", - srcs = [":sdformat_internal"], - linkshared = True, - visibility = [GZ_ROOT + "tools:__pkg__"], +cc_test( + name = "Joint_TEST", + srcs = [ + "src/Joint_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "JointAxis_TEST", + srcs = [ + "src/JointAxis_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Lidar_TEST", + srcs = [ + "src/Lidar_TEST.cc", + ], deps = [ ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", ], ) -exports_files(["sdf"]) +cc_test( + name = "Light_TEST", + srcs = [ + "src/Light_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) -add_lint_tests() +cc_test( + name = "Link_TEST", + srcs = [ + "src/Link_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Magnetometer_TEST", + srcs = [ + "src/Magnetometer_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Material_TEST", + srcs = [ + "src/Material_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Mesh_TEST", + srcs = [ + "src/Mesh_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Model_TEST", + srcs = [ + "src/Model_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "NavSat_TEST", + srcs = [ + "src/NavSat_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Noise_TEST", + srcs = [ + "src/Noise_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "OutputConfig_TEST", + srcs = [ + "src/OutputConfig_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Param_TEST", + srcs = [ + "src/Param_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParamPassing_TEST", + srcs = [ + "src/ParamPassing_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "parser_TEST", + srcs = [ + "src/parser_TEST.cc", + ], + data = [ + "//test:integration/model", + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "parser_urdf_TEST", + srcs = [ + "src/parser_urdf_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParserConfig_TEST", + srcs = [ + "src/ParserConfig_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParticleEmitter_TEST", + srcs = [ + "src/ParticleEmitter_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Pbr_TEST", + srcs = [ + "src/Pbr_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Physics_TEST", + srcs = [ + "src/Physics_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Plane_TEST", + srcs = [ + "src/Plane_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Plugin_TEST", + srcs = [ + "src/Plugin_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Polyline_TEST", + srcs = [ + "src/Polyline_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "PrintConfig_TEST", + srcs = [ + "src/PrintConfig_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Projector_TEST", + srcs = [ + "src/Projector_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Root_TEST", + srcs = [ + "src/Root_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Scene_TEST", + srcs = [ + "src/Scene_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "SDF_TEST", + srcs = [ + "src/SDF_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + "@gz-math//:Color", + "@gz-math//:Pose3", + "@gz-math//:Vector2", + ], +) + +cc_test( + name = "SemanticPose_TEST", + srcs = [ + "src/SemanticPose_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sensor_TEST", + srcs = [ + "src/Sensor_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sky_TEST", + srcs = [ + "src/Sky_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sphere_TEST", + srcs = [ + "src/Sphere_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Surface_TEST", + srcs = [ + "src/Surface_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Types_TEST", + srcs = [ + "src/Types_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Utils_TEST", + srcs = [ + "src/Utils_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Visual_TEST", + srcs = [ + "src/Visual_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "World_TEST", + srcs = [ + "src/World_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "XmlUtils_TEST", + srcs = [ + "src/XmlUtils_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +# Bazel linting +buildifier( + name = "buildifier.fix", + exclude_patterns = ["./.git/*"], + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + exclude_patterns = ["./.git/*"], + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..5fa4ee358 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,27 @@ +## MODULE.bazel +module( + name = "sdformat", + repo_name = "org_gazebosim_sdformat", +) + +bazel_dep(name = "buildifier_prebuilt", version = "6.1.2") +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "rules_license", version = "0.0.8") +bazel_dep(name = "tinyxml2", version = "10.0.0") + +# Gazebo Dependencies +bazel_dep(name = "rules_gazebo", version = "0.0.2") +bazel_dep(name = "gz-utils") +bazel_dep(name = "gz-math") + +archive_override( + module_name = "gz-utils", + strip_prefix = "gz-utils-gz-utils3", + urls = ["https://github.com/gazebosim/gz-utils/archive/refs/heads/gz-utils3.tar.gz"], +) + +archive_override( + module_name = "gz-math", + strip_prefix = "gz-math-gz-math8", + urls = ["https://github.com/gazebosim/gz-math/archive/refs/heads/gz-math8.tar.gz"], +) diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 6b81db9f9..4936e8f98 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -20,15 +20,17 @@ #include #include -#include +#include +#include +#include +#include #include #include +#include "sdf/parser.hh" #include "test_config.hh" #include "test_utils.hh" -#include "sdf/sdf.hh" - class SDFUpdateFixture { public: std::string GetName() const {return this->name;} diff --git a/src/Sensor_TEST.cc b/src/Sensor_TEST.cc index 482c6f1f9..df192bede 100644 --- a/src/Sensor_TEST.cc +++ b/src/Sensor_TEST.cc @@ -16,9 +16,15 @@ */ #include -#include "sdf/Noise.hh" +#include "sdf/AirPressure.hh" +#include "sdf/Altimeter.hh" +#include "sdf/Camera.hh" +#include "sdf/ForceTorque.hh" +#include "sdf/Imu.hh" +#include "sdf/Lidar.hh" #include "sdf/Magnetometer.hh" -#include "sdf/sdf.hh" +#include "sdf/NavSat.hh" +#include "sdf/Noise.hh" #include "sdf/Sensor.hh" ///////////////////////////////////////////////// diff --git a/src/bazel/InstallationDirectories.cc b/src/bazel/InstallationDirectories.cc new file mode 100644 index 000000000..6acfaa468 --- /dev/null +++ b/src/bazel/InstallationDirectories.cc @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +#include + +namespace sdf +{ + +inline namespace SDF_VERSION_NAMESPACE { + +// Generate an install prefix specifically for bazel build. +std::string getInstallPrefix() +{ + return "."; +} +} // namespace SDF_VERSION_NAMESPACE +} // namespace sdf + diff --git a/src/parser_urdf.cc b/src/parser_urdf.cc index d8d2b2352..fac4ea5bd 100644 --- a/src/parser_urdf.cc +++ b/src/parser_urdf.cc @@ -35,8 +35,8 @@ #include #include "sdf/Error.hh" -#include "sdf/sdf.hh" #include "sdf/Types.hh" +#include "sdf/Frame.hh" #include "XmlUtils.hh" #include "SDFExtension.hh" diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index 96b940d99..ece561937 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -19,7 +19,6 @@ #include -#include "sdf/sdf.hh" #include "parser_urdf.hh" #include "test_utils.hh" diff --git a/test/BUILD.bazel b/test/BUILD.bazel index bb1baa410..1c48caa3f 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,24 +1,15 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "cmake_configure_file", -) +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") +load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header") package( - default_visibility = GZ_VISIBILITY, - features = GZ_FEATURES, + default_applicable_licenses = ["//:license"], + features = ["layering_check"], ) -licenses(["notice"]) - -cmake_configure_file( - name = "config", +gz_configure_header( + name = "TestConfig", src = "test_config.hh.in", - out = "test_config.hh", - cmakelists = ["CMakeLists.txt"], - defines = [], + package_xml = "//:package.xml", ) cc_library( @@ -28,45 +19,974 @@ cc_library( "test_utils.hh", ], includes = ["."], + visibility = ["//:__subpackages__"], +) + +exports_files( + [ + "sdf", + "integration/model", + ], + visibility = ["//:__subpackages__"], +) + +cc_test( + name = "INTEGRATION_actor_dom", + srcs = [ + "integration/actor_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_audio", + srcs = [ + "integration/audio.cc", + ], + data = [ + "integration/audio.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_category_bitmask", + srcs = [ + "integration/category_bitmask.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_cfm_damping_implicit_spring_damper", + srcs = [ + "integration/cfm_damping_implicit_spring_damper.cc", + ], + data = [ + "integration/cfm_damping_implicit_spring_damper.sdf", + "integration/cfm_damping_implicit_spring_damper.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_collision_dom", + srcs = [ + "integration/collision_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_converter", + srcs = [ + "integration/converter.cc", + ], + data = [ + "integration/audio.sdf", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_default_elements", + srcs = [ + "integration/default_elements.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_deprecated_specs", + srcs = [ + "integration/deprecated_specs.cc", + ], + data = [ + "integration/deprecated_sdf_1-0.sdf", + "integration/deprecated_sdf_1-2.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_disable_fixed_joint_reduction", + srcs = [ + "integration/disable_fixed_joint_reduction.cc", + ], + data = [ + "integration/fixed_joint_reduction.urdf", + "integration/fixed_joint_reduction_disabled.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable after adding build rule for tools/get_mem_info.py +# cc_test( +# name = "INTEGRATION_element_memory_leak", +# srcs = [ +# "integration/element_memory_leak.cc", +# ], +# data = [ +# ":sdf", +# ], +# deps = [ +# "//:sdformat", +# ":test_utils", +# "@googletest//:gtest_main", +# ], +# ) + +cc_test( + name = "INTEGRATION_element_tracing", + srcs = [ + "integration/element_tracing.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_error_output", + srcs = [ + "integration/error_output.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_fixed_joint_reduction", + srcs = [ + "integration/fixed_joint_reduction.cc", + ], + data = glob( + [ + "integration/fixed_joint_reduction*.sdf", + "integration/fixed_joint_reduction*.urdf", + ], + ), + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_force_torque_sensor", + srcs = [ + "integration/force_torque_sensor.cc", + ], + data = [ + "integration/force_torque_sensor.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_frame", + srcs = [ + "integration/frame.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], deps = [ - GZ_ROOT + "utils:utils", - GZ_ROOT + "sdformat:sdformat", + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_geometry_dom", + srcs = [ + "integration/geometry_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_gui_dom", + srcs = [ + "integration/gui_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_include", + srcs = [ + "integration/include.cc", + ], + data = [ + "integration/include_description.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", ], ) -integration_test_sources = glob( - ["integration/*.cc"], - exclude = [ - "integration/schema_test.cc", - "integration/element_memory_leak.cc", +cc_test( + name = "INTEGRATION_includes", + srcs = [ + "integration/includes.cc", + ], + data = glob( + [ + "integration/include*.sdf", + ], + ) + [ + "integration/merge_include_model.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", ], ) -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("integration_", "INTEGRATION_"), +cc_test( + name = "INTEGRATION_interface_api", srcs = [ - src, + "integration/interface_api.cc", "integration/toml_parser.hh", ], data = [ - GZ_ROOT + "sdformat:sdf", - "integration", - "sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_axis_dom", + srcs = [ + "integration/joint_axis_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_axis_frame", + srcs = [ + "integration/joint_axis_frame.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_dom", + srcs = [ + "integration/joint_dom.cc", + ], + data = [ + "integration/provide_feedback.urdf", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_light_dom", + srcs = [ + "integration/light_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_link_dom", + srcs = [ + "integration/link_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_link_light", + srcs = [ + "integration/link_light.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_locale_fix", + srcs = [ + "integration/locale_fix.cc", + ], + data = [ + "integration/numeric.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_locale_fix_cxx", + srcs = [ + "integration/locale_fix_cxx.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_material", + srcs = [ + "integration/material.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_material_pbr", + srcs = [ + "integration/material_pbr.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_model_dom", + srcs = [ + "integration/model_dom.cc", + ], + data = [ + ":integration/model", + ":sdf", ], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "sdformat", - }, - includes = ["integration"], deps = [ - GZ_ROOT + "sdformat:sdformat", ":test_utils", - "@gtest", - "@gtest//:gtest_main", + "//:sdformat", + "@googletest//:gtest_main", ], -) for src in integration_test_sources] +) -exports_files([ - "sdf", - "integration", -]) +cc_test( + name = "INTEGRATION_model_versions", + srcs = [ + "integration/model_versions.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_nested_model", + srcs = [ + "integration/nested_model.cc", + ], + data = [ + "integration/nested_model_with_frames_expected.sdf", + "integration/partially_flattened.sdf", + "integration/two_level_nested_model_with_frames_expected.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_nested_multiple_elements_error", + srcs = [ + "integration/nested_multiple_elements_error.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_param_passing", + srcs = [ + "integration/param_passing.cc", + ], + data = [ + "integration/include_custom_model.sdf", + "integration/include_custom_model_expected_output.sdf", + "integration/include_custom_nested_model_expected_output.sdf", + "integration/include_invalid_custom_model.sdf", + "integration/include_model.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_parser_config", + srcs = [ + "integration/parser_config.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_parser_error_detection", + srcs = [ + "integration/parser_error_detection.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_particle_emitter_dom", + srcs = [ + "integration/particle_emitter_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_attribute", + srcs = [ + "integration/plugin_attribute.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_bool", + srcs = [ + "integration/plugin_bool.cc", + ], + deps = [ + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_include", + srcs = [ + "integration/plugin_include.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_pose_1_9_sdf", + srcs = [ + "integration/pose_1_9_sdf.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_precision", + srcs = [ + "integration/precision.cc", + ], + deps = [ + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_print_config", + srcs = [ + "integration/print_config.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_projector_dom", + srcs = [ + "integration/projector_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_provide_feedback", + srcs = [ + "integration/provide_feedback.cc", + ], + data = [ + "integration/provide_feedback.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_resolve_uris", + srcs = [ + "integration/resolve_uris.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_root_dom", + srcs = [ + "integration/root_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_scene_dom", + srcs = [ + "integration/scene_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable once xmllint is available in toolchain +# cc_test( +# name = "INTEGRATION_schema_test", +# srcs = [ +# "integration/schema_test.cc", +# ], +# data = [ +# ":integration/model", +# ], +# deps = [ +# "//:sdformat", +# ":test_utils", +# "@googletest//:gtest_main", +# ], +# ) + +cc_test( + name = "INTEGRATION_sdf_basic", + srcs = [ + "integration/sdf_basic.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sdf_custom", + srcs = [ + "integration/sdf_custom.cc", + ], + data = [ + "integration/custom_elems_attrs.sdf", + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sdf_dom_conversion", + srcs = [ + "integration/sdf_dom_conversion.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sensor_dom", + srcs = [ + "integration/sensor_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_surface_dom", + srcs = [ + "integration/surface_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_unknown", + srcs = [ + "integration/unknown.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_gazebo_extensions", + srcs = [ + "integration/urdf_gazebo_extensions.cc", + ], + data = [ + "integration/fixed_joint_example.urdf", + "integration/fixed_joint_simple.urdf", + "integration/fixed_joint_static.urdf", + "integration/urdf_gazebo_extensions.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_joint_parameters", + srcs = [ + "integration/urdf_joint_parameters.cc", + ], + data = [ + "integration/urdf_joint_parameters.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_to_sdf", + srcs = [ + "integration/urdf_to_sdf.cc", + ], + data = [ + "integration/force_torque_sensor.urdf", + "integration/invalid_force_torque_sensor_lumped_and_reduced.urdf", + "integration/invalid_force_torque_sensor_massless_child_link.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_visual_dom", + srcs = [ + "integration/visual_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_whitespace", + srcs = [ + "integration/whitespace.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_world_dom", + srcs = [ + "integration/world_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +# Bazel linting +buildifier( + name = "buildifier.fix", + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) diff --git a/test/integration/audio.cc b/test/integration/audio.cc index ed6c39191..4e6e3cb46 100644 --- a/test/integration/audio.cc +++ b/test/integration/audio.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/category_bitmask.cc b/test/integration/category_bitmask.cc index e983631b3..e3a2f8506 100644 --- a/test/integration/category_bitmask.cc +++ b/test/integration/category_bitmask.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" ///////////////////////////////////////////////// TEST(CategoryBitmask, WasSpecified) diff --git a/test/integration/cfm_damping_implicit_spring_damper.cc b/test/integration/cfm_damping_implicit_spring_damper.cc index 2d5f2e8dc..a9bedf18c 100644 --- a/test/integration/cfm_damping_implicit_spring_damper.cc +++ b/test/integration/cfm_damping_implicit_spring_damper.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/converter.cc b/test/integration/converter.cc index 1509de722..40fc6cc9a 100644 --- a/test/integration/converter.cc +++ b/test/integration/converter.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/disable_fixed_joint_reduction.cc b/test/integration/disable_fixed_joint_reduction.cc index d71390f36..8bd75866f 100644 --- a/test/integration/disable_fixed_joint_reduction.cc +++ b/test/integration/disable_fixed_joint_reduction.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index ecb9c03d9..4562f3c1b 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/fixed_joint_reduction.cc b/test/integration/fixed_joint_reduction.cc index 064484964..3bf03345d 100644 --- a/test/integration/fixed_joint_reduction.cc +++ b/test/integration/fixed_joint_reduction.cc @@ -20,7 +20,10 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Model.hh" +#include "sdf/Joint.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/force_torque_sensor.cc b/test/integration/force_torque_sensor.cc index 83c730349..f7cd36773 100644 --- a/test/integration/force_torque_sensor.cc +++ b/test/integration/force_torque_sensor.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/include.cc b/test/integration/include.cc index 7e48e84c2..79386e404 100644 --- a/test/integration/include.cc +++ b/test/integration/include.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/joint_axis_frame.cc b/test/integration/joint_axis_frame.cc index 31b54bdb6..fcc5c6515 100644 --- a/test/integration/joint_axis_frame.cc +++ b/test/integration/joint_axis_frame.cc @@ -20,7 +20,8 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" std::string get_sdf_string(const std::string &_version) { diff --git a/test/integration/link_light.cc b/test/integration/link_light.cc index fbffca098..7d0cba245 100644 --- a/test/integration/link_light.cc +++ b/test/integration/link_light.cc @@ -18,7 +18,7 @@ #include #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/locale_fix.cc b/test/integration/locale_fix.cc index 7957919e1..5e103a96e 100644 --- a/test/integration/locale_fix.cc +++ b/test/integration/locale_fix.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/locale_fix_cxx.cc b/test/integration/locale_fix_cxx.cc index 36d74d898..589497562 100644 --- a/test/integration/locale_fix_cxx.cc +++ b/test/integration/locale_fix_cxx.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Param.hh" TEST(CheckFixForLocal, CheckFixForCxxLocal) { diff --git a/test/integration/material.cc b/test/integration/material.cc index df927af16..74bce1c10 100644 --- a/test/integration/material.cc +++ b/test/integration/material.cc @@ -20,7 +20,8 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" void ExpectInvalidWithMessage(sdf::Errors &_errors, std::string _compType) diff --git a/test/integration/material_pbr.cc b/test/integration/material_pbr.cc index b7ef86d23..f9b8677e7 100644 --- a/test/integration/material_pbr.cc +++ b/test/integration/material_pbr.cc @@ -17,8 +17,14 @@ #include #include -#include "sdf/sdf.hh" + +#include "sdf/Link.hh" +#include "sdf/Material.hh" +#include "sdf/Model.hh" #include "sdf/Pbr.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" #include "test_config.hh" diff --git a/test/integration/model_versions.cc b/test/integration/model_versions.cc index 7bd2627eb..09bc0e7a1 100644 --- a/test/integration/model_versions.cc +++ b/test/integration/model_versions.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/nested_model.cc b/test/integration/nested_model.cc index 54859c95e..720551609 100644 --- a/test/integration/nested_model.cc +++ b/test/integration/nested_model.cc @@ -23,7 +23,16 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Collision.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/JointAxis.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/parser_error_detection.cc b/test/integration/parser_error_detection.cc index 3d6fc752f..69fcd53f8 100644 --- a/test/integration/parser_error_detection.cc +++ b/test/integration/parser_error_detection.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_attribute.cc b/test/integration/plugin_attribute.cc index 7f4f9f4cb..19ac6e484 100644 --- a/test/integration/plugin_attribute.cc +++ b/test/integration/plugin_attribute.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_bool.cc b/test/integration/plugin_bool.cc index 55139b2a7..b7b735615 100644 --- a/test/integration/plugin_bool.cc +++ b/test/integration/plugin_bool.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_include.cc b/test/integration/plugin_include.cc index e7f5e1827..fef78f692 100644 --- a/test/integration/plugin_include.cc +++ b/test/integration/plugin_include.cc @@ -17,7 +17,7 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/precision.cc b/test/integration/precision.cc index b2503ecd3..65d3ca255 100644 --- a/test/integration/precision.cc +++ b/test/integration/precision.cc @@ -17,7 +17,7 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/print_config.cc b/test/integration/print_config.cc index 922f7f5fa..c0882580f 100644 --- a/test/integration/print_config.cc +++ b/test/integration/print_config.cc @@ -22,7 +22,17 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Camera.hh" +#include "sdf/Geometry.hh" +#include "sdf/Joint.hh" +#include "sdf/JointAxis.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Sensor.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/provide_feedback.cc b/test/integration/provide_feedback.cc index 1811628f8..3f5e771c8 100644 --- a/test/integration/provide_feedback.cc +++ b/test/integration/provide_feedback.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/resolve_uris.cc b/test/integration/resolve_uris.cc index f7273e5e5..b268c0590 100644 --- a/test/integration/resolve_uris.cc +++ b/test/integration/resolve_uris.cc @@ -20,7 +20,15 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Collision.hh" +#include "sdf/Geometry.hh" +#include "sdf/Heightmap.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/schema_test.cc b/test/integration/schema_test.cc index 99a309fdb..7a8392d53 100644 --- a/test/integration/schema_test.cc +++ b/test/integration/schema_test.cc @@ -21,7 +21,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/sdf_basic.cc b/test/integration/sdf_basic.cc index 7ea458804..71009c0d5 100644 --- a/test/integration/sdf_basic.cc +++ b/test/integration/sdf_basic.cc @@ -16,7 +16,7 @@ */ #include -#include "sdf/sdf.hh" +#include "sdf/SDFImpl.hh" #include "test_config.hh" diff --git a/test/integration/sdf_custom.cc b/test/integration/sdf_custom.cc index ef04256b9..8434270d2 100644 --- a/test/integration/sdf_custom.cc +++ b/test/integration/sdf_custom.cc @@ -19,7 +19,11 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/unknown.cc b/test/integration/unknown.cc index 33204521b..60dc4dcbc 100644 --- a/test/integration/unknown.cc +++ b/test/integration/unknown.cc @@ -19,8 +19,9 @@ #include -#include "sdf/sdf.hh" #include "sdf/Error.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/urdf_gazebo_extensions.cc b/test/integration/urdf_gazebo_extensions.cc index a8c9f7f7c..56f3be4bb 100644 --- a/test/integration/urdf_gazebo_extensions.cc +++ b/test/integration/urdf_gazebo_extensions.cc @@ -19,7 +19,12 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/urdf_joint_parameters.cc b/test/integration/urdf_joint_parameters.cc index 734d52c5f..9462b16e2 100644 --- a/test/integration/urdf_joint_parameters.cc +++ b/test/integration/urdf_joint_parameters.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/urdf_to_sdf.cc b/test/integration/urdf_to_sdf.cc index 0dcd42444..2afd40511 100644 --- a/test/integration/urdf_to_sdf.cc +++ b/test/integration/urdf_to_sdf.cc @@ -18,7 +18,10 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" #include "sdf/parser.hh" #include "sdf/ParserConfig.hh" #include "test_config.hh" diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 303eab375..f57debcee 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -48,13 +48,13 @@ namespace sdf /// \return True if directory is set correctly, false otherwise bool ProjectSourcePath(std::string &_sourceDir) { - std::string bazel_path; // Bazel builds set TEST_SRCDIR - if(gz::utils::env("TEST_SRCDIR", _sourceDir) && - gz::utils::env("GZ_BAZEL_PATH", bazel_path)) + if(gz::utils::env("TEST_SRCDIR", _sourceDir)) { - _sourceDir = sdf::filesystem::append( - _sourceDir, "gz", bazel_path); + // Bazel symlinks test files at .runfiles/_main/ and + // the TEST_SRCDIR env var should point to .runfiles. + // See https://bazel.build/remote/output-directories for details. + _sourceDir = sdf::filesystem::append(_sourceDir, "_main"); return true; } else From bddaf0d0cb9e2a906420c5b796f1548dc91f1794 Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Tue, 12 Nov 2024 13:29:24 -0800 Subject: [PATCH 10/16] Bazel CI (#1500) Signed-off-by: Shameek Ganguly --- .github/workflows/bazel.yml | 23 +++++++++++++++++++++++ .github/workflows/ci.bazelrc | 15 +++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/bazel.yml create mode 100644 .github/workflows/ci.bazelrc diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml new file mode 100644 index 000000000..3e3f878d1 --- /dev/null +++ b/.github/workflows/bazel.yml @@ -0,0 +1,23 @@ +name: Bazel CI +on: + push: + branches: [sdf15, main] + pull_request: + branches: [sdf15, main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7 + with: + folders: | + [ + ".", + ] + exclude: | + [ + {"folder": ".", "bzlmodEnabled": false}, + ] diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc new file mode 100644 index 000000000..3b4aad2af --- /dev/null +++ b/.github/workflows/ci.bazelrc @@ -0,0 +1,15 @@ +# This file contains Bazel settings to apply on CI only. +# It is referenced with a --bazelrc option in the call to bazel in ci.yaml + +# Debug where options came from +build --announce_rc +# This directory is configured in GitHub actions to be persisted between runs. +# We do not enable the repository cache to cache downloaded external artifacts +# as these are generally faster to download again than to fetch them from the +# GitHub actions cache. +build --disk_cache=~/.cache/bazel +# Don't rely on test logs being easily accessible from the test runner, +# though it makes the log noisier. +test --test_output=errors +# Allows tests to run bazelisk-in-bazel, since this is the cache folder used +test --test_env=XDG_CACHE_HOME From e40c32f3d39554bdda361e0467219b4da48032f9 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 13 Nov 2024 14:53:48 -0800 Subject: [PATCH 11/16] Prepare for 15.1.0 release (#1502) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 29 +++++++++++++++++++++++++++++ package.xml | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74d38ad66..29cc1bcdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0004 NEW) endif(COMMAND CMAKE_POLICY) -project (sdformat15 VERSION 15.0.0) +project (sdformat15 VERSION 15.1.0) # The protocol version has nothing to do with the package version. # It represents the current version of SDFormat implemented by the software diff --git a/Changelog.md b/Changelog.md index 211119ff2..16e2491b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,34 @@ ## libsdformat 15.X +### libsdformat 15.1.0 (2024-11-13) + +1. Bazel CI + * [Pull request #1500](https://github.com/gazebosim/sdformat/pull/1500) + +1. Add bzlmod support to sdf15 + * [Pull request #1493](https://github.com/gazebosim/sdformat/pull/1493) + +1. Support removing the actor, light, or model from the root + * [Pull request #1492](https://github.com/gazebosim/sdformat/pull/1492) + +1. Only look for psutil if testing is enabled + * [Pull request #1495](https://github.com/gazebosim/sdformat/pull/1495) + +1. Improve installation instructions + * [Pull request #1496](https://github.com/gazebosim/sdformat/pull/1496) + +1. Permit building python bindings separately from libsdformat library + * [Pull request #1491](https://github.com/gazebosim/sdformat/pull/1491) + +1. Change sdf\_config.h to sdf/config.hh everywhere + * [Pull request #1494](https://github.com/gazebosim/sdformat/pull/1494) + +1. Improve installation instructions + * [Pull request #1490](https://github.com/gazebosim/sdformat/pull/1490) + +1. Fix symbol checking test when compiled with debug symbols + * [Pull request #1474](https://github.com/gazebosim/sdformat/pull/1474) + ### libsdformat 15.0.0 (2024-09-25) 1. **Baseline:** this includes all changes from 14.5.0 and earlier. diff --git a/package.xml b/package.xml index 2cfe9abe1..860e2e4b4 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ sdformat15 - 15.0.0 + 15.1.0 SDFormat is an XML file format that describes environments, objects, and robots in a manner suitable for robotic applications From 66e4eadf3ba7fd553e644f86f263ee1363d18d7f Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Fri, 15 Nov 2024 15:18:26 -0600 Subject: [PATCH 12/16] Fix bazel rules for layering_check and parse_headers with clang (#1507) Signed-off-by: Michael Carroll --- BUILD.bazel | 164 +++++++++++++++++++++++++++++++++++++++++- src/Converter.hh | 1 + src/SDFImplPrivate.hh | 1 + test/BUILD.bazel | 75 +++++++++++++++++++ 4 files changed, 240 insertions(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 280adfd4a..bed038e87 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,11 @@ load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = [":license"], - features = ["layering_check"], + default_visibility = ["__subpackages__"], + features = [ + "layering_check", + "parse_headers", + ], ) license( @@ -94,6 +98,8 @@ cc_library( "include/sdf/*.hh", ], exclude = [ + # Bazel does not generate top-level includes, so exclude the redirect + "include/sdf/sdf.hh", ], ), data = [ @@ -121,15 +127,24 @@ cc_library( "@gz-math//:Cylinder", "@gz-math//:Ellipsoid", "@gz-math//:Graph", + "@gz-math//:Helpers", "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Material", + "@gz-math//:Plane", "@gz-math//:Pose3", + "@gz-math//:Quaternion", "@gz-math//:SemanticVersion", "@gz-math//:Sphere", "@gz-math//:SphericalCoordinates", "@gz-math//:Temperature", "@gz-math//:Vector2", + "@gz-math//:Vector3", "@gz-utils//:Environment", "@gz-utils//:ImplPtr", + "@gz-utils//:NeverDestroyed", + "@gz-utils//:SuppressWarning", + "@tinyxml2", ], ) @@ -140,7 +155,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -152,6 +169,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -163,6 +181,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -175,6 +194,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -187,7 +207,10 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Temperature", + "@gz-math//:Vector3", ], ) @@ -199,7 +222,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -210,6 +238,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -222,7 +251,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -234,7 +268,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -246,7 +285,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -257,14 +301,18 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) cc_test( name = "Converter_TEST", srcs = [ + "src/Converter.hh", "src/Converter_TEST.cc", + "src/XmlUtils.hh", ], data = [ "sdf/1.10/1_9.convert", @@ -276,6 +324,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -287,7 +336,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -299,7 +350,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -311,6 +367,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -323,7 +380,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -333,8 +395,10 @@ cc_test( "src/Error_TEST.cc", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -346,6 +410,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -357,7 +422,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) @@ -369,6 +436,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -381,6 +449,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -388,15 +457,20 @@ cc_test( cc_test( name = "FrameSemantics_TEST", srcs = [ + "src/FrameSemantics.hh", "src/FrameSemantics_TEST.cc", + "src/ScopedGraph.hh", ], data = [ "//test:sdf", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Helpers", ], ) @@ -408,7 +482,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -420,6 +499,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -445,6 +525,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -457,6 +538,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -469,7 +551,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -481,7 +565,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -493,6 +579,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -505,7 +592,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", ], ) @@ -517,7 +606,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -529,7 +620,11 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -541,6 +636,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -553,7 +649,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -565,7 +663,11 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Vector3", ], ) @@ -577,7 +679,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -589,6 +693,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -601,6 +706,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -613,6 +719,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -625,18 +732,24 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", + "@gz-math//:Color", + "@gz-math//:Pose3", ], ) cc_test( name = "ParamPassing_TEST", srcs = [ + "src/ParamPassing.hh", "src/ParamPassing_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -653,18 +766,22 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) cc_test( name = "parser_urdf_TEST", srcs = [ + "src/parser_urdf.hh", "src/parser_urdf_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -680,6 +797,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -692,6 +810,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -704,7 +823,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -716,6 +837,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -728,7 +850,10 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector2", + "@gz-math//:Vector3", ], ) @@ -740,6 +865,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -752,6 +878,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -764,6 +891,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -776,6 +904,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -789,8 +918,10 @@ cc_test( "//test:sdf", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -803,6 +934,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -815,10 +947,14 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", "@gz-math//:Color", "@gz-math//:Pose3", "@gz-math//:Vector2", + "@gz-math//:Vector3", + "@gz-utils//:Environment", + "@gz-utils//:SuppressWarning", ], ) @@ -830,7 +966,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -842,6 +980,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -854,6 +993,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -866,7 +1006,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -878,7 +1023,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -890,6 +1037,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -897,12 +1045,15 @@ cc_test( cc_test( name = "Utils_TEST", srcs = [ + "src/Utils.hh", "src/Utils_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -914,6 +1065,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -926,19 +1078,29 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:SphericalCoordinates", + "@gz-math//:Vector3", ], ) cc_test( name = "XmlUtils_TEST", srcs = [ + "src/XmlUtils.hh", "src/XmlUtils_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@tinyxml2", ], ) diff --git a/src/Converter.hh b/src/Converter.hh index 27865a934..0c0551aff 100644 --- a/src/Converter.hh +++ b/src/Converter.hh @@ -25,6 +25,7 @@ #include #include #include "sdf/system_util.hh" +#include namespace sdf { diff --git a/src/SDFImplPrivate.hh b/src/SDFImplPrivate.hh index eefc57fcd..382718147 100644 --- a/src/SDFImplPrivate.hh +++ b/src/SDFImplPrivate.hh @@ -20,6 +20,7 @@ #include #include "sdf/Types.hh" +#include "sdf/Element.hh" /// \ingroup sdf_parser /// \brief namespace for Simulation Description Format parser diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 1c48caa3f..1a6e82814 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -41,6 +41,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -56,6 +57,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -71,6 +73,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -87,6 +90,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -102,6 +106,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -118,6 +123,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -133,6 +139,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -149,6 +156,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -165,6 +173,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -197,6 +206,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -212,6 +222,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -230,6 +241,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -245,6 +257,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -260,7 +273,9 @@ cc_test( ], deps = [ ":test_utils", + "//:Config", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -276,6 +291,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -291,6 +307,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -306,6 +323,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -327,7 +345,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -344,6 +364,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -359,6 +380,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -371,6 +393,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -387,6 +410,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -402,6 +426,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -417,7 +442,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -429,7 +456,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -444,6 +473,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -456,6 +486,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -471,7 +502,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -486,6 +519,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -502,7 +536,10 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -517,6 +554,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -536,7 +574,10 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -552,6 +593,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -573,6 +615,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -589,6 +632,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -601,6 +645,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -616,7 +661,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -628,6 +675,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -639,6 +687,7 @@ cc_test( ], deps = [ "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -654,6 +703,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -670,7 +720,11 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -681,6 +735,7 @@ cc_test( ], deps = [ "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -697,6 +752,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -712,7 +768,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -727,6 +785,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -742,6 +801,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -757,6 +817,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -772,7 +833,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -800,6 +863,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -816,6 +880,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -831,6 +896,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -846,6 +912,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -861,6 +928,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -876,6 +944,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -894,6 +963,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -909,6 +979,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -926,6 +997,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -941,6 +1013,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -957,6 +1030,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -972,6 +1046,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) From 0a36844221a90b3f6d12e1c635e3da76214ebcdc Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Fri, 15 Nov 2024 17:50:10 -0800 Subject: [PATCH 13/16] Enable header layering checks for bazel build (#1505) Signed-off-by: Shameek Ganguly --- .bazelrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bazelrc b/.bazelrc index f2d06137d..bdb2bfc88 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,3 +10,6 @@ build --strip=never build --strict_system_includes build --fission=dbg build --features=per_object_debug_info + +# Enable header processing, required for layering checks with parse_header. +build --process_headers_in_dependencies From cc524e7ebea952652aea3b03a95f13dc6416c563 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Fri, 15 Nov 2024 19:58:07 -0600 Subject: [PATCH 14/16] Prepare for release 15.1.1 (#1508) Signed-off-by: Michael Carroll --- CMakeLists.txt | 2 +- Changelog.md | 10 ++++++++++ package.xml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29cc1bcdf..0fedcd424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0004 NEW) endif(COMMAND CMAKE_POLICY) -project (sdformat15 VERSION 15.1.0) +project (sdformat15 VERSION 15.1.1) # The protocol version has nothing to do with the package version. # It represents the current version of SDFormat implemented by the software diff --git a/Changelog.md b/Changelog.md index 16e2491b4..739fe6b6c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,15 @@ ## libsdformat 15.X +### libsdformat 15.1.1 (2024-11-15) + +1. **Baseline:** this includes all changes from 15.1.0 and earlier. + +1. Fix bazel rules for layering_check and parse_headers with clang + * [Pull request #1507](https://github.com/gazebosim/sdformat/pull/1507) + +1. Enable header layering checks for bazel build + * [Pull request #1505](https://github.com/gazebosim/sdformat/pull/1505) + ### libsdformat 15.1.0 (2024-11-13) 1. Bazel CI diff --git a/package.xml b/package.xml index 860e2e4b4..3b32ed407 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ sdformat15 - 15.1.0 + 15.1.1 SDFormat is an XML file format that describes environments, objects, and robots in a manner suitable for robotic applications From 4ebe022c231b6b46ee56ad46ecbabc8f3e9aa534 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 18 Nov 2024 13:48:43 +0100 Subject: [PATCH 15/16] Permit to test when building bindings separately from main library (#1509) Signed-off-by: Silvio Traversaro --- python/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 5baa66271..58be732aa 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -10,6 +10,12 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(CMAKE_REQUIRE_FIND_PACKAGE_pybind11 TRUE) include(GNUInstallDirs) include(CTest) + + if(BUILD_TESTING) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../test/test_config.hh.in + ${PROJECT_BINARY_DIR}/include/test_config.hh) + include_directories(${PROJECT_BINARY_DIR}/include) + endif() endif() set(PYBIND11_PYTHON_VERSION 3) @@ -199,10 +205,10 @@ if (BUILD_TESTING AND NOT WIN32) foreach (test ${python_tests}) if (pytest_FOUND) add_test(NAME ${test}.py COMMAND - "${Python3_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/${test}.xml") + "${Python3_EXECUTABLE}" -m pytest "${CMAKE_CURRENT_SOURCE_DIR}/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/${test}.xml") else() add_test(NAME ${test}.py COMMAND - "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py") + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/test/${test}.py") endif() set(_env_vars) list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/:${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH}") From 69c82c00fae5102f360b299ff6f396bab126ced3 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 2 Dec 2024 20:39:37 -0800 Subject: [PATCH 16/16] python bindings: get version from package.xml (#1504) Requires gz-cmake4 4.1.0. Signed-off-by: Steve Peters --- python/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 58be732aa..81bf3c1f0 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,9 +1,10 @@ # Detect if we are doing a standalone build of the bindings, using an external sdformat if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.22.1) - set(SDF_VER 15) - project(sdformat${SDF_VER}-python VERSION ${SDF_VER}) - find_package(sdformat${SDF_VER} REQUIRED) + find_package(gz-cmake4 4.1.0 REQUIRED) + gz_get_package_xml_version(${CMAKE_SOURCE_DIR}/../package.xml PACKAGE_XML) + project(sdformat${PACKAGE_XML_VERSION_MAJOR}-python VERSION ${PACKAGE_XML_VERSION}) + find_package(sdformat${PROJECT_VERSION_MAJOR} REQUIRED) set(PROJECT_LIBRARY_TARGET_NAME "sdformat${PROJECT_VERSION_MAJOR}::sdformat${PROJECT_VERSION_MAJOR}") # require python dependencies to be found find_package(Python3 COMPONENTS Interpreter Development REQUIRED)