Skip to content

Commit 5326f31

Browse files
committed
Add top-level CMake extensions target
ghstack-source-id: fbf2135 ghstack-comment-id: 3099981300 Pull-Request: #12696
1 parent 7b9862f commit 5326f31

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

CMakeLists.txt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ add_library(executorch_no_prim_ops ALIAS executorch_core)
354354
# A list of all configured backends.
355355
set(_executorch_backends "")
356356

357+
# A list of all configured extensions.
358+
set(_executorch_extensions "")
359+
357360
target_link_libraries(executorch_core PRIVATE program_schema)
358361
if(ANDROID)
359362
target_link_libraries(executorch_core PUBLIC log)
@@ -549,14 +552,17 @@ endif()
549552

550553
if(EXECUTORCH_BUILD_EXTENSION_APPLE)
551554
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/apple)
555+
list(APPEND _executorch_extensions apple_extension)
552556
endif()
553557

554558
if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
555559
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader)
560+
list(APPEND _executorch_extensions extension_data_loader)
556561
endif()
557562

558563
if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
559564
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor)
565+
list(APPEND _executorch_extensions extension_flat_tensor)
560566
endif()
561567

562568
if(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)
570577
endif()
571578

572579
if(EXECUTORCH_BUILD_EXTENSION_LLM)
573580
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/tokenizers)
581+
list(APPEND _executorch_extensions tokenizers)
574582
endif()
575583

576584
if(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
577585
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/apple)
586+
list(APPEND _executorch_extensions extension_llm_apple)
578587
endif()
579588

580589
if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
581590
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/runner)
591+
list(APPEND _executorch_extensions extension_llm_runner)
582592
endif()
583593

584594
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
585595
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner_util)
596+
list(APPEND _executorch_extensions extension_runner_util)
586597
endif()
587598

588599
if(EXECUTORCH_BUILD_EXTENSION_TENSOR)
589600
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/tensor)
601+
list(APPEND _executorch_extensions extension_tensor)
590602
endif()
591603

592604
if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
@@ -688,6 +700,7 @@ endif()
688700

689701
if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
690702
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/training)
703+
list(APPEND _executorch_extensions extension_training)
691704
endif()
692705

693706
if(EXECUTORCH_BUILD_KERNELS_LLM)
@@ -706,13 +719,17 @@ if(EXECUTORCH_BUILD_VULKAN)
706719
endif()
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)
712725
target_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+
714731
install(
715-
TARGETS executorch_backends
732+
TARGETS executorch_backends executorch_extensions
716733
INCLUDES
717734
DESTINATION ${_common_include_directories}
718735
)

0 commit comments

Comments
 (0)