diff --git a/CMakeLists.txt b/CMakeLists.txt index d94e6e2fda6..5c3787b3863 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,6 +383,9 @@ add_library(executorch_no_prim_ops ALIAS executorch_core) # A list of all configured backends. set(_executorch_backends "") +# A list of all configured extensions. +set(_executorch_extensions "") + target_link_libraries(executorch_core PRIVATE program_schema) if(ANDROID) target_link_libraries(executorch_core PUBLIC log) @@ -579,6 +582,7 @@ endif() if(EXECUTORCH_BUILD_EXTENSION_APPLE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/apple) + list(APPEND _executorch_extensions apple_extension) endif() if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER) @@ -589,6 +593,7 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER) FILES_MATCHING PATTERN "*.h" ) + list(APPEND _executorch_extensions extension_data_loader) endif() if(EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL) @@ -603,6 +608,7 @@ endif() if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor) + list(APPEND _executorch_extensions extension_flat_tensor) endif() if(EXECUTORCH_BUILD_EXTENSION_MODULE) @@ -613,6 +619,7 @@ if(EXECUTORCH_BUILD_EXTENSION_MODULE) FILES_MATCHING PATTERN "*.h" ) + list(APPEND _executorch_extensions extension_module_static) endif() if(EXECUTORCH_BUILD_EXTENSION_LLM) @@ -632,14 +639,17 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM) ${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG} ) endif() + list(APPEND _executorch_extensions tokenizers) endif() if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/runner) + list(APPEND _executorch_extensions extension_llm_runner) endif() if(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/apple) + list(APPEND _executorch_extensions extension_llm_apple) endif() if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL) @@ -650,10 +660,12 @@ if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL) FILES_MATCHING PATTERN "*.h" ) + list(APPEND _executorch_extensions extension_runner_util) endif() if(EXECUTORCH_BUILD_EXTENSION_TENSOR) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/tensor) + list(APPEND _executorch_extensions extension_tensor) endif() if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO) @@ -756,6 +768,7 @@ endif() if(EXECUTORCH_BUILD_EXTENSION_TRAINING) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/training) + list(APPEND _executorch_extensions extension_training) endif() if(EXECUTORCH_BUILD_KERNELS_LLM) @@ -778,25 +791,22 @@ if(EXECUTORCH_BUILD_VGF) list(APPEND _executorch_backends vgf_backend) endif() - # Top-level interface targets. -add_library(executorch_backends INTERFACE) -add_library(executorch::backends ALIAS executorch_backends) # A target containing all configured backends. +add_library(executorch_backends INTERFACE) +add_library(executorch::backends ALIAS executorch_backends) target_link_libraries(executorch_backends INTERFACE ${_executorch_backends}) -install( - TARGETS executorch_backends - INCLUDES - DESTINATION ${_common_include_directories} -) +# A target containing all configured extensions. +add_library(executorch_extensions INTERFACE) +add_library(executorch::extensions ALIAS executorch_extensions) +target_link_libraries(executorch_extensions INTERFACE ${_executorch_extensions}) if(EXECUTORCH_BUILD_EXECUTOR_RUNNER) # Baseline libraries that executor_runner will link against. set(_executor_runner_libs executorch extension_evalue_util - extension_runner_util gflags - executorch_backends + extension_runner_util gflags executorch_backends ) if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)