Fix CoreML-enabled static build on macOS#27960
Open
umireon wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix CoreML-enabled static build on macOS#27960umireon wants to merge 1 commit intomicrosoft:mainfrom
umireon wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The `coreml_proto` target must be properly exported to `onnxruntimeTargets`. Its include directories must not contain any paths from the build tree during the install phase. Signed-off-by: Kaito Udagawa <umireon@kaito.tokyo>
13fde9b to
f243ded
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes macOS static builds with the CoreML Execution Provider by making the coreml_proto target compliant with CMake install/export requirements (no build-tree include paths in the install interface) and ensuring it is exported alongside other ONNX Runtime targets.
Changes:
- Export
coreml_protovia${PROJECT_NAME}Targetsso static builds can install/export dependent targets cleanly. - Restrict
coreml_proto’s generated-header include path to build-time only using$<BUILD_INTERFACE:...>to avoid build-tree paths during installation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Is this related to why onnx-runtime-node dropped support for MacOS x86-64 a few releases ago? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
coreml_prototarget must be properly exported toonnxruntimeTargets. Its include directories must not contain any paths from the build tree during the install phase.Motivation and Context
This change fixes a build failure on macOS when attempting to create a static library of ONNX Runtime with the CoreML Execution Provider (EP) using the following command:
Note:
CMAKE_POLICY_VERSION_MINIMUM=3.5is required for modern macOS environment. The current version of CMake available on Homebrew is4.3.1, and it won't allowcmake_minimum_required(3.5). It seems that ignoringcmake_minimum_required(3.5)in the ONNX Runtime tree is not harmful.The build fails because
coreml_protohas no export sets specified and it violates CMake's requirement that exported targets must not reference paths from the build tree when installed. Currently,coreml_protodepends on${CMAKE_CURRENT_BINARY_DIR}to locate generated Protobuf definitions. I suppose these definitions are required only during the build phase and not needed for the installation.This change set resolves it by:
coreml_prototo${PROJECT_NAME}Targets.${CMAKE_CURRENT_BINARY_DIR}with$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>.