Skip to content

Commit

Permalink
Fix not generator_py not linking to libpython
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias-Fischer committed Feb 28, 2024
1 parent 467101a commit 7d0d8be
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions patch/ros-humble-rosidl-generator-py.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ index a6d8263..ecae76b 100644

# Get a list of typesupport implementations from valid rmw implementations.
rosidl_generator_py_get_typesupports(_typesupport_impls)
@@ -165,52 +166,23 @@ set(rosidl_generator_py_suffix "__rosidl_generator_py")
@@ -165,52 +166,27 @@ set(rosidl_generator_py_suffix "__rosidl_generator_py")
set(_target_name_lib "${rosidl_generate_interfaces_TARGET}${rosidl_generator_py_suffix}")
add_library(${_target_name_lib} SHARED ${_generated_c_files})
target_link_libraries(${_target_name_lib}
Expand Down Expand Up @@ -58,7 +58,11 @@ index a6d8263..ecae76b 100644
- message(STATUS "Using numpy include directory: ${_output}")
- target_include_directories(${_target_name_lib} PUBLIC "${_output}")
-endif()
+target_link_libraries(${_target_name_lib} PRIVATE Python3::NumPy Python3::Module)
+if(APPLE)
+set_target_properties(${_target_name_lib} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
+else()
+target_link_libraries(${_target_name_lib} PUBLIC Python3::NumPy Python3::Module Python3::Python)
+endif()

rosidl_get_typesupport_target(c_typesupport_target "${rosidl_generate_interfaces_TARGET}" "rosidl_typesupport_c")
-target_link_libraries(${_target_name_lib} ${c_typesupport_target})
Expand Down

0 comments on commit 7d0d8be

Please sign in to comment.