Skip to content

Commit 403da1b

Browse files
Merge pull request #168 from wolfv/ros-idl-patch
update ros idl generate-py patch
2 parents 715930b + 6160420 commit 403da1b

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

patch/ros-humble-rosidl-generator-py.patch

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
diff --git a/cmake/rosidl_generator_py_generate_interfaces.cmake b/cmake/rosidl_generator_py_generate_interfaces.cmake
2-
index a6d8263..ecae76b 100644
2+
index a6d8263..f231ea2 100644
33
--- a/cmake/rosidl_generator_py_generate_interfaces.cmake
44
+++ b/cmake/rosidl_generator_py_generate_interfaces.cmake
5-
@@ -21,6 +21,7 @@ find_package(PythonInterp 3.6 REQUIRED)
5+
@@ -17,10 +17,9 @@ find_package(rosidl_runtime_c REQUIRED)
6+
find_package(rosidl_typesupport_c REQUIRED)
7+
find_package(rosidl_typesupport_interface REQUIRED)
68

9+
-find_package(PythonInterp 3.6 REQUIRED)
10+
-
711
find_package(python_cmake_module REQUIRED)
812
find_package(PythonExtra MODULE REQUIRED)
913
+find_package(Python3 REQUIRED COMPONENTS Development NumPy)
1014

1115
# Get a list of typesupport implementations from valid rmw implementations.
1216
rosidl_generator_py_get_typesupports(_typesupport_impls)
13-
@@ -165,52 +166,27 @@ set(rosidl_generator_py_suffix "__rosidl_generator_py")
17+
@@ -165,52 +164,28 @@ set(rosidl_generator_py_suffix "__rosidl_generator_py")
1418
set(_target_name_lib "${rosidl_generate_interfaces_TARGET}${rosidl_generator_py_suffix}")
1519
add_library(${_target_name_lib} SHARED ${_generated_c_files})
1620
target_link_libraries(${_target_name_lib}
@@ -31,13 +35,13 @@ index a6d8263..ecae76b 100644
3135
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_c
3236
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_py
3337
- ${PythonExtra_INCLUDE_DIRS}
34-
)
35-
38+
-)
39+
-
3640
-# Check if numpy is in the include path
3741
-find_file(_numpy_h numpy/numpyconfig.h
3842
- PATHS ${PythonExtra_INCLUDE_DIRS}
39-
-)
40-
-
43+
)
44+
4145
-if(APPLE OR WIN32 OR NOT _numpy_h)
4246
- # add include directory for numpy headers
4347
- set(_python_code
@@ -57,20 +61,20 @@ index a6d8263..ecae76b 100644
5761
- endif()
5862
- message(STATUS "Using numpy include directory: ${_output}")
5963
- target_include_directories(${_target_name_lib} PUBLIC "${_output}")
60-
-endif()
6164
+if(APPLE)
62-
+set_target_properties(${_target_name_lib} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
65+
+ set_target_properties(${_target_name_lib} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
66+
+ target_include_directories(${_target_name_lib} PUBLIC ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS})
6367
+else()
64-
+target_link_libraries(${_target_name_lib} PUBLIC Python3::NumPy Python3::Module Python3::Python)
65-
+endif()
68+
+ target_link_libraries(${_target_name_lib} PUBLIC Python3::NumPy Python3::Module Python3::Python)
69+
endif()
6670

6771
rosidl_get_typesupport_target(c_typesupport_target "${rosidl_generate_interfaces_TARGET}" "rosidl_typesupport_c")
6872
-target_link_libraries(${_target_name_lib} ${c_typesupport_target})
6973
+target_link_libraries(${_target_name_lib} PUBLIC ${c_typesupport_target})
7074

7175
foreach(_typesupport_impl ${_typesupport_impls})
7276
find_package(${_typesupport_impl} REQUIRED)
73-
@@ -245,27 +217,28 @@ foreach(_typesupport_impl ${_typesupport_impls})
77+
@@ -245,27 +220,28 @@ foreach(_typesupport_impl ${_typesupport_impls})
7478
endif()
7579
target_link_libraries(
7680
${_target_name}
@@ -103,7 +107,7 @@ index a6d8263..ecae76b 100644
103107
${_pkg_name}
104108
)
105109
endforeach()
106-
@@ -273,7 +246,7 @@ foreach(_typesupport_impl ${_typesupport_impls})
110+
@@ -273,7 +249,7 @@ foreach(_typesupport_impl ${_typesupport_impls})
107111
add_dependencies(${_target_name}
108112
${rosidl_generate_interfaces_TARGET}__${_typesupport_impl}
109113
)
@@ -112,7 +116,7 @@ index a6d8263..ecae76b 100644
112116
"rosidl_runtime_c"
113117
"rosidl_generator_py"
114118
)
115-
@@ -288,7 +261,7 @@ set(PYTHON_EXECUTABLE ${_PYTHON_EXECUTABLE})
119+
@@ -288,7 +264,7 @@ set(PYTHON_EXECUTABLE ${_PYTHON_EXECUTABLE})
116120

117121
# Depend on rosidl_generator_py generated targets from our dependencies
118122
foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
@@ -121,21 +125,18 @@ index a6d8263..ecae76b 100644
121125
endforeach()
122126

123127
set_lib_properties("")
124-
@@ -352,4 +325,4 @@ if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS)
128+
@@ -352,4 +328,4 @@ if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS)
125129
MAX_LINE_LENGTH 0
126130
"${_output_path}")
127131
endif()
128132
-endif()
129133
+endif()
130134
\ No newline at end of file
131135
diff --git a/rosidl_generator_py-extras.cmake.in b/rosidl_generator_py-extras.cmake.in
132-
index 80bed29..c2be2ce 100644
136+
index 80bed29..ba70acc 100644
133137
--- a/rosidl_generator_py-extras.cmake.in
134138
+++ b/rosidl_generator_py-extras.cmake.in
135-
@@ -1,7 +1,9 @@
136-
# generated from rosidl_generator_py/rosidl_generator_py-extras.cmake
137-
+find_package(Python3 REQUIRED COMPONENTS Development NumPy)
138-
+
139+
@@ -2,6 +2,6 @@
139140
include("${CMAKE_CURRENT_LIST_DIR}/register_py.cmake")
140141
rosidl_generator_py_extras(
141142
"${rosidl_generator_py_DIR}/../../../lib/rosidl_generator_py/rosidl_generator_py"

0 commit comments

Comments
 (0)