Files
ports/misc/py-onnxruntime/files/patch-cmake_onnxruntime__python.cmake
2026-10-04 04:07:15 +00:00

22 lines
1.0 KiB
CMake

-- Provide a fallback Python::NumPy imported target for builds where CMake's
-- FindPython does not detect NumPy 2.x headers (e.g. in poudriere). The
-- include directory is passed via ONNXRUNTIME_NUMPY_INCLUDE_DIR in the Makefile.
--- cmake/onnxruntime_python.cmake.orig 2026-09-10 06:09:41 UTC
+++ cmake/onnxruntime_python.cmake
@@ -220,6 +220,14 @@ endif()
# onnxruntime_pybind11_state is a DLL
target_sources(onnxruntime_pybind11_state PRIVATE "${ONNXRUNTIME_ROOT}/core/dll/dllmain.cc")
endif()
+# FreeBSD: CMake's FindPython may not detect NumPy 2.x headers in poudriere,
+# so provide a fallback imported target with the include directory supplied by
+# the port's Makefile via ONNXRUNTIME_NUMPY_INCLUDE_DIR.
+if(NOT TARGET Python::NumPy)
+ add_library(Python::NumPy INTERFACE IMPORTED)
+ set_target_properties(Python::NumPy PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${ONNXRUNTIME_NUMPY_INCLUDE_DIR}")
+endif()
target_link_libraries(onnxruntime_pybind11_state PRIVATE
onnxruntime_session
${onnxruntime_libs}