Skip to content

Commit

Permalink
Find numpy headers in non-debian paths
Browse files Browse the repository at this point in the history
Update rosidl_generator_py to test for numpy headers exist on the python
include paths, and query numpy for its include path if the headers are
not found.

Resolves ros2#66

Signed-off-by: Rich Mattes <[email protected]>
  • Loading branch information
richmattes committed Jul 20, 2019
1 parent cc7f838 commit 4f3ff4d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ target_include_directories(${_target_name_lib}
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_py
${PythonExtra_INCLUDE_DIRS}
)
if(APPLE OR WIN32)

# Check if numpy is in the include path
find_file(_numpy_h numpy/numpyconfig.h
PATHS ${PythonExtra_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
)

if(APPLE OR WIN32 OR NOT _numpy_h )
# add include directory for numpy headers
set(_python_code
"import numpy"
Expand All @@ -208,6 +215,8 @@ if(APPLE OR WIN32)
"error code ${_result}")
endif()
target_include_directories(${_target_name_lib} PUBLIC "${_output}")

message(STATUS "Using NUMPY_INCLUDE_DIR: ${_output}")
endif()

rosidl_target_interfaces(${_target_name_lib}
Expand Down

0 comments on commit 4f3ff4d

Please sign in to comment.