Skip to content

Commit

Permalink
Fix registration of types into factory
Browse files Browse the repository at this point in the history
Force linking the factory registration singletons in the g2opy wrapper.
This should fix usage of the factory when statically linking the g2o
libraries.
  • Loading branch information
RainerKuemmerle committed Feb 24, 2024
1 parent 6079f78 commit d0a40ca
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ option (BUILD_SHARED_LIBS "Build Shared Libraries (preferred and required for th
set (G2O_LIB_TYPE STATIC)
if (BUILD_SHARED_LIBS)
set (G2O_LIB_TYPE SHARED)
else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

# On the Mac platform, configure the RPATH as per the INSTALL, to
Expand Down
3 changes: 3 additions & 0 deletions python/types/icp/py_types_icp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

#include <g2o/types/icp/types_icp.h>

#include "g2o/core/factory.h"
#include "g2opy.h"
#include "python/core/py_base_binary_edge.h"
#include "python/core/py_base_edge.h"
#include "python/core/py_base_vertex.h"

G2O_USE_TYPE_GROUP(icp)

namespace g2o {

void declareTypesICP(py::module& m) {
Expand Down
3 changes: 3 additions & 0 deletions python/types/sba/py_types_sba.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#include "py_types_sba.h"

#include "g2o/core/factory.h"
#include "g2o/types/sba/types_sba.h"
#include "g2o/types/sba/vertex_intrinsics.h"
#include "g2opy.h"
#include "python/core/py_base_binary_edge.h"
#include "python/core/py_base_vertex.h"

G2O_USE_TYPE_GROUP(sba)

namespace g2o {

namespace {
Expand Down
3 changes: 3 additions & 0 deletions python/types/sba/py_types_six_dof_expmap.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "py_types_six_dof_expmap.h"

#include "g2o/core/factory.h"
#include "g2o/types/sba/edge_project_xyz.h"
#include "g2o/types/sba/types_six_dof_expmap.h"
#include "g2o/types/slam3d/se3quat.h"
Expand All @@ -9,6 +10,8 @@
#include "python/core/py_base_unary_edge.h"
#include "python/core/py_base_variable_sized_edge.h"

G2O_USE_TYPE_GROUP(expmap)

namespace g2o {

void declareTypesSixDofExpmap(py::module& m) {
Expand Down
3 changes: 3 additions & 0 deletions python/types/sclam2d/py_types_sclam2d.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "py_types_sclam2d.h"

#include "g2o/core/factory.h"
#include "py_edge_se2_odom_differential_calib.h"
#include "py_edge_se2_sensor_calib.h"
#include "py_odometry_measurement.h"
#include "py_vertex_odom_differential_params.h"

G2O_USE_TYPE_GROUP(sclam)

namespace g2o {

void declareTypesSclam2d(py::module& m) {
Expand Down
3 changes: 3 additions & 0 deletions python/types/sim3/py_types_seven_dof_expmap.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "py_types_seven_dof_expmap.h"

#include "g2o/core/factory.h"
#include "g2o/types/sim3/types_seven_dof_expmap.h"
#include "g2opy.h"
#include "py_sim3.h"
#include "python/core/py_base_binary_edge.h"

G2O_USE_TYPE_GROUP(sim3)

namespace g2o {

void declareTypesSevenDofExpmap(py::module& m) {
Expand Down
3 changes: 3 additions & 0 deletions python/types/slam2d/py_types_slam2d.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "py_types_slam2d.h"

#include "g2o/core/factory.h"
#include "py_edge_pointxy.h"
#include "py_edge_se2.h"
#include "py_edge_se2_pointxy.h"
Expand All @@ -8,6 +9,8 @@
#include "py_vertex_point_xy.h"
#include "py_vertex_se2.h"

G2O_USE_TYPE_GROUP(slam2d)

namespace g2o {

void declareTypesSlam2d(py::module& m) {
Expand Down
3 changes: 3 additions & 0 deletions python/types/slam3d/py_types_slam3d.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "py_types_slam3d.h"

#include "g2o/core/factory.h"
#include "py_edge_pointxyz.h"
#include "py_edge_se3.h"
#include "py_edge_se3_pointxyz.h"
Expand All @@ -8,6 +9,8 @@
#include "py_vertex_pointxyz.h"
#include "py_vertex_se3.h"

G2O_USE_TYPE_GROUP(slam3d)

namespace g2o {

void declareTypesSlam3d(py::module& m) {
Expand Down

0 comments on commit d0a40ca

Please sign in to comment.