@@ -383,6 +383,9 @@ add_library(executorch_no_prim_ops ALIAS executorch_core)
383
383
# A list of all configured backends.
384
384
set (_executorch_backends "" )
385
385
386
+ # A list of all configured extensions.
387
+ set (_executorch_extensions "" )
388
+
386
389
target_link_libraries (executorch_core PRIVATE program_schema )
387
390
if (ANDROID )
388
391
target_link_libraries (executorch_core PUBLIC log )
@@ -579,6 +582,7 @@ endif()
579
582
580
583
if (EXECUTORCH_BUILD_EXTENSION_APPLE )
581
584
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/apple )
585
+ list (APPEND _executorch_extensions apple_extension )
582
586
endif ()
583
587
584
588
if (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER )
@@ -589,6 +593,7 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
589
593
FILES_MATCHING
590
594
PATTERN "*.h"
591
595
)
596
+ list (APPEND _executorch_extensions extension_data_loader )
592
597
endif ()
593
598
594
599
if (EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL )
@@ -603,6 +608,7 @@ endif()
603
608
604
609
if (EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR )
605
610
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/flat_tensor )
611
+ list (APPEND _executorch_extensions extension_flat_tensor )
606
612
endif ()
607
613
608
614
if (EXECUTORCH_BUILD_EXTENSION_MODULE )
@@ -613,6 +619,7 @@ if(EXECUTORCH_BUILD_EXTENSION_MODULE)
613
619
FILES_MATCHING
614
620
PATTERN "*.h"
615
621
)
622
+ list (APPEND _executorch_extensions extension_module_static )
616
623
endif ()
617
624
618
625
if (EXECUTORCH_BUILD_EXTENSION_LLM )
@@ -632,10 +639,17 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM)
632
639
${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG}
633
640
)
634
641
endif ()
642
+ list (APPEND _executorch_extensions tokenizers )
643
+ endif ()
644
+
645
+ if (EXECUTORCH_BUILD_EXTENSION_LLM_APPLE )
646
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/apple )
647
+ list (APPEND _executorch_extensions extension_llm_apple )
635
648
endif ()
636
649
637
650
if (EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER )
638
651
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/runner )
652
+ list (APPEND _executorch_extensions extension_llm_runner )
639
653
endif ()
640
654
641
655
if (EXECUTORCH_BUILD_EXTENSION_LLM_APPLE )
@@ -650,10 +664,12 @@ if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
650
664
FILES_MATCHING
651
665
PATTERN "*.h"
652
666
)
667
+ list (APPEND _executorch_extensions extension_runner_util )
653
668
endif ()
654
669
655
670
if (EXECUTORCH_BUILD_EXTENSION_TENSOR )
656
671
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/tensor )
672
+ list (APPEND _executorch_extensions extension_tensor )
657
673
endif ()
658
674
659
675
if (EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO )
@@ -756,6 +772,7 @@ endif()
756
772
757
773
if (EXECUTORCH_BUILD_EXTENSION_TRAINING )
758
774
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/training )
775
+ list (APPEND _executorch_extensions extension_training )
759
776
endif ()
760
777
761
778
if (EXECUTORCH_BUILD_KERNELS_LLM )
@@ -781,14 +798,19 @@ endif()
781
798
782
799
783
800
# Top-level interface targets.
784
- add_library (executorch_backends INTERFACE )
785
- add_library (executorch::backends ALIAS executorch_backends )
786
801
787
802
# A target containing all configured backends.
803
+ add_library (executorch_backends INTERFACE )
804
+ add_library (executorch::backends ALIAS executorch_backends )
788
805
target_link_libraries (executorch_backends INTERFACE ${_executorch_backends} )
789
806
807
+ # A target containing all configured extensions.
808
+ add_library (executorch_extensions INTERFACE )
809
+ add_library (executorch::extensions ALIAS executorch_extensions )
810
+ target_link_libraries (executorch_extensions INTERFACE ${_executorch_extensions} )
811
+
790
812
install (
791
- TARGETS executorch_backends
813
+ TARGETS executorch_backends executorch_extensions
792
814
INCLUDES
793
815
DESTINATION ${_common_include_directories}
794
816
)
0 commit comments