From 2dfc73712e592dc8582a6e91104b8db254765452 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 8 May 2024 16:31:25 -0700 Subject: [PATCH] Add target_link_options_shared_lib to coremldelegate build Summary: Backends use a static initializer to register themselves. We have an established solution to forcing the Apple linker to load the object files containing said initializer, so let's use it for CoreML. Test Plan: Attempt to load a CoreML PTE from Python no longer fails with error about the backend not being registered --- backends/apple/coreml/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/apple/coreml/CMakeLists.txt b/backends/apple/coreml/CMakeLists.txt index 0f56e3bdf7e..c9a15ed935e 100644 --- a/backends/apple/coreml/CMakeLists.txt +++ b/backends/apple/coreml/CMakeLists.txt @@ -155,6 +155,8 @@ target_link_libraries( ${FOUNDATION_FRAMEWORK} ${SQLITE_LIBRARY} ) +target_link_options_shared_lib(coremldelegate) + if(COREML_BUILD_EXECUTOR_RUNNER) target_link_libraries( coremldelegate PRIVATE portable_ops_lib portable_kernels