forked from MaaAssistantArknights/MaaDeps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
vcpkg-overlay/ports/maa-onnxruntime/0001-coremltools.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
diff --git a/cmake/onnxruntime_providers_coreml.cmake b/cmake/onnxruntime_providers_coreml.cmake | ||
index 0aa25a2..b41eac7 100644 | ||
--- a/cmake/onnxruntime_providers_coreml.cmake | ||
+++ b/cmake/onnxruntime_providers_coreml.cmake | ||
@@ -9,27 +9,14 @@ add_compile_definitions(USE_COREML=1) | ||
|
||
# Check if we can build the coremltools code for creating an mlpackage with an mlprogram. | ||
# The coremltools source requires std::filesystem::path which is only available from iOS 13 on. | ||
-set(_enable_ML_PROGRAM ON) | ||
-if (IOS AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 13.0) | ||
- message(WARNING "CoreML ML Program is not supported on iOS < 13.0. Excluding ML Program support from build.") | ||
- set(_enable_ML_PROGRAM OFF) | ||
-elseif(LINUX) | ||
- # uuid-dev is required. we don't bother installing on CIs as it's really for manual developer testing. | ||
- find_library(LibUUID_LIBRARY NAMES uuid) | ||
- find_path(LibUUID_INCLUDE_DIR NAMES uuid/uuid.h) | ||
- if (NOT LibUUID_INCLUDE_DIR) | ||
- message(STATUS "uuid/uuid.h was not found as is required for ML Program support. " | ||
- "Run `sudo apt install uuid-dev` if you need to test ML Program related CoreML EP code. ") | ||
- set(_enable_ML_PROGRAM OFF) | ||
- endif() | ||
-endif() | ||
+set(_enable_ML_PROGRAM OFF) | ||
|
||
if (_enable_ML_PROGRAM) | ||
add_compile_definitions(COREML_ENABLE_MLPROGRAM=1) | ||
endif() | ||
|
||
# Compile CoreML proto definition to ${CMAKE_CURRENT_BINARY_DIR}/coreml_proto | ||
-set(COREML_PROTO_ROOT ${coremltools_SOURCE_DIR}/mlmodel/format) | ||
+set(COREML_PROTO_ROOT ${onnxruntime_COREMLTOOLS_HOME}/mlmodel/format) | ||
file(GLOB coreml_proto_srcs "${COREML_PROTO_ROOT}/*.proto") | ||
|
||
onnxruntime_add_static_library(coreml_proto ${coreml_proto_srcs}) | ||
@@ -98,20 +85,20 @@ if(_enable_ML_PROGRAM) | ||
# build on Windows and Linux. | ||
file(GLOB | ||
onnxruntime_providers_coreml_milblob_cc_srcs CONFIGURE_DEPENDS | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/*.hpp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/*.cpp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/Util/*.hpp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/Blob/BlobDataType.hpp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/Blob/StorageFormat.hpp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/Blob/FileWriter.?pp" | ||
- "${coremltools_SOURCE_DIR}/mlmodel/src/MILBlob/Blob/StorageWriter.?pp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/*.hpp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/*.cpp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/Util/*.hpp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/Blob/BlobDataType.hpp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/Blob/StorageFormat.hpp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/Blob/FileWriter.?pp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/MILBlob/Blob/StorageWriter.?pp" | ||
) | ||
|
||
# Add helpers to create mlpackage | ||
file(GLOB | ||
onnxruntime_providers_coreml_modelpackage_cc_srcs CONFIGURE_DEPENDS | ||
- "${coremltools_SOURCE_DIR}/modelpackage/src/ModelPackage.?pp" | ||
- "${coremltools_SOURCE_DIR}/modelpackage/src/utils/JsonMap.?pp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/modelpackage/src/ModelPackage.?pp" | ||
+ "${onnxruntime_COREMLTOOLS_HOME}/modelpackage/src/utils/JsonMap.?pp" | ||
) | ||
|
||
set(coremltools_srcs | ||
@@ -119,7 +106,7 @@ if(_enable_ML_PROGRAM) | ||
${onnxruntime_providers_coreml_modelpackage_cc_srcs} | ||
) | ||
|
||
- source_group(TREE ${coremltools_SOURCE_DIR} PREFIX coremltools FILES ${coremltools_srcs}) | ||
+ source_group(TREE ${onnxruntime_COREMLTOOLS_HOME} PREFIX coremltools FILES ${coremltools_srcs}) | ||
endif() | ||
|
||
# Add CoreML objective c++ source code | ||
@@ -190,9 +177,9 @@ if (_enable_ML_PROGRAM) | ||
target_include_directories(onnxruntime_providers_coreml PRIVATE | ||
${fp16_SOURCE_DIR}/include | ||
${nlohmann_json_SOURCE_DIR}/single_include/nlohmann | ||
- ${coremltools_SOURCE_DIR} | ||
- ${coremltools_SOURCE_DIR}/mlmodel/src/ | ||
- ${coremltools_SOURCE_DIR}/modelpackage/src/ | ||
+ ${onnxruntime_COREMLTOOLS_HOME} | ||
+ ${onnxruntime_COREMLTOOLS_HOME}/mlmodel/src/ | ||
+ ${onnxruntime_COREMLTOOLS_HOME}/modelpackage/src/ | ||
) | ||
|
||
add_dependencies(onnxruntime_providers_coreml nlohmann_json::nlohmann_json fp16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters