Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
cmake_minimum_required(VERSION 3.29)
project(xtensor-python)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(XTENSOR_PYTHON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

# Versioning
Expand Down Expand Up @@ -46,7 +45,7 @@ else()
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
endif()

find_package(Python COMPONENTS Interpreter REQUIRED)
find_package(Python3 COMPONENTS Development.Embed NumPy REQUIRED)

set(pybind11_REQUIRED_VERSION 3.0.0)
if (NOT TARGET pybind11::headers)
Expand All @@ -60,14 +59,6 @@ else ()
message(STATUS "Found pybind11 v${pybind11_VERSION}")
endif ()

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

# Build
# =====

Expand All @@ -84,10 +75,8 @@ set(XTENSOR_PYTHON_HEADERS
)

add_library(xtensor-python INTERFACE)
target_include_directories(xtensor-python INTERFACE
"$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR};${pybind11_INCLUDE_DIRS};${NUMPY_INCLUDE_DIRS}>"
$<INSTALL_INTERFACE:include>)
target_link_libraries(xtensor-python INTERFACE xtensor)
target_include_directories(xtensor-python INTERFACE "$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR}>" $<INSTALL_INTERFACE:include>)
target_link_libraries(xtensor-python INTERFACE xtensor pybind11::pybind11 Python3::NumPy)
get_target_property(inc_dir xtensor-python INTERFACE_INCLUDE_DIRECTORIES)

OPTION(BUILD_TESTS "xtensor test suite" OFF)
Expand Down
89 changes: 0 additions & 89 deletions cmake/FindNumPy.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions docs/source/examples/copy_cast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ project(mymodule)
find_package(pybind11 CONFIG REQUIRED)
find_package(xtensor REQUIRED)
find_package(xtensor-python REQUIRED)
find_package(Python REQUIRED COMPONENTS NumPy)
find_package(Python3 REQUIRED COMPONENTS NumPy)

pybind11_add_module(mymodule main.cpp)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python::NumPy)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python3::NumPy)

target_compile_definitions(mymodule PRIVATE VERSION_INFO=0.1.0)
4 changes: 2 additions & 2 deletions docs/source/examples/readme_example_1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.29)

project(mymodule)

find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(pybind11 REQUIRED CONFIG)
find_package(xtensor REQUIRED)
find_package(xtensor-python REQUIRED)

pybind11_add_module(mymodule main.cpp)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python::NumPy)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python3::NumPy)

target_compile_definitions(mymodule PRIVATE VERSION_INFO=0.1.0)
4 changes: 2 additions & 2 deletions docs/source/examples/sfinae/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.29)

project(mymodule)

find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(pybind11 REQUIRED CONFIG)
find_package(xtensor REQUIRED)
find_package(xtensor-python REQUIRED)

pybind11_add_module(mymodule python.cpp)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python::NumPy)
target_link_libraries(mymodule PUBLIC pybind11::module xtensor-python Python3::NumPy)

target_compile_definitions(mymodule PRIVATE VERSION_INFO=0.1.0)

Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ set(XTENSOR_PYTHON_TESTS
)

add_executable(test_xtensor_python ${XTENSOR_PYTHON_TESTS} ${XTENSOR_PYTHON_HEADERS})
target_link_libraries(test_xtensor_python xtensor-python ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${PYTHON_LIBRARIES})
target_link_libraries(test_xtensor_python xtensor-python ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} Python3::Python)

if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
add_dependencies(test_xtensor_python gtest_main)
Expand Down
Loading