@@ -380,6 +380,9 @@ add_library(executorch_core ${_executorch_core__srcs})
380380# Legacy name alias.
381381add_library (executorch_no_prim_ops ALIAS executorch_core)
382382
383+ # A list of all configured backends.
384+ set (_executorch_backends "" )
385+
383386target_link_libraries (executorch_core PRIVATE program_schema)
384387if (ANDROID)
385388 target_link_libraries (executorch_core PUBLIC log )
@@ -524,6 +527,7 @@ install(FILES tools/cmake/executorch-config.cmake
524527
525528if (EXECUTORCH_BUILD_ARM_BAREMETAL)
526529 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm)
530+ list (APPEND _executorch_backends executorch_delegate_ethos_u)
527531endif ()
528532
529533if (EXECUTORCH_BUILD_CADENCE)
@@ -532,30 +536,37 @@ endif()
532536
533537if (EXECUTORCH_BUILD_NXP_NEUTRON)
534538 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/nxp)
539+ list (APPEND _executorch_backends executorch_delegate_neutron)
535540endif ()
536541
537542if (EXECUTORCH_BUILD_COREML)
538543 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple /coreml)
544+ list (APPEND _executorch_backends coremldelegate)
539545endif ()
540546
541547if (EXECUTORCH_BUILD_MPS)
542548 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple /mps)
549+ list (APPEND _executorch_backends mpsdelegate)
543550endif ()
544551
545552if (EXECUTORCH_BUILD_NEURON)
546553 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/mediatek)
554+ list (APPEND _executorch_backends neuron_backend)
547555endif ()
548556
549557if (EXECUTORCH_BUILD_OPENVINO)
550558 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/openvino)
559+ list (APPEND _executorch_backends openvino_backend)
551560endif ()
552561
553562if (EXECUTORCH_BUILD_QNN)
554563 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/qualcomm)
564+ list (APPEND _executorch_backends qnn_executorch_backend)
555565endif ()
556566
557567if (EXECUTORCH_BUILD_XNNPACK)
558568 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/xnnpack)
569+ list (APPEND _executorch_backends xnnpack_backend)
559570endif ()
560571
561572if (EXECUTORCH_BUILD_CORTEX_M)
@@ -757,10 +768,35 @@ if(EXECUTORCH_BUILD_KERNELS_QUANTIZED)
757768 executorch_target_link_options_shared_lib(quantized_ops_lib)
758769endif ()
759770
771+ if (EXECUTORCH_BUILD_VULKAN)
772+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/vulkan)
773+ list (APPEND _executorch_backends vulkan_backend vulkan_schema)
774+ endif ()
775+
776+ if (EXECUTORCH_BUILD_VGF)
777+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm)
778+ list (APPEND _executorch_backends vgf_backend)
779+ endif ()
780+
781+
782+ # Top-level interface targets.
783+ add_library (executorch_backends INTERFACE )
784+ add_library (executorch::backends ALIAS executorch_backends)
785+
786+ # A target containing all configured backends.
787+ target_link_libraries (executorch_backends INTERFACE ${_executorch_backends} )
788+
789+ install (
790+ TARGETS executorch_backends
791+ INCLUDES
792+ DESTINATION ${_common_include_directories}
793+ )
794+
760795if (EXECUTORCH_BUILD_EXECUTOR_RUNNER)
761796 # Baseline libraries that executor_runner will link against.
762797 set (_executor_runner_libs executorch extension_evalue_util
763798 extension_runner_util gflags
799+ executorch_backends
764800 )
765801
766802 if (EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
@@ -780,18 +816,10 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
780816 list (APPEND _executor_runner_libs $<LINK_LIBRARY:WHOLE_ARCHIVE,custom_ops>)
781817 endif ()
782818
783- if (EXECUTORCH_BUILD_XNNPACK)
784- list (APPEND _executor_runner_libs xnnpack_backend)
785- endif ()
786-
787819 if (EXECUTORCH_ENABLE_EVENT_TRACER)
788820 list (APPEND _executor_runner_libs etdump flatccrt)
789821 endif ()
790822
791- if (EXECUTORCH_BUILD_COREML AND APPLE )
792- list (APPEND _executor_runner_libs coremldelegate)
793- endif ()
794-
795823 add_executable (executor_runner ${_executor_runner__srcs} )
796824 if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
797825 target_link_options_gc_sections(executor_runner)
@@ -814,14 +842,6 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
814842 endif ()
815843endif ()
816844
817- if (EXECUTORCH_BUILD_VULKAN)
818- add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/vulkan)
819- endif ()
820- if (EXECUTORCH_BUILD_VGF)
821- add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm)
822- endif ()
823-
824-
825845if (EXECUTORCH_BUILD_ANDROID_JNI)
826846 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/android)
827847endif ()
0 commit comments