@@ -32,6 +32,9 @@ if(NOT FLATC_EXECUTABLE)
3232 set (FLATC_EXECUTABLE flatc)
3333endif ()
3434
35+ # Include this file to access target_link_options_shared_lib
36+ include (${EXECUTORCH_ROOT} /build /Utils.cmake)
37+
3538# ATen Vulkan Libs
3639
3740set (PYTORCH_PATH ${EXECUTORCH_ROOT} /third-party/pytorch)
@@ -92,6 +95,29 @@ target_link_libraries(vulkan_backend PRIVATE executorch)
9295
9396target_compile_options (vulkan_backend PRIVATE ${VULKAN_CXX_FLAGS} )
9497
98+ # This is required to ensure that vulkan_backend gets linked with
99+ # --whole-archive since backends are registered via static variables that would
100+ # otherwise be discarded
101+ target_link_options_shared_lib(vulkan_backend)
102+
103+ # Executor Runner
104+
105+ if (NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*iOS\. cmake$" )
106+ set (VULKAN_RUNNER_SRCS ${_executor_runner__srcs} )
107+ list (TRANSFORM VULKAN_RUNNER_SRCS PREPEND "${EXECUTORCH_ROOT} /" )
108+ add_executable (vulkan_executor_runner ${VULKAN_RUNNER_SRCS} )
109+ target_link_libraries (vulkan_executor_runner ${_executor_runner_libs} )
110+ target_link_libraries (vulkan_executor_runner vulkan_schema)
111+ target_link_libraries (vulkan_executor_runner vulkan_backend)
112+ target_compile_options (vulkan_executor_runner PUBLIC ${VULKAN_CXX_FLAGS} )
113+
114+ add_library (vulkan_executor_runner_lib STATIC ${VULKAN_RUNNER_SRCS} )
115+ target_link_libraries (vulkan_executor_runner_lib ${_executor_runner_libs} )
116+ target_link_libraries (vulkan_executor_runner_lib vulkan_schema)
117+ target_link_libraries (vulkan_executor_runner_lib vulkan_backend)
118+ target_compile_options (vulkan_executor_runner_lib PUBLIC ${VULKAN_CXX_FLAGS} )
119+ endif ()
120+
95121# Test targets
96122
97123if (EXECUTORCH_BUILD_GTESTS)
0 commit comments