mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 05:39:30 +08:00
e718473ff3
* [onnx] update to 1.13.1 * update version
68 lines
2.8 KiB
Diff
68 lines
2.8 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 4dd56b6..2ff3e29 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -65,6 +65,27 @@ endif()
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
+# install protobuf files
|
|
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-data.proto
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-data.proto3
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-ml.proto
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-ml.proto3
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-operators-ml.proto
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-operators-ml.proto3
|
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnx
|
|
+)
|
|
+# install python files
|
|
+if(BUILD_ONNX_PYTHON)
|
|
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_data_pb.py
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_data_pb2.py
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_ml_pb2.py
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_operators_ml_pb2.py
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_operators_pb.py
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_pb.py
|
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnx
|
|
+ )
|
|
+endif()
|
|
+
|
|
set(ONNX_ROOT ${PROJECT_SOURCE_DIR})
|
|
|
|
# Read ONNX version
|
|
@@ -116,7 +137,8 @@ endif()
|
|
# find_package Python has replaced PythonInterp and PythonLibs since cmake 3.12
|
|
# Use the following command in the future; now this is only compatible with the latest pybind11
|
|
# find_package(Python ${PY_VERSION} COMPONENTS Interpreter Development REQUIRED)
|
|
-find_package(PythonInterp ${PY_VERSION} REQUIRED)
|
|
+find_package(Python3 ${PY_VERSION} COMPONENTS Interpreter REQUIRED)
|
|
+set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
|
|
if(BUILD_ONNX_PYTHON)
|
|
find_package(PythonLibs ${PY_VERSION})
|
|
endif()
|
|
@@ -434,6 +456,7 @@ target_link_libraries(onnx PUBLIC onnx_proto)
|
|
add_onnx_global_defines(onnx)
|
|
|
|
if(BUILD_ONNX_PYTHON)
|
|
+ find_package(Python3 ${PY_VERSION} COMPONENTS Development REQUIRED)
|
|
if("${PY_EXT_SUFFIX}" STREQUAL "")
|
|
if(MSVC)
|
|
set(PY_EXT_SUFFIX ".pyd")
|
|
@@ -452,10 +475,14 @@ if(BUILD_ONNX_PYTHON)
|
|
target_include_directories(onnx_cpp2py_export PRIVATE
|
|
$<BUILD_INTERFACE:${ONNX_ROOT}>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
- $<INSTALL_INTERFACE:include>)
|
|
+ ${Python3_INCLUDE_DIRS})
|
|
+ target_link_directories(onnx_cpp2py_export PRIVATE
|
|
+ ${Python3_LIBRARY_DIRS})
|
|
+ target_link_libraries(onnx_cpp2py_export PRIVATE
|
|
+ ${Python3_LIBRARIES})
|
|
|
|
# pybind11 is a header only lib
|
|
- find_package(pybind11 2.2 CONFIG)
|
|
+ find_package(pybind11 2.2 CONFIG REQUIRED)
|
|
if(NOT pybind11_FOUND)
|
|
if(EXISTS "${ONNX_ROOT}/third_party/pybind11/include/pybind11/pybind11.h")
|
|
add_subdirectory("${ONNX_ROOT}/third_party/pybind11")
|