Skip to content

Commit 7b9862f

Browse files
committed
Add top-level CMake backends target
ghstack-source-id: 0f4ee19 ghstack-comment-id: 3099241838 Pull-Request: #12689
1 parent c52136f commit 7b9862f

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

CMakeLists.txt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ add_library(executorch_core ${_executorch_core__srcs})
351351
# Legacy name alias.
352352
add_library(executorch_no_prim_ops ALIAS executorch_core)
353353

354+
# A list of all configured backends.
355+
set(_executorch_backends "")
356+
354357
target_link_libraries(executorch_core PRIVATE program_schema)
355358
if(ANDROID)
356359
target_link_libraries(executorch_core PUBLIC log)
@@ -494,6 +497,7 @@ install(FILES tools/cmake/Utils.cmake tools/cmake/executorch-config.cmake
494497

495498
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
496499
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/arm)
500+
list(APPEND _executorch_backends executorch_delegate_ethos_u)
497501
endif()
498502

499503
if(EXECUTORCH_BUILD_CADENCE)
@@ -502,30 +506,37 @@ endif()
502506

503507
if(EXECUTORCH_BUILD_NXP_NEUTRON)
504508
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/nxp)
509+
list(APPEND _executorch_backends executorch_delegate_neutron)
505510
endif()
506511

507512
if(EXECUTORCH_BUILD_COREML)
508513
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/coreml)
514+
list(APPEND _executorch_backends coremldelegate)
509515
endif()
510516

511517
if(EXECUTORCH_BUILD_MPS)
512518
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/mps)
519+
list(APPEND _executorch_backends mpsdelegate)
513520
endif()
514521

515522
if(EXECUTORCH_BUILD_NEURON)
516523
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/mediatek)
524+
list(APPEND _executorch_backends neuron_backend)
517525
endif()
518526

519527
if(EXECUTORCH_BUILD_OPENVINO)
520528
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/openvino)
529+
list(APPEND _executorch_backends openvino_backend)
521530
endif()
522531

523532
if(EXECUTORCH_BUILD_QNN)
524533
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/qualcomm)
534+
list(APPEND _executorch_backends qnn_executorch_backend)
525535
endif()
526536

527537
if(EXECUTORCH_BUILD_XNNPACK)
528538
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/xnnpack)
539+
list(APPEND _executorch_backends xnnpack_backend)
529540
endif()
530541

531542
if(EXECUTORCH_BUILD_CORTEX_M)
@@ -689,6 +700,23 @@ if(EXECUTORCH_BUILD_KERNELS_QUANTIZED)
689700
target_link_options_shared_lib(quantized_ops_lib)
690701
endif()
691702

703+
if(EXECUTORCH_BUILD_VULKAN)
704+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/vulkan)
705+
list(APPEND _executorch_backends vulkan_backend)
706+
endif()
707+
708+
# Top-level interface targets.
709+
add_library(executorch_backends INTERFACE)
710+
711+
# A target containing all configured backends.
712+
target_link_libraries(executorch_backends INTERFACE ${_executorch_backends})
713+
714+
install(
715+
TARGETS executorch_backends
716+
INCLUDES
717+
DESTINATION ${_common_include_directories}
718+
)
719+
692720
if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
693721
# Baseline libraries that executor_runner will link against.
694722
set(_executor_runner_libs executorch gflags)
@@ -741,10 +769,6 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
741769
endif()
742770
endif()
743771

744-
if(EXECUTORCH_BUILD_VULKAN)
745-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/vulkan)
746-
endif()
747-
748772
if(EXECUTORCH_BUILD_ANDROID_JNI)
749773
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/android)
750774
endif()

0 commit comments

Comments
 (0)