@@ -354,6 +354,9 @@ add_library(executorch_no_prim_ops ALIAS executorch_core)
354354# A list of all configured backends.
355355set (_executorch_backends "" )
356356
357+ # A list of all configured extensions.
358+ set (_executorch_extensions "" )
359+
357360target_link_libraries (executorch_core PRIVATE program_schema)
358361if (ANDROID)
359362 target_link_libraries (executorch_core PUBLIC log )
@@ -549,14 +552,17 @@ endif()
549552
550553if (EXECUTORCH_BUILD_EXTENSION_APPLE)
551554 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/apple )
555+ list (APPEND _executorch_extensions apple_extension)
552556endif ()
553557
554558if (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
555559 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/data_loader)
560+ list (APPEND _executorch_extensions extension_data_loader)
556561endif ()
557562
558563if (EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
559564 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/flat_tensor)
565+ list (APPEND _executorch_extensions extension_flat_tensor)
560566endif ()
561567
562568if (EXECUTORCH_BUILD_EXTENSION_MODULE)
@@ -567,26 +573,32 @@ if(EXECUTORCH_BUILD_EXTENSION_MODULE)
567573 FILES_MATCHING
568574 PATTERN "*.h"
569575 )
576+ list (APPEND _executorch_extensions extension_module_static)
570577endif ()
571578
572579if (EXECUTORCH_BUILD_EXTENSION_LLM)
573580 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/tokenizers)
581+ list (APPEND _executorch_extensions tokenizers)
574582endif ()
575583
576584if (EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
577585 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/apple )
586+ list (APPEND _executorch_extensions extension_llm_apple)
578587endif ()
579588
580589if (EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
581590 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/runner)
591+ list (APPEND _executorch_extensions extension_llm_runner)
582592endif ()
583593
584594if (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
585595 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/runner_util)
596+ list (APPEND _executorch_extensions extension_runner_util)
586597endif ()
587598
588599if (EXECUTORCH_BUILD_EXTENSION_TENSOR)
589600 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/tensor)
601+ list (APPEND _executorch_extensions extension_tensor)
590602endif ()
591603
592604if (EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
@@ -688,6 +700,7 @@ endif()
688700
689701if (EXECUTORCH_BUILD_EXTENSION_TRAINING)
690702 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/training)
703+ list (APPEND _executorch_extensions extension_training)
691704endif ()
692705
693706if (EXECUTORCH_BUILD_KERNELS_LLM)
@@ -706,11 +719,15 @@ if(EXECUTORCH_BUILD_VULKAN)
706719endif ()
707720
708721# Top-level interface targets.
709- add_library (executorch_backends INTERFACE )
710722
711723# A target containing all configured backends.
724+ add_library (executorch_backends INTERFACE )
712725target_link_libraries (executorch_backends INTERFACE ${_executorch_backends} )
713726
727+ # A target containing all configured extensions.
728+ add_library (executorch_extensions INTERFACE )
729+ target_link_libraries (executorch_extensions INTERFACE ${_executorch_extensions} )
730+
714731if (EXECUTORCH_BUILD_EXECUTOR_RUNNER)
715732 # Baseline libraries that executor_runner will link against.
716733 set (_executor_runner_libs executorch gflags)
0 commit comments