File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,11 @@ target_link_libraries(portable_kernels_bindings INTERFACE portable_kernels)
259
259
260
260
# Ensure that the load-time constructor functions run. By default, the linker
261
261
# would remove them since there are no other references to them.
262
- kernel_link_options (portable_kernels_bindings )
262
+ if (APPLE )
263
+ macos_kernel_link_options (portable_kernels_bindings )
264
+ else ()
265
+ kernel_link_options (portable_kernels_bindings )
266
+ endif ()
263
267
264
268
#
265
269
# executor_runner: A simple commandline tool that loads and runs a program file.
Original file line number Diff line number Diff line change @@ -32,3 +32,11 @@ function(kernel_link_options target_name)
32
32
-Wl,--no-whole-archive
33
33
)
34
34
endfunction ()
35
+
36
+ function (macos_kernel_link_options target_name )
37
+ target_link_options (${target_name}
38
+ INTERFACE
39
+ # Same as kernel_link_options but it's for MacOS linker
40
+ -Wl,-force_load,$<TARGET_FILE:${target_name}>
41
+ )
42
+ endfunction ()
Original file line number Diff line number Diff line change @@ -110,7 +110,11 @@ if(REGISTER_EXAMPLE_CUSTOM_OP_2)
110
110
111
111
# Ensure that the load-time constructor functions run. By default, the linker
112
112
# would remove them since there are no other references to them.
113
- kernel_link_options ("custom_ops_aot_lib" )
113
+ if (APPLE )
114
+ macos_kernel_link_options ("custom_ops_aot_lib" )
115
+ else ()
116
+ kernel_link_options ("custom_ops_aot_lib" )
117
+ endif ()
114
118
endif ()
115
119
116
120
# 1. C++ library to register custom ops into Executorch runtime.
You can’t perform that action at this time.
0 commit comments