@@ -383,6 +383,9 @@ add_library(executorch_no_prim_ops ALIAS executorch_core)
383383# A list of all configured backends.
384384set (_executorch_backends "" )
385385
386+ # A list of all configured extensions.
387+ set (_executorch_extensions "" )
388+
386389target_link_libraries (executorch_core PRIVATE program_schema)
387390if (ANDROID)
388391 target_link_libraries (executorch_core PUBLIC log )
@@ -579,6 +582,7 @@ endif()
579582
580583if (EXECUTORCH_BUILD_EXTENSION_APPLE)
581584 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/apple )
585+ list (APPEND _executorch_extensions apple_extension)
582586endif ()
583587
584588if (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
@@ -589,6 +593,7 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
589593 FILES_MATCHING
590594 PATTERN "*.h"
591595 )
596+ list (APPEND _executorch_extensions extension_data_loader)
592597endif ()
593598
594599if (EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL)
@@ -603,6 +608,7 @@ endif()
603608
604609if (EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
605610 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/flat_tensor)
611+ list (APPEND _executorch_extensions extension_flat_tensor)
606612endif ()
607613
608614if (EXECUTORCH_BUILD_EXTENSION_MODULE)
@@ -613,6 +619,7 @@ if(EXECUTORCH_BUILD_EXTENSION_MODULE)
613619 FILES_MATCHING
614620 PATTERN "*.h"
615621 )
622+ list (APPEND _executorch_extensions extension_module_static)
616623endif ()
617624
618625if (EXECUTORCH_BUILD_EXTENSION_LLM)
@@ -632,14 +639,17 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM)
632639 ${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG}
633640 )
634641 endif ()
642+ list (APPEND _executorch_extensions tokenizers)
635643endif ()
636644
637645if (EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
638646 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/runner)
647+ list (APPEND _executorch_extensions extension_llm_runner)
639648endif ()
640649
641650if (EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
642651 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/apple )
652+ list (APPEND _executorch_extensions extension_llm_apple)
643653endif ()
644654
645655if (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
@@ -650,10 +660,12 @@ if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
650660 FILES_MATCHING
651661 PATTERN "*.h"
652662 )
663+ list (APPEND _executorch_extensions extension_runner_util)
653664endif ()
654665
655666if (EXECUTORCH_BUILD_EXTENSION_TENSOR)
656667 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/tensor)
668+ list (APPEND _executorch_extensions extension_tensor)
657669endif ()
658670
659671if (EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
@@ -756,6 +768,7 @@ endif()
756768
757769if (EXECUTORCH_BUILD_EXTENSION_TRAINING)
758770 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/training)
771+ list (APPEND _executorch_extensions extension_training)
759772endif ()
760773
761774if (EXECUTORCH_BUILD_KERNELS_LLM)
@@ -778,25 +791,22 @@ if(EXECUTORCH_BUILD_VGF)
778791 list (APPEND _executorch_backends vgf_backend)
779792endif ()
780793
781-
782794# Top-level interface targets.
783- add_library (executorch_backends INTERFACE )
784- add_library (executorch::backends ALIAS executorch_backends)
785795
786796# A target containing all configured backends.
797+ add_library (executorch_backends INTERFACE )
798+ add_library (executorch::backends ALIAS executorch_backends)
787799target_link_libraries (executorch_backends INTERFACE ${_executorch_backends} )
788800
789- install (
790- TARGETS executorch_backends
791- INCLUDES
792- DESTINATION ${_common_include_directories}
793- )
801+ # A target containing all configured extensions.
802+ add_library (executorch_extensions INTERFACE )
803+ add_library (executorch::extensions ALIAS executorch_extensions)
804+ target_link_libraries (executorch_extensions INTERFACE ${_executorch_extensions} )
794805
795806if (EXECUTORCH_BUILD_EXECUTOR_RUNNER)
796807 # Baseline libraries that executor_runner will link against.
797808 set (_executor_runner_libs executorch extension_evalue_util
798- extension_runner_util gflags
799- executorch_backends
809+ extension_runner_util gflags executorch_backends
800810 )
801811
802812 if (EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
0 commit comments