Skip to content

Commit 986b447

Browse files
authored
Call target_link_options_shared_lib in executorch-config.cmake (#12320)
Customers need the flags this sets (`--whole-archive` or `-force_load`), otherwise the built operator libraries won't actually register operators. Testing: ~~I'm not sure that we have automated coverage for this file, so I'm sending a first version adding an intentional break.~~ We have automated coverage for this file.
1 parent cfdea10 commit 986b447

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ install(
490490
INCLUDES
491491
DESTINATION ${_common_include_directories}
492492
)
493-
install(FILES tools/cmake/executorch-config.cmake
493+
install(FILES tools/cmake/Utils.cmake tools/cmake/executorch-config.cmake
494494
DESTINATION lib/cmake/ExecuTorch
495495
)
496496

tools/cmake/executorch-config.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# the contract of exposing these CMake variables.
2525

2626
cmake_minimum_required(VERSION 3.19)
27+
include("${CMAKE_CURRENT_LIST_DIR}/Utils.cmake")
2728

2829
set(_root "${CMAKE_CURRENT_LIST_DIR}/../../..")
2930
set(required_lib_list executorch executorch_core portable_kernels)
@@ -171,3 +172,17 @@ if(TARGET extension_threadpool)
171172
"cpuinfo;pthreadpool"
172173
)
173174
endif()
175+
176+
set(shared_lib_list
177+
# executorch -- size tests fail due to regression if we include this and I'm not sure it's needed.
178+
optimized_native_cpu_ops_lib
179+
portable_ops_lib
180+
quantized_ops_lib
181+
xnnpack_backend
182+
vulkan_backend
183+
quantized_ops_aot_lib)
184+
foreach(lib ${shared_lib_list})
185+
if(TARGET ${lib})
186+
target_link_options_shared_lib(${lib})
187+
endif()
188+
endforeach()

0 commit comments

Comments
 (0)