1
1
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
3
3
--- a/cmake/rosidl_generator_py_generate_interfaces.cmake
4
4
+++ 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)
6
8
9
+ - find_package(PythonInterp 3.6 REQUIRED)
10
+ -
7
11
find_package(python_cmake_module REQUIRED)
8
12
find_package(PythonExtra MODULE REQUIRED)
9
13
+ find_package(Python3 REQUIRED COMPONENTS Development NumPy)
10
14
11
15
# Get a list of typesupport implementations from valid rmw implementations.
12
16
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")
14
18
set(_target_name_lib "${rosidl_generate_interfaces_TARGET}${rosidl_generator_py_suffix}")
15
19
add_library(${_target_name_lib} SHARED ${_generated_c_files})
16
20
target_link_libraries(${_target_name_lib}
@@ -31,13 +35,13 @@ index a6d8263..ecae76b 100644
31
35
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_c
32
36
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_py
33
37
- ${PythonExtra_INCLUDE_DIRS}
34
- )
35
-
38
+ - )
39
+ -
36
40
- # Check if numpy is in the include path
37
41
- find_file(_numpy_h numpy/numpyconfig.h
38
42
- PATHS ${PythonExtra_INCLUDE_DIRS}
39
- - )
40
- -
43
+ )
44
+
41
45
- if(APPLE OR WIN32 OR NOT _numpy_h)
42
46
- # add include directory for numpy headers
43
47
- set(_python_code
@@ -57,20 +61,20 @@ index a6d8263..ecae76b 100644
57
61
- endif()
58
62
- message(STATUS "Using numpy include directory: ${_output}")
59
63
- target_include_directories(${_target_name_lib} PUBLIC "${_output}")
60
- - endif()
61
64
+ 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})
63
67
+ 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()
66
70
67
71
rosidl_get_typesupport_target(c_typesupport_target "${rosidl_generate_interfaces_TARGET}" "rosidl_typesupport_c")
68
72
- target_link_libraries(${_target_name_lib} ${c_typesupport_target})
69
73
+ target_link_libraries(${_target_name_lib} PUBLIC ${c_typesupport_target})
70
74
71
75
foreach(_typesupport_impl ${_typesupport_impls})
72
76
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})
74
78
endif()
75
79
target_link_libraries(
76
80
${_target_name}
@@ -103,7 +107,7 @@ index a6d8263..ecae76b 100644
103
107
${_pkg_name}
104
108
)
105
109
endforeach()
106
- @@ -273,7 +246 ,7 @@ foreach(_typesupport_impl ${_typesupport_impls})
110
+ @@ -273,7 +249 ,7 @@ foreach(_typesupport_impl ${_typesupport_impls})
107
111
add_dependencies(${_target_name}
108
112
${rosidl_generate_interfaces_TARGET}__${_typesupport_impl}
109
113
)
@@ -112,7 +116,7 @@ index a6d8263..ecae76b 100644
112
116
"rosidl_runtime_c"
113
117
"rosidl_generator_py"
114
118
)
115
- @@ -288,7 +261 ,7 @@ set(PYTHON_EXECUTABLE ${_PYTHON_EXECUTABLE})
119
+ @@ -288,7 +264 ,7 @@ set(PYTHON_EXECUTABLE ${_PYTHON_EXECUTABLE})
116
120
117
121
# Depend on rosidl_generator_py generated targets from our dependencies
118
122
foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
@@ -121,21 +125,18 @@ index a6d8263..ecae76b 100644
121
125
endforeach()
122
126
123
127
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)
125
129
MAX_LINE_LENGTH 0
126
130
"${_output_path}")
127
131
endif()
128
132
- endif()
129
133
+ endif()
130
134
\ No newline at end of file
131
135
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
133
137
--- a/rosidl_generator_py-extras.cmake.in
134
138
+++ 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 @@
139
140
include("${CMAKE_CURRENT_LIST_DIR}/register_py.cmake")
140
141
rosidl_generator_py_extras(
141
142
"${rosidl_generator_py_DIR}/../../../lib/rosidl_generator_py/rosidl_generator_py"
0 commit comments