diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9edd1b291..e536c749f 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -36,7 +36,10 @@ function(configure_build_install_location _library_name) ) endfunction() -pybind11_add_module(sdformat MODULE +# sdformatX target already exists, use pysdformatX + OUTPUT_NAME to get +# sdformatX file name generated and map BINDINGS_MODULE_NAME to sdformatX +set(BINDINGS_MODULE_NAME "pysdformat${PROJECT_VERSION_MAJOR}") +pybind11_add_module(${BINDINGS_MODULE_NAME} MODULE src/sdf/_gz_sdformat_pybind11.cc src/sdf/pyAirPressure.cc src/sdf/pyAltimeter.cc @@ -84,11 +87,19 @@ pybind11_add_module(sdformat MODULE src/sdf/pybind11_helpers.cc ) -target_link_libraries(sdformat PRIVATE +target_link_libraries(${BINDINGS_MODULE_NAME} PRIVATE ${PROJECT_LIBRARY_TARGET_NAME} ) -configure_build_install_location(sdformat) +# different from the target name since the target name was not able to use +# sdformatX since it conflicts with the project name +target_compile_definitions(${BINDINGS_MODULE_NAME} PRIVATE + BINDINGS_MODULE_NAME=sdformat${PROJECT_VERSION_MAJOR}) + +set_target_properties(${BINDINGS_MODULE_NAME} PROPERTIES + OUTPUT_NAME "sdformat${PROJECT_VERSION_MAJOR}") + +configure_build_install_location(${BINDINGS_MODULE_NAME}) if (BUILD_TESTING) pybind11_add_module(sdformattest SHARED diff --git a/python/src/sdf/_gz_sdformat_pybind11.cc b/python/src/sdf/_gz_sdformat_pybind11.cc index 294819cde..681bf6990 100644 --- a/python/src/sdf/_gz_sdformat_pybind11.cc +++ b/python/src/sdf/_gz_sdformat_pybind11.cc @@ -62,7 +62,7 @@ #include "pyVisual.hh" #include "pyWorld.hh" -PYBIND11_MODULE(sdformat, m) { +PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) { m.doc() = "sdformat Python Library."; sdf::python::defineAirPressure(m); diff --git a/python/test/pyAirPressure_TEST.py b/python/test/pyAirPressure_TEST.py index f4ce64274..4abf3bccc 100644 --- a/python/test/pyAirPressure_TEST.py +++ b/python/test/pyAirPressure_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. from gz.math7 import Vector3d -from sdformat import AirPressure, Noise -import sdformat as sdf +from sdformat13 import AirPressure, Noise +import sdformat13 as sdf import unittest class AtmosphereTEST(unittest.TestCase): diff --git a/python/test/pyAltimeter_TEST.py b/python/test/pyAltimeter_TEST.py index 9189303c0..96253e5da 100644 --- a/python/test/pyAltimeter_TEST.py +++ b/python/test/pyAltimeter_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. from gz.math7 import Vector3d -from sdformat import Altimeter, Noise -import sdformat as sdf +from sdformat13 import Altimeter, Noise +import sdformat13 as sdf import unittest diff --git a/python/test/pyAtmosphere_TEST.py b/python/test/pyAtmosphere_TEST.py index 9d08a2a44..d2363c1af 100644 --- a/python/test/pyAtmosphere_TEST.py +++ b/python/test/pyAtmosphere_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. from gz.math7 import Pose3d, Temperature -from sdformat import Atmosphere -import sdformat as sdf +from sdformat13 import Atmosphere +import sdformat13 as sdf import unittest class AtmosphereTEST(unittest.TestCase): diff --git a/python/test/pyBox_TEST.py b/python/test/pyBox_TEST.py index df609011b..13e9a99ed 100644 --- a/python/test/pyBox_TEST.py +++ b/python/test/pyBox_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. from gz.math7 import Vector3d -from sdformat import Box +from sdformat13 import Box import unittest class BoxTEST(unittest.TestCase): diff --git a/python/test/pyCamera_TEST.py b/python/test/pyCamera_TEST.py index ec0f26499..67471694b 100644 --- a/python/test/pyCamera_TEST.py +++ b/python/test/pyCamera_TEST.py @@ -15,8 +15,8 @@ import copy from gz.math7 import Angle, Pose3d, Vector2d import math -from sdformat import Camera -import sdformat as sdf +from sdformat13 import Camera +import sdformat13 as sdf import unittest class CameraTEST(unittest.TestCase): diff --git a/python/test/pyCapsule_TEST.py b/python/test/pyCapsule_TEST.py index f2f694c17..8924c9ba2 100644 --- a/python/test/pyCapsule_TEST.py +++ b/python/test/pyCapsule_TEST.py @@ -18,7 +18,7 @@ import math -from sdformat import Capsule +from sdformat13 import Capsule import unittest diff --git a/python/test/pyCollision_TEST.py b/python/test/pyCollision_TEST.py index a17f72f45..a0efbecdd 100644 --- a/python/test/pyCollision_TEST.py +++ b/python/test/pyCollision_TEST.py @@ -14,9 +14,9 @@ import copy from gz.math7 import Pose3d -from sdformat import (Box, Collision, Contact, Cylinder, Error, Geometry, +from sdformat13 import (Box, Collision, Contact, Cylinder, Error, Geometry, Plane, Surface, Sphere, SDFErrorsException) -import sdformat as sdf +import sdformat13 as sdf import unittest import math diff --git a/python/test/pyCylinder_TEST.py b/python/test/pyCylinder_TEST.py index cdd818b25..55b5ecf9a 100644 --- a/python/test/pyCylinder_TEST.py +++ b/python/test/pyCylinder_TEST.py @@ -18,7 +18,7 @@ import math -from sdformat import Cylinder +from sdformat13 import Cylinder import unittest diff --git a/python/test/pyEllipsoid_TEST.py b/python/test/pyEllipsoid_TEST.py index f80bc4889..e66953bb9 100644 --- a/python/test/pyEllipsoid_TEST.py +++ b/python/test/pyEllipsoid_TEST.py @@ -15,7 +15,7 @@ import copy from gz.math7 import Vector3d, Ellipsoidd import math -from sdformat import Ellipsoid +from sdformat13 import Ellipsoid import unittest diff --git a/python/test/pyError_TEST.py b/python/test/pyError_TEST.py index b8c82e595..84aa5e32d 100644 --- a/python/test/pyError_TEST.py +++ b/python/test/pyError_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. import copy -from sdformat import Error -import sdformat as sdf +from sdformat13 import Error +import sdformat13 as sdf import unittest class ErrorColor(unittest.TestCase): diff --git a/python/test/pyForceTorque_TEST.py b/python/test/pyForceTorque_TEST.py index 7a72bff90..8b3ae782b 100644 --- a/python/test/pyForceTorque_TEST.py +++ b/python/test/pyForceTorque_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. import copy -from sdformat import ForceTorque, Noise -import sdformat as sdf +from sdformat13 import ForceTorque, Noise +import sdformat13 as sdf import unittest class ForceTorqueTEST(unittest.TestCase): diff --git a/python/test/pyFrame_TEST.py b/python/test/pyFrame_TEST.py index aea698bc0..89b9bbd99 100644 --- a/python/test/pyFrame_TEST.py +++ b/python/test/pyFrame_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Pose3d -from sdformat import Frame, Error, SDFErrorsException, ErrorCode +from sdformat13 import Frame, Error, SDFErrorsException, ErrorCode import unittest import math diff --git a/python/test/pyGeometry_TEST.py b/python/test/pyGeometry_TEST.py index e1220ef4b..60811c558 100644 --- a/python/test/pyGeometry_TEST.py +++ b/python/test/pyGeometry_TEST.py @@ -13,9 +13,9 @@ # limitations under the License. import copy -from sdformat import Geometry, Box, Capsule, Cylinder, Ellipsoid, Mesh, Plane, Sphere +from sdformat13 import Geometry, Box, Capsule, Cylinder, Ellipsoid, Mesh, Plane, Sphere from gz.math7 import Vector3d, Vector2d -import sdformat as sdf +import sdformat13 as sdf import unittest diff --git a/python/test/pyGui_TEST.py b/python/test/pyGui_TEST.py index 7c66ca4c4..7454ba590 100644 --- a/python/test/pyGui_TEST.py +++ b/python/test/pyGui_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Gui, Plugin +from sdformat13 import Gui, Plugin import unittest diff --git a/python/test/pyHeightmap_TEST.py b/python/test/pyHeightmap_TEST.py index ed6186eb4..6d2016e06 100644 --- a/python/test/pyHeightmap_TEST.py +++ b/python/test/pyHeightmap_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Vector3d -from sdformat import Heightmap, HeightmapBlend, HeightmapTexture +from sdformat13 import Heightmap, HeightmapBlend, HeightmapTexture import unittest diff --git a/python/test/pyIMU_TEST.py b/python/test/pyIMU_TEST.py index 42885ab7d..fb7b5ab27 100644 --- a/python/test/pyIMU_TEST.py +++ b/python/test/pyIMU_TEST.py @@ -14,8 +14,8 @@ import copy from gz.math7 import Vector3d -from sdformat import IMU, Noise -import sdformat as sdf +from sdformat13 import IMU, Noise +import sdformat13 as sdf import unittest class IMUTest(unittest.TestCase): diff --git a/python/test/pyJointAxis_TEST.py b/python/test/pyJointAxis_TEST.py index c158a6f23..4d742de54 100644 --- a/python/test/pyJointAxis_TEST.py +++ b/python/test/pyJointAxis_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Pose3d, Vector3d -from sdformat import JointAxis, Error, SDFErrorsException +from sdformat13 import JointAxis, Error, SDFErrorsException import math import unittest diff --git a/python/test/pyJoint_TEST.py b/python/test/pyJoint_TEST.py index ccbea9487..a526b8f99 100644 --- a/python/test/pyJoint_TEST.py +++ b/python/test/pyJoint_TEST.py @@ -14,9 +14,9 @@ import copy from gz.math7 import Pose3d, Vector3d -from sdformat import (Joint, JointAxis, Error, SemanticPose, Sensor, +from sdformat13 import (Joint, JointAxis, Error, SemanticPose, Sensor, SDFErrorsException) -import sdformat as sdf +import sdformat13 as sdf import math import unittest diff --git a/python/test/pyLidar_TEST.py b/python/test/pyLidar_TEST.py index 871f7c2e6..3b81fa255 100644 --- a/python/test/pyLidar_TEST.py +++ b/python/test/pyLidar_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Angle, Pose3d, Vector3d, Helpers -from sdformat import Lidar, Error, Noise +from sdformat13 import Lidar, Error, Noise import math import unittest diff --git a/python/test/pyLight_TEST.py b/python/test/pyLight_TEST.py index d7d9657f6..f24717dee 100644 --- a/python/test/pyLight_TEST.py +++ b/python/test/pyLight_TEST.py @@ -14,8 +14,8 @@ import copy from gz.math7 import Angle, Color, Pose3d, Vector3d -from sdformat import Light, SDFErrorsException -import sdformat as sdf +from sdformat13 import Light, SDFErrorsException +import sdformat13 as sdf import math import unittest diff --git a/python/test/pyLink_TEST.py b/python/test/pyLink_TEST.py index e4f8f2141..9f52d84a0 100644 --- a/python/test/pyLink_TEST.py +++ b/python/test/pyLink_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Pose3d, Inertiald, MassMatrix3d, Vector3d -from sdformat import (Collision, Light, Link, Sensor, Visual, +from sdformat13 import (Collision, Light, Link, Sensor, Visual, SDFErrorsException) import unittest import math diff --git a/python/test/pyMagnetometer_TEST.py b/python/test/pyMagnetometer_TEST.py index bb0ece24c..9366c0fe3 100644 --- a/python/test/pyMagnetometer_TEST.py +++ b/python/test/pyMagnetometer_TEST.py @@ -14,8 +14,8 @@ import copy from gz.math7 import Pose3d -from sdformat import Magnetometer, Noise -import sdformat as sdf +from sdformat13 import Magnetometer, Noise +import sdformat13 as sdf import unittest diff --git a/python/test/pyMaterial_TEST.py b/python/test/pyMaterial_TEST.py index 467682c91..98a5f8c03 100644 --- a/python/test/pyMaterial_TEST.py +++ b/python/test/pyMaterial_TEST.py @@ -13,9 +13,9 @@ # limitations under the License. import copy -from sdformat import Material, Pbr, PbrWorkflow +from sdformat13 import Material, Pbr, PbrWorkflow from gz.math7 import Color -import sdformat as sdf +import sdformat13 as sdf import unittest diff --git a/python/test/pyMesh_TEST.py b/python/test/pyMesh_TEST.py index 4f8a0d145..0bc65d2e0 100644 --- a/python/test/pyMesh_TEST.py +++ b/python/test/pyMesh_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Mesh +from sdformat13 import Mesh from gz.math7 import Vector3d import unittest diff --git a/python/test/pyModel_TEST.py b/python/test/pyModel_TEST.py index 8abbac38f..7d756ceda 100644 --- a/python/test/pyModel_TEST.py +++ b/python/test/pyModel_TEST.py @@ -14,9 +14,9 @@ import copy from gz.math7 import Pose3d, Vector3d -from sdformat import (Plugin, Model, Joint, Link, Error, Frame, SemanticPose, +from sdformat13 import (Plugin, Model, Joint, Link, Error, Frame, SemanticPose, SDFErrorsException) -import sdformat as sdf +import sdformat13 as sdf import math import unittest diff --git a/python/test/pyNavSat_TEST.py b/python/test/pyNavSat_TEST.py index e6383f06a..49d8c4aca 100644 --- a/python/test/pyNavSat_TEST.py +++ b/python/test/pyNavSat_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import NavSat, Noise +from sdformat13 import NavSat, Noise import unittest class NavSatColor(unittest.TestCase): diff --git a/python/test/pyNoise_TEST.py b/python/test/pyNoise_TEST.py index f8e47e61e..07d60b2b1 100644 --- a/python/test/pyNoise_TEST.py +++ b/python/test/pyNoise_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. import copy -from sdformat import Noise -import sdformat as sdf +from sdformat13 import Noise +import sdformat13 as sdf import math import unittest diff --git a/python/test/pyParserConfig_TEST.py b/python/test/pyParserConfig_TEST.py index d2516d98c..1c5558d43 100644 --- a/python/test/pyParserConfig_TEST.py +++ b/python/test/pyParserConfig_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import ParserConfig +from sdformat13 import ParserConfig from sdformattest import source_file, test_file import unittest diff --git a/python/test/pyParticleEmitter_TEST.py b/python/test/pyParticleEmitter_TEST.py index 03cadde60..eb119b37b 100644 --- a/python/test/pyParticleEmitter_TEST.py +++ b/python/test/pyParticleEmitter_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Color, Pose3d, Vector3d, Helpers -from sdformat import ParticleEmitter +from sdformat13 import ParticleEmitter import unittest diff --git a/python/test/pyPbr_TEST.py b/python/test/pyPbr_TEST.py index 2faf52164..d3a6585d5 100644 --- a/python/test/pyPbr_TEST.py +++ b/python/test/pyPbr_TEST.py @@ -13,8 +13,8 @@ # limitations under the License. import copy -from sdformat import Pbr, PbrWorkflow -import sdformat as sdf +from sdformat13 import Pbr, PbrWorkflow +import sdformat13 as sdf import unittest diff --git a/python/test/pyPhysics_TEST.py b/python/test/pyPhysics_TEST.py index d053a9d33..d8255799d 100644 --- a/python/test/pyPhysics_TEST.py +++ b/python/test/pyPhysics_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Physics +from sdformat13 import Physics import unittest diff --git a/python/test/pyPlane_TEST.py b/python/test/pyPlane_TEST.py index baa52b616..118304b01 100644 --- a/python/test/pyPlane_TEST.py +++ b/python/test/pyPlane_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Plane +from sdformat13 import Plane from gz.math7 import Vector3d, Vector2d, Planed import unittest diff --git a/python/test/pyPlugin_TEST.py b/python/test/pyPlugin_TEST.py index 058a7af87..c494c9985 100644 --- a/python/test/pyPlugin_TEST.py +++ b/python/test/pyPlugin_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Plugin +from sdformat13 import Plugin import unittest diff --git a/python/test/pyPolyline_TEST.py b/python/test/pyPolyline_TEST.py index 3a4f57a89..4f4b9ccc4 100644 --- a/python/test/pyPolyline_TEST.py +++ b/python/test/pyPolyline_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from sdformat import Polyline +from sdformat13 import Polyline from gz.math7 import Vector2d import unittest diff --git a/python/test/pyRoot_TEST.py b/python/test/pyRoot_TEST.py index c0909a449..d2fb58ef0 100644 --- a/python/test/pyRoot_TEST.py +++ b/python/test/pyRoot_TEST.py @@ -14,9 +14,9 @@ import copy from gz.math7 import Vector3d, Pose3d -from sdformat import (Error, Model, Light, Root, SDF_VERSION, +from sdformat13 import (Error, Model, Light, Root, SDF_VERSION, SDFErrorsException, SDF_PROTOCOL_VERSION, World) -import sdformat as sdf +import sdformat13 as sdf import unittest diff --git a/python/test/pyScene_TEST.py b/python/test/pyScene_TEST.py index d0d572133..b5398465b 100644 --- a/python/test/pyScene_TEST.py +++ b/python/test/pyScene_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Color -from sdformat import Scene, Sky +from sdformat13 import Scene, Sky import unittest diff --git a/python/test/pySemanticPose_TEST.py b/python/test/pySemanticPose_TEST.py index 06f3b5f6a..4218be6e3 100644 --- a/python/test/pySemanticPose_TEST.py +++ b/python/test/pySemanticPose_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Pose3d -from sdformat import Link, SemanticPose +from sdformat13 import Link, SemanticPose import unittest class semantic_poseTEST(unittest.TestCase): diff --git a/python/test/pySensor_TEST.py b/python/test/pySensor_TEST.py index 69bd50e87..6215941e1 100644 --- a/python/test/pySensor_TEST.py +++ b/python/test/pySensor_TEST.py @@ -14,10 +14,10 @@ import copy from gz.math7 import Pose3d -from sdformat import (AirPressure, Altimeter, Camera, IMU, ForceTorque, Lidar, +from sdformat13 import (AirPressure, Altimeter, Camera, IMU, ForceTorque, Lidar, Magnetometer, NavSat, Noise, Plugin, SemanticPose, Sensor, SDFErrorsException) -import sdformat as sdf +import sdformat13 as sdf import unittest diff --git a/python/test/pySky_TEST.py b/python/test/pySky_TEST.py index 16c1dda18..1967d548a 100644 --- a/python/test/pySky_TEST.py +++ b/python/test/pySky_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Angle, Color -from sdformat import Sky +from sdformat13 import Sky import unittest diff --git a/python/test/pySphere_TEST.py b/python/test/pySphere_TEST.py index d72b6536c..792719f27 100644 --- a/python/test/pySphere_TEST.py +++ b/python/test/pySphere_TEST.py @@ -15,7 +15,7 @@ import copy from gz.math7 import Sphered import math -from sdformat import Sphere +from sdformat13 import Sphere import unittest class SphereTEST(unittest.TestCase): diff --git a/python/test/pySurface_TEST.py b/python/test/pySurface_TEST.py index 86c4404f8..b40130464 100644 --- a/python/test/pySurface_TEST.py +++ b/python/test/pySurface_TEST.py @@ -14,7 +14,7 @@ import copy from gz.math7 import Vector3d -from sdformat import Surface, Contact, Friction, ODE +from sdformat13 import Surface, Contact, Friction, ODE import unittest diff --git a/python/test/pyVisual_TEST.py b/python/test/pyVisual_TEST.py index 65020546c..91a0f1c4b 100644 --- a/python/test/pyVisual_TEST.py +++ b/python/test/pyVisual_TEST.py @@ -14,8 +14,8 @@ import copy from gz.math7 import Pose3d, Color -from sdformat import Geometry, Material, Visual, Plugin, SDFErrorsException -import sdformat as sdf +from sdformat13 import Geometry, Material, Visual, Plugin, SDFErrorsException +import sdformat13 as sdf import unittest import math diff --git a/python/test/pyWorld_TEST.py b/python/test/pyWorld_TEST.py index 583b1aa5f..6c053bdd4 100644 --- a/python/test/pyWorld_TEST.py +++ b/python/test/pyWorld_TEST.py @@ -14,8 +14,8 @@ import copy from gz.math7 import Color, Pose3d, Vector3d, SphericalCoordinates -from sdformat import Atmosphere, Gui, Physics, Plugin, Error, Frame, Light, Model, Scene, World -import sdformat as sdf +from sdformat13 import Atmosphere, Gui, Physics, Plugin, Error, Frame, Light, Model, Scene, World +import sdformat13 as sdf import unittest import math