From 22684cbe9144f9cf15e2df7dfa55457266caca44 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 29 Oct 2024 10:13:07 -0700 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 9661794312763099cee6da1da613384210fae5db Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 6 Nov 2024 04:44:25 +0100 Subject: [PATCH 4/4] 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() ########################################