Skip to content

Commit e8e3166

Browse files
fix: numpy
1 parent c53d15c commit e8e3166

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ endif()
5151
# Cf. https://github.com/pybind/pybind11/issues/2268
5252
#find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED)
5353
# the above line uses a deprecated cmake method, use the following instead
54-
find_package(Python COMPONENTS Interpreter REQUIRED)
54+
find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
5555

5656
set(pybind11_REQUIRED_VERSION 2.6.1)
5757
if(TARGET pybind11 OR TARGET pybind11::headers)
@@ -62,12 +62,6 @@ else()
6262
message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIRS}/pybind11")
6363
endif()
6464

65-
# Look for NumPy headers, except if NUMPY_INCLUDE_DIRS is passed,
66-
# which is required under some circumstances (such as wasm, where
67-
# there is no real python executable)
68-
if(NOT Python_NumPy_INCLUDE_DIR)
69-
find_package(NumPy REQUIRED)
70-
endif()
7165
message(STATUS "Found numpy: ${Python_NumPy_INCLUDE_DIR}")
7266

7367
# Build
@@ -87,7 +81,7 @@ set(XTENSOR_PYTHON_HEADERS
8781

8882
add_library(xtensor-python INTERFACE)
8983
target_include_directories(xtensor-python INTERFACE
90-
"$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR};${pybind11_INCLUDE_DIRS};${NUMPY_INCLUDE_DIRS}>"
84+
"$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR};${pybind11_INCLUDE_DIRS};${Python_NumPy_INCLUDE_DIR}>"
9185
$<INSTALL_INTERFACE:include>)
9286
target_link_libraries(xtensor-python INTERFACE xtensor)
9387
get_target_property(inc_dir xtensor-python INTERFACE_INCLUDE_DIRECTORIES)

0 commit comments

Comments
 (0)