@@ -380,6 +380,9 @@ add_library(executorch_core ${_executorch_core__srcs})
380
380
# Legacy name alias.
381
381
add_library (executorch_no_prim_ops ALIAS executorch_core )
382
382
383
+ # A list of all configured backends.
384
+ set (_executorch_backends "" )
385
+
383
386
target_link_libraries (executorch_core PRIVATE program_schema )
384
387
if (ANDROID )
385
388
target_link_libraries (executorch_core PUBLIC log )
@@ -524,6 +527,7 @@ install(FILES tools/cmake/executorch-config.cmake
524
527
525
528
if (EXECUTORCH_BUILD_ARM_BAREMETAL )
526
529
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm )
530
+ list (APPEND _executorch_backends executorch_delegate_ethos_u )
527
531
endif ()
528
532
529
533
if (EXECUTORCH_BUILD_CADENCE )
@@ -532,30 +536,37 @@ endif()
532
536
533
537
if (EXECUTORCH_BUILD_NXP_NEUTRON )
534
538
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/nxp )
539
+ list (APPEND _executorch_backends executorch_delegate_neutron )
535
540
endif ()
536
541
537
542
if (EXECUTORCH_BUILD_COREML )
538
543
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/coreml )
544
+ list (APPEND _executorch_backends coremldelegate )
539
545
endif ()
540
546
541
547
if (EXECUTORCH_BUILD_MPS )
542
548
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/mps )
549
+ list (APPEND _executorch_backends mpsdelegate )
543
550
endif ()
544
551
545
552
if (EXECUTORCH_BUILD_NEURON )
546
553
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/mediatek )
554
+ list (APPEND _executorch_backends neuron_backend )
547
555
endif ()
548
556
549
557
if (EXECUTORCH_BUILD_OPENVINO )
550
558
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/openvino )
559
+ list (APPEND _executorch_backends openvino_backend )
551
560
endif ()
552
561
553
562
if (EXECUTORCH_BUILD_QNN )
554
563
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/qualcomm )
564
+ list (APPEND _executorch_backends qnn_executorch_backend )
555
565
endif ()
556
566
557
567
if (EXECUTORCH_BUILD_XNNPACK )
558
568
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/xnnpack )
569
+ list (APPEND _executorch_backends xnnpack_backend )
559
570
endif ()
560
571
561
572
if (EXECUTORCH_BUILD_CORTEX_M )
@@ -757,10 +768,36 @@ if(EXECUTORCH_BUILD_KERNELS_QUANTIZED)
757
768
executorch_target_link_options_shared_lib (quantized_ops_lib )
758
769
endif ()
759
770
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
+ endif ()
781
+
782
+
783
+ # Top-level interface targets.
784
+ add_library (executorch_backends INTERFACE )
785
+ add_library (executorch::backends ALIAS executorch_backends )
786
+
787
+ # A target containing all configured backends.
788
+ target_link_libraries (executorch_backends INTERFACE ${_executorch_backends} )
789
+
790
+ install (
791
+ TARGETS executorch_backends
792
+ INCLUDES
793
+ DESTINATION ${_common_include_directories}
794
+ )
795
+
760
796
if (EXECUTORCH_BUILD_EXECUTOR_RUNNER )
761
797
# Baseline libraries that executor_runner will link against.
762
798
set (_executor_runner_libs executorch extension_evalue_util
763
799
extension_runner_util gflags
800
+ executorch_backends
764
801
)
765
802
766
803
if (EXECUTORCH_BUILD_KERNELS_OPTIMIZED )
@@ -780,18 +817,10 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
780
817
list (APPEND _executor_runner_libs $< LINK_LIBRARY:WHOLE_ARCHIVE,custom_ops> )
781
818
endif ()
782
819
783
- if (EXECUTORCH_BUILD_XNNPACK )
784
- list (APPEND _executor_runner_libs xnnpack_backend )
785
- endif ()
786
-
787
820
if (EXECUTORCH_ENABLE_EVENT_TRACER )
788
821
list (APPEND _executor_runner_libs etdump flatccrt )
789
822
endif ()
790
823
791
- if (EXECUTORCH_BUILD_COREML AND APPLE )
792
- list (APPEND _executor_runner_libs coremldelegate )
793
- endif ()
794
-
795
824
add_executable (executor_runner ${_executor_runner__srcs} )
796
825
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
797
826
target_link_options_gc_sections (executor_runner )
@@ -814,14 +843,6 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
814
843
endif ()
815
844
endif ()
816
845
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
-
825
846
if (EXECUTORCH_BUILD_ANDROID_JNI )
826
847
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/android )
827
848
endif ()
0 commit comments