Skip to content

Commit b05b4b3

Browse files
committed
fix fmt and pybind11 bugs
1 parent 2fce518 commit b05b4b3

1 file changed

Lines changed: 65 additions & 11 deletions

File tree

patch/ros-lyrical-moveit-task-constructor-core.patch

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ index e217ad6..708a2fb 100644
2424
/// function callback used to initialize property value from another PropertyMap
2525
using InitializerFunction = std::function<boost::any(const PropertyMap&)>;
2626

27-
diff --git a/python/bindings/CMakeLists.txt b/python/bindings/CMakeLists.txt
28-
index 26c86ac..d5cd670 100644
29-
--- a/python/bindings/CMakeLists.txt
30-
+++ b/python/bindings/CMakeLists.txt
31-
@@ -17,6 +17,7 @@ pybind11_add_module(pymoveit_mtc
27+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
28+
index 82e9875..147aa7b 100644
29+
--- a/src/CMakeLists.txt
30+
+++ b/src/CMakeLists.txt
31+
@@ -38,7 +38,7 @@ add_library(${PROJECT_NAME} SHARED
32+
solvers/multi_planner.cpp
3233
)
33-
target_include_directories(pymoveit_mtc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
34-
target_link_libraries(pymoveit_mtc PUBLIC ${PROJECT_NAME} ${PROJECT_NAME}_stages ${PROJECT_NAME}_python_tools)
35-
+set_target_properties(pymoveit_mtc PROPERTIES CXX_SCAN_FOR_MODULES OFF)
36-
37-
# install libs
38-
install(TARGETS ${PROJECT_NAME}_python_tools
34+
target_link_libraries(${PROJECT_NAME}
35+
- fmt
36+
+ fmt::fmt
37+
${moveit_core_TARGETS}
38+
${moveit_ros_planning_TARGETS}
39+
${moveit_ros_planning_interface_TARGETS}
3940
diff --git a/src/container.cpp b/src/container.cpp
4041
index febc00f..fded044 100644
4142
--- a/src/container.cpp
@@ -235,3 +236,56 @@ index 1c0553c..39bfa92 100644
235236
auto cb = [&called](const SolutionBase& /* s */) {
236237
++called;
237238
return true;
239+
diff --git a/python/bindings/CMakeLists.txt b/python/bindings/CMakeLists.txt
240+
--- a/python/bindings/CMakeLists.txt
241+
+++ b/python/bindings/CMakeLists.txt
242+
@@ -2,8 +2,15 @@
243+
add_library(${PROJECT_NAME}_python_tools SHARED
244+
${INCLUDES}/properties.h
245+
src/properties.cpp
246+
)
247+
+# Force our vendored (smart_holder) pybind11 to be found before any pybind11
248+
+# pulled in transitively via py_binding_tools, which links against the plain
249+
+# upstream pybind11 package. Mixing the two copies in one translation unit
250+
+# causes duplicate-definition errors, since smart_holder.h only exists in
251+
+# the vendored fork.
252+
+target_include_directories(${PROJECT_NAME}_python_tools BEFORE PUBLIC
253+
+ ${CMAKE_CURRENT_SOURCE_DIR}/../pybind11/include)
254+
target_link_libraries(${PROJECT_NAME}_python_tools PUBLIC ${PROJECT_NAME}
255+
pybind11::pybind11 py_binding_tools::py_binding_tools)
256+
# Use minimum-size optimization for pybind11 bindings
257+
target_link_libraries(${PROJECT_NAME}_python_tools PUBLIC pybind11::opt_size)
258+
@@ -15,7 +15,9 @@
259+
src/stages.cpp
260+
src/module.cpp
261+
)
262+
+target_include_directories(pymoveit_mtc BEFORE PUBLIC
263+
+ ${CMAKE_CURRENT_SOURCE_DIR}/../pybind11/include)
264+
target_include_directories(pymoveit_mtc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
265+
target_link_libraries(pymoveit_mtc PUBLIC ${PROJECT_NAME} ${PROJECT_NAME}_stages ${PROJECT_NAME}_python_tools)
266+
267+
# install libs
268+
diff --git a/python/bindings/src/properties.cpp b/python/bindings/src/properties.cpp
269+
--- a/python/bindings/src/properties.cpp
270+
+++ b/python/bindings/src/properties.cpp
271+
@@ -158,6 +158,8 @@
272+
return REGISTRY_SINGLETON.insert(type_index, ros_msg_name, to, from);
273+
}
274+
275+
+#if !defined(_MSC_VER)
276+
__attribute__((visibility("default"))) // export this symbol as visible in the shared library
277+
+#endif
278+
void export_properties(py::module& m) {
279+
// clang-format off
280+
diff --git a/python/bindings/src/solvers.cpp b/python/bindings/src/solvers.cpp
281+
--- a/python/bindings/src/solvers.cpp
282+
+++ b/python/bindings/src/solvers.cpp
283+
@@ -73,7 +73,7 @@
284+
pipelinePlanner = core.PipelinePlanner(node, 'ompl', 'PRMkConfigDefault')
285+
pipelinePlanner.num_planning_attempts = 10
286+
)")
287+
- .property<uint>("num_planning_attempts", "int: Number of planning attempts")
288+
+ .property<uint32_t>("num_planning_attempts", "int: Number of planning attempts")
289+
.property<moveit_msgs::msg::WorkspaceParameters>(
290+
"workspace_parameters",
291+
":moveit_msgs:`WorkspaceParameters`: Specifies workspace box to be used for Cartesian sampling")

0 commit comments

Comments
 (0)