From 829dc38406b67882c29efc661326b268c28830cc Mon Sep 17 00:00:00 2001 From: TejasweeSulekh <75196163+TejasweeSulekh@users.noreply.github.com> Date: Sun, 27 Sep 2026 22:18:54 +0530 Subject: [PATCH 1/3] Rename executorch cmake target to prim_ops_lib --- CMakeLists.txt | 26 +++++++++---------- .../fusion_g3/operators/CMakeLists.txt | 2 +- .../cadence/generic/operators/CMakeLists.txt | 4 +-- .../cadence/hifi/operators/CMakeLists.txt | 4 +-- .../cadence/vision/operators/CMakeLists.txt | 4 +-- backends/qualcomm/CMakeLists.txt | 2 +- devtools/bundled_program/CMakeLists.txt | 2 +- devtools/etdump/CMakeLists.txt | 2 +- .../kernel-library-custom-aten-kernel.md | 4 +-- examples/models/llama/CMakeLists.txt | 1 - examples/models/muse-glimmer/CMakeLists.txt | 2 +- examples/portable/custom_ops/CMakeLists.txt | 2 +- tools/cmake/executorch-config.cmake | 2 +- 13 files changed, 28 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 947e398ce29..9d70fbc6b72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -707,15 +707,15 @@ endif() # Does not contain portable kernels or other full operators. Does not contain # any backends. # -add_library(executorch ${_executorch__srcs}) -target_link_libraries(executorch PRIVATE executorch_core) -target_include_directories(executorch PUBLIC ${_common_include_directories}) -target_compile_definitions(executorch PUBLIC C10_USING_CUSTOM_GENERATED_MACROS) +add_library(prim_ops_lib ${_executorch__srcs}) +target_link_libraries(prim_ops_lib PRIVATE executorch_core) +target_include_directories(prim_ops_lib PUBLIC ${_common_include_directories}) +target_compile_definitions(prim_ops_lib PUBLIC C10_USING_CUSTOM_GENERATED_MACROS) if(NOT EXECUTORCH_ENABLE_LOGGING) - target_compile_definitions(executorch PUBLIC ET_LOG_ENABLED=0) + target_compile_definitions(prim_ops_lib PUBLIC ET_LOG_ENABLED=0) endif() -target_compile_options(executorch PUBLIC ${_common_compile_options}) -executorch_target_link_options_shared_lib(executorch) +target_compile_options(prim_ops_lib PUBLIC ${_common_compile_options}) +executorch_target_link_options_shared_lib(prim_ops_lib) # # portable_ops_lib: A library to register core ATen ops using portable kernels, @@ -805,7 +805,7 @@ install( PATTERN "*.h" ) install( - TARGETS executorch executorch_core + TARGETS prim_ops_lib executorch_core EXPORT ExecuTorchTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} @@ -1070,7 +1070,7 @@ if(EXECUTORCH_BUILD_SHARED) # the WHOLE_ARCHIVE link feature, because these archives also reference each # other plainly and CMake before 3.29 refuses to mix a feature with a plain # reference to the same item. - target_link_libraries(executorch_shared PRIVATE executorch) + target_link_libraries(executorch_shared PRIVATE prim_ops_lib) set(_executorch_shared_whole_archive executorch_core) foreach(_ext_target extension_data_loader extension_flat_tensor extension_named_data_map @@ -1129,7 +1129,7 @@ endif() # when it is named. if(EXECUTORCH_ENABLE_EVENT_TRACER) target_compile_definitions(executorch_core INTERFACE ET_EVENT_TRACER_ENABLED) - target_compile_definitions(executorch INTERFACE ET_EVENT_TRACER_ENABLED) + target_compile_definitions(prim_ops_lib INTERFACE ET_EVENT_TRACER_ENABLED) if(TARGET executorch_shared) target_compile_definitions( executorch_shared INTERFACE ET_EVENT_TRACER_ENABLED @@ -1452,7 +1452,7 @@ if(EXECUTORCH_BUILD_PYBIND) if(EXECUTORCH_BUILD_SHARED) target_link_libraries(util PRIVATE torch c10 executorch_shared) else() - target_link_libraries(util PRIVATE torch c10 executorch extension_tensor) + target_link_libraries(util PRIVATE torch c10 prim_ops_lib extension_tensor) endif() # pybind portable_lib @@ -1562,7 +1562,7 @@ if(EXECUTORCH_BUILD_PYBIND) data_loader "extension/pybindings" "executorch/extension/pybindings" ) else() - target_link_libraries(data_loader PRIVATE executorch) + target_link_libraries(data_loader PRIVATE prim_ops_lib) endif() install(TARGETS data_loader LIBRARY DESTINATION executorch/extension/pybindings @@ -1753,7 +1753,7 @@ install(TARGETS executorch_backends executorch_extensions executorch_kernels if(EXECUTORCH_BUILD_EXECUTOR_RUNNER) # Baseline libraries that executor_runner will link against. - set(_executor_runner_libs executorch extension_evalue_util + set(_executor_runner_libs prim_ops_lib extension_evalue_util extension_runner_util gflags executorch_backends ) diff --git a/backends/cadence/fusion_g3/operators/CMakeLists.txt b/backends/cadence/fusion_g3/operators/CMakeLists.txt index a9501c687bb..57ddcbb8bc6 100644 --- a/backends/cadence/fusion_g3/operators/CMakeLists.txt +++ b/backends/cadence/fusion_g3/operators/CMakeLists.txt @@ -65,7 +65,7 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/pattern/unary_ufunc_realhbbf16_to_floathbf16.cpp" ) add_library(aten_ops_cadence ${_aten_ops__srcs}) -target_link_libraries(aten_ops_cadence PUBLIC executorch) +target_link_libraries(aten_ops_cadence PUBLIC prim_ops_lib) target_link_libraries(aten_ops_cadence PRIVATE xa_nnlib) # Let files say "include ". diff --git a/backends/cadence/generic/operators/CMakeLists.txt b/backends/cadence/generic/operators/CMakeLists.txt index dbf06e56bee..db2d1463586 100644 --- a/backends/cadence/generic/operators/CMakeLists.txt +++ b/backends/cadence/generic/operators/CMakeLists.txt @@ -68,7 +68,7 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/util/select_copy_util.cpp" ) add_library(aten_ops_cadence ${_aten_ops__srcs}) -target_link_libraries(aten_ops_cadence PUBLIC executorch) +target_link_libraries(aten_ops_cadence PUBLIC prim_ops_lib) target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". @@ -90,7 +90,7 @@ target_include_directories( ${_common_include_directories} ) -target_link_libraries(custom_ops PUBLIC executorch) +target_link_libraries(custom_ops PUBLIC prim_ops_lib) target_link_libraries(custom_ops PRIVATE cadence_kernels) # Generate C++ bindings to register kernels into both PyTorch (for AOT) and diff --git a/backends/cadence/hifi/operators/CMakeLists.txt b/backends/cadence/hifi/operators/CMakeLists.txt index b5801f5d488..587d5997954 100644 --- a/backends/cadence/hifi/operators/CMakeLists.txt +++ b/backends/cadence/hifi/operators/CMakeLists.txt @@ -80,7 +80,7 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/util/delinearize_index.cpp" ) add_library(aten_ops_cadence ${_aten_ops__srcs}) -target_link_libraries(aten_ops_cadence PUBLIC executorch) +target_link_libraries(aten_ops_cadence PUBLIC prim_ops_lib) target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". @@ -159,7 +159,7 @@ target_include_directories( ${_common_include_directories} ) -target_link_libraries(custom_ops PUBLIC executorch) +target_link_libraries(custom_ops PUBLIC prim_ops_lib) target_link_libraries(custom_ops PRIVATE cadence_kernels) # Generate C++ bindings to register kernels into both PyTorch (for AOT) and diff --git a/backends/cadence/vision/operators/CMakeLists.txt b/backends/cadence/vision/operators/CMakeLists.txt index 38e4f97f841..f83ed412015 100644 --- a/backends/cadence/vision/operators/CMakeLists.txt +++ b/backends/cadence/vision/operators/CMakeLists.txt @@ -68,7 +68,7 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/util/select_copy_util.cpp" ) add_library(aten_ops_cadence ${_aten_ops__srcs}) -target_link_libraries(aten_ops_cadence PUBLIC executorch) +target_link_libraries(aten_ops_cadence PUBLIC prim_ops_lib) target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". @@ -101,7 +101,7 @@ target_include_directories( ${_common_include_directories} ) -target_link_libraries(custom_ops PUBLIC executorch) +target_link_libraries(custom_ops PUBLIC prim_ops_lib) target_link_libraries(custom_ops PRIVATE cadence_kernels) # Generate C++ bindings to register kernels into both PyTorch (for AOT) and diff --git a/backends/qualcomm/CMakeLists.txt b/backends/qualcomm/CMakeLists.txt index a74d6546bb7..d59b32634d1 100644 --- a/backends/qualcomm/CMakeLists.txt +++ b/backends/qualcomm/CMakeLists.txt @@ -415,7 +415,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64") "${CMAKE_INSTALL_LIBDIR}/executorch/backends/qualcomm/python" ) else() - target_link_libraries(PyQnnManagerAdaptor PRIVATE executorch) + target_link_libraries(PyQnnManagerAdaptor PRIVATE prim_ops_lib) endif() pybind11_extension(PyQnnManagerAdaptor) diff --git a/devtools/bundled_program/CMakeLists.txt b/devtools/bundled_program/CMakeLists.txt index 375f7487f06..e318dbccf05 100644 --- a/devtools/bundled_program/CMakeLists.txt +++ b/devtools/bundled_program/CMakeLists.txt @@ -46,7 +46,7 @@ add_library( if(EXECUTORCH_BUILD_SHARED) target_link_libraries(bundled_program PUBLIC executorch_shared) else() - target_link_libraries(bundled_program PUBLIC executorch) + target_link_libraries(bundled_program PUBLIC prim_ops_lib) endif() target_include_directories( bundled_program diff --git a/devtools/etdump/CMakeLists.txt b/devtools/etdump/CMakeLists.txt index 85d73143455..4b28bcfbd00 100644 --- a/devtools/etdump/CMakeLists.txt +++ b/devtools/etdump/CMakeLists.txt @@ -76,7 +76,7 @@ if(EXECUTORCH_BUILD_SHARED) executorch_target_shipped_runtime_path(etdump) else() target_link_libraries(etdump PUBLIC flatccrt) - target_link_libraries(etdump PRIVATE executorch) + target_link_libraries(etdump PRIVATE prim_ops_lib) endif() target_include_directories( diff --git a/docs/source/kernel-library-custom-aten-kernel.md b/docs/source/kernel-library-custom-aten-kernel.md index e435a79bbf3..e941b6a3806 100644 --- a/docs/source/kernel-library-custom-aten-kernel.md +++ b/docs/source/kernel-library-custom-aten-kernel.md @@ -170,7 +170,7 @@ gen_selected_ops("" "${SELECT_OPS_LIST}" "") generate_bindings_for_kernels(FUNCTIONS_YAML ${EXECUTORCH_ROOT}/kernels/portable/functions.yaml) # Prepare a C++ library called "generated_lib" with _kernel_lib being the portable library, executorch is a dependency of it. -gen_operators_lib("generated_lib" KERNEL_LIBS ${_kernel_lib} DEPS executorch) +gen_operators_lib("generated_lib" KERNEL_LIBS ${_kernel_lib} DEPS prim_ops_lib) # Link "generated_lib" into the application: target_link_libraries(executorch_binary generated_lib) @@ -276,7 +276,7 @@ add_library(custom_op_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/custom_op.cpp) target_include_directory(custom_op_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) # Link ExecuTorch library -target_link_libraries(custom_op_lib PUBLIC executorch) +target_link_libraries(custom_op_lib PUBLIC prim_ops_lib) # Define a binary target add_executable(custom_op_runner PUBLIC main.cpp) diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 443ccd01c7e..95e897aeaa8 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -84,7 +84,6 @@ find_package(gflags REQUIRED) # cross-compiling (e.g., to Android) to work as well. list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) # llama_runner library add_subdirectory(runner) diff --git a/examples/models/muse-glimmer/CMakeLists.txt b/examples/models/muse-glimmer/CMakeLists.txt index ff7da644771..1869dded2fe 100644 --- a/examples/models/muse-glimmer/CMakeLists.txt +++ b/examples/models/muse-glimmer/CMakeLists.txt @@ -137,7 +137,7 @@ target_link_libraries(dflash_runner PUBLIC ${link_libraries}) add_executable(sampling_test tests/sampling_test.cpp) target_include_directories(sampling_test PUBLIC ${_common_include_directories}) -target_link_libraries(sampling_test PUBLIC extension_tensor executorch) +target_link_libraries(sampling_test PUBLIC extension_tensor prim_ops_lib) add_executable(dflash_timing_test tests/dflash_timing_test.cpp) target_include_directories( diff --git a/examples/portable/custom_ops/CMakeLists.txt b/examples/portable/custom_ops/CMakeLists.txt index 8e679697b47..8f450667996 100644 --- a/examples/portable/custom_ops/CMakeLists.txt +++ b/examples/portable/custom_ops/CMakeLists.txt @@ -106,7 +106,7 @@ elseif(REGISTER_EXAMPLE_CUSTOM_OP EQUAL 2) endif() add_library(custom_kernels ${kernel_sources}) -target_link_libraries(custom_kernels PRIVATE executorch) +target_link_libraries(custom_kernels PRIVATE prim_ops_lib) target_compile_options(custom_kernels PUBLIC ${_common_compile_options}) gen_operators_lib( diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index 6ae9b2c12f3..8eaecf3d5f5 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -58,7 +58,7 @@ if(TARGET executorch-shared AND NOT APPLE) set(required_lib_list portable_kernels) set(EXECUTORCH_LIBRARIES executorch-shared) else() - set(required_lib_list executorch executorch_core portable_kernels) + set(required_lib_list prim_ops_lib executorch_core portable_kernels) set(EXECUTORCH_LIBRARIES) endif() set(EXECUTORCH_INCLUDE_DIRS From 48364c4339e4dd77355a1a7a0f71e249cedf108c Mon Sep 17 00:00:00 2001 From: TejasweeSulekh <75196163+TejasweeSulekh@users.noreply.github.com> Date: Wed, 30 Sep 2026 01:32:35 +0530 Subject: [PATCH 2/3] Added backwards compatibility, fixed regression --- CMakeLists.txt | 23 +++++++++++++------ .../kernel-library-custom-aten-kernel.md | 2 +- examples/models/llama/CMakeLists.txt | 1 + .../executorch/build/build_variables.bzl | 2 +- tools/cmake/Codegen.cmake | 4 ++-- tools/cmake/executorch-config.cmake | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d70fbc6b72..2cd36f038a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -701,16 +701,25 @@ if(EXECUTORCH_BUILD_PYBIND AND APPLE) endif() # -# executorch: Primary runtime library with primitive operators. +# prim_ops_lib: Primary runtime library with primitive operators. # -# Provides the Program and Method interfaces, along with primitive operators. -# Does not contain portable kernels or other full operators. Does not contain -# any backends. +# Provides primitive operators. Does not contain portable kernels or other full +# operators. Does not contain any backends. Pulls executorch_core transitively. # -add_library(prim_ops_lib ${_executorch__srcs}) +add_library(prim_ops_lib ${_prim_ops_lib__srcs}) +# We keep the output name as "executorch" so that the compiled archive is still +# libexecutorch.a, ensuring scripts and iOS Xcode projects do not break. +set_target_properties(prim_ops_lib PROPERTIES OUTPUT_NAME "executorch") + +# DEPRECATED: executorch alias is kept purely for backwards compatibility. +# External consumers linking to `executorch` will transparently link `prim_ops_lib`. +add_library(executorch INTERFACE) +target_link_libraries(executorch INTERFACE prim_ops_lib) target_link_libraries(prim_ops_lib PRIVATE executorch_core) target_include_directories(prim_ops_lib PUBLIC ${_common_include_directories}) -target_compile_definitions(prim_ops_lib PUBLIC C10_USING_CUSTOM_GENERATED_MACROS) +target_compile_definitions( + prim_ops_lib PUBLIC C10_USING_CUSTOM_GENERATED_MACROS +) if(NOT EXECUTORCH_ENABLE_LOGGING) target_compile_definitions(prim_ops_lib PUBLIC ET_LOG_ENABLED=0) endif() @@ -805,7 +814,7 @@ install( PATTERN "*.h" ) install( - TARGETS prim_ops_lib executorch_core + TARGETS prim_ops_lib executorch executorch_core EXPORT ExecuTorchTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/docs/source/kernel-library-custom-aten-kernel.md b/docs/source/kernel-library-custom-aten-kernel.md index e941b6a3806..54b25e2e218 100644 --- a/docs/source/kernel-library-custom-aten-kernel.md +++ b/docs/source/kernel-library-custom-aten-kernel.md @@ -169,7 +169,7 @@ gen_selected_ops("" "${SELECT_OPS_LIST}" "") # Look for functions.yaml associated with portable libs and generate C++ bindings generate_bindings_for_kernels(FUNCTIONS_YAML ${EXECUTORCH_ROOT}/kernels/portable/functions.yaml) -# Prepare a C++ library called "generated_lib" with _kernel_lib being the portable library, executorch is a dependency of it. +# Prepare a C++ library called "generated_lib" with _kernel_lib being the portable library, prim_ops_lib is a dependency of it. gen_operators_lib("generated_lib" KERNEL_LIBS ${_kernel_lib} DEPS prim_ops_lib) # Link "generated_lib" into the application: diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 95e897aeaa8..aed7d68ba72 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -84,6 +84,7 @@ find_package(gflags REQUIRED) # cross-compiling (e.g., to Android) to work as well. list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) +executorch_target_link_options_shared_lib(prim_ops_lib) # llama_runner library add_subdirectory(runner) diff --git a/shim_et/xplat/executorch/build/build_variables.bzl b/shim_et/xplat/executorch/build/build_variables.bzl index faeacb76b1d..d9b85987e71 100644 --- a/shim_et/xplat/executorch/build/build_variables.bzl +++ b/shim_et/xplat/executorch/build/build_variables.bzl @@ -26,7 +26,7 @@ # `srcs`. There should then be simple Python code that combines those lists into lists # that map 1:1 to the CMake library layout. -EXECUTORCH_SRCS = [ +PRIM_OPS_LIB_SRCS = [ "kernels/prim_ops/et_copy_index.cpp", "kernels/prim_ops/et_view.cpp", "kernels/prim_ops/register_prim_ops.cpp", diff --git a/tools/cmake/Codegen.cmake b/tools/cmake/Codegen.cmake index ea6067a34f8..ed96881acc2 100644 --- a/tools/cmake/Codegen.cmake +++ b/tools/cmake/Codegen.cmake @@ -563,7 +563,7 @@ endfunction() function(executorch_load_build_variables) set(EXECUTORCH_BUILD_VARIABLES_FILELISTS - EXECUTORCH_SRCS + PRIM_OPS_LIB_SRCS EXECUTORCH_CORE_SRCS PORTABLE_KERNELS_SRCS KERNELS_UTIL_ALL_DEPS_SRCS @@ -594,7 +594,7 @@ function(executorch_load_build_variables) LLAMA_RUNNER_SRCS ) set(EXECUTORCH_BUILD_VARIABLES_VARNAMES - _executorch__srcs + _prim_ops_lib__srcs _executorch_core__srcs _portable_kernels__srcs _kernels_util_all_deps__srcs diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index 8eaecf3d5f5..6ae9b2c12f3 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -58,7 +58,7 @@ if(TARGET executorch-shared AND NOT APPLE) set(required_lib_list portable_kernels) set(EXECUTORCH_LIBRARIES executorch-shared) else() - set(required_lib_list prim_ops_lib executorch_core portable_kernels) + set(required_lib_list executorch executorch_core portable_kernels) set(EXECUTORCH_LIBRARIES) endif() set(EXECUTORCH_INCLUDE_DIRS From d1f2e415552e92cb58cd64b26e3b8ab79de4bb58 Mon Sep 17 00:00:00 2001 From: TejasweeSulekh <75196163+TejasweeSulekh@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:20:21 +0530 Subject: [PATCH 3/3] Introduced correct calls and lintrunner --- CMakeLists.txt | 3 ++- backends/cadence/CMakeLists.txt | 2 +- backends/mlx/examples/llm/CMakeLists.txt | 2 +- examples/devtools/CMakeLists.txt | 2 +- examples/llm_server/cpp/CMakeLists.txt | 2 +- examples/models/dinov2/CMakeLists.txt | 2 +- examples/models/gemma3/CMakeLists.txt | 2 +- examples/models/gemma4/CMakeLists.txt | 2 +- examples/models/gemma4_31b/CMakeLists.txt | 2 +- examples/models/llava/CMakeLists.txt | 2 +- examples/models/muse-glimmer/CMakeLists.txt | 2 +- examples/models/parakeet/CMakeLists.txt | 2 +- examples/models/qwen3_5_moe/CMakeLists.txt | 2 +- examples/models/silero_vad/CMakeLists.txt | 2 +- examples/models/sortformer/CMakeLists.txt | 2 +- examples/models/supertonic/CMakeLists.txt | 2 +- examples/models/voxtral/CMakeLists.txt | 2 +- examples/models/voxtral_realtime/CMakeLists.txt | 2 +- examples/models/voxtral_tts/CMakeLists.txt | 2 +- examples/models/whisper/CMakeLists.txt | 2 +- examples/models/yolo26/CMakeLists.txt | 2 +- extension/android/CMakeLists.txt | 2 +- 22 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cd36f038a5..880f4b29d46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -712,7 +712,8 @@ add_library(prim_ops_lib ${_prim_ops_lib__srcs}) set_target_properties(prim_ops_lib PROPERTIES OUTPUT_NAME "executorch") # DEPRECATED: executorch alias is kept purely for backwards compatibility. -# External consumers linking to `executorch` will transparently link `prim_ops_lib`. +# External consumers linking to `executorch` will transparently link +# `prim_ops_lib`. add_library(executorch INTERFACE) target_link_libraries(executorch INTERFACE prim_ops_lib) target_link_libraries(prim_ops_lib PRIVATE executorch_core) diff --git a/backends/cadence/CMakeLists.txt b/backends/cadence/CMakeLists.txt index c4bcd47f343..0e10633f516 100644 --- a/backends/cadence/CMakeLists.txt +++ b/backends/cadence/CMakeLists.txt @@ -36,7 +36,7 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER) # Find prebuilt libraries. executorch package should contain portable_ops_lib, # etdump, bundled_program. find_package(executorch CONFIG REQUIRED) - executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(prim_ops_lib) executorch_target_link_options_shared_lib(portable_ops_lib) target_include_directories( diff --git a/backends/mlx/examples/llm/CMakeLists.txt b/backends/mlx/examples/llm/CMakeLists.txt index b8ef4981bce..beeca73cc9a 100644 --- a/backends/mlx/examples/llm/CMakeLists.txt +++ b/backends/mlx/examples/llm/CMakeLists.txt @@ -28,7 +28,7 @@ set(_flatbuffers_include ${EXECUTORCH_ROOT}/third-party/flatbuffers/include) list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) # As in examples/models/llama: point gflags_DIR at the copy the executorch build # configured, since a separate find_package() project cannot see it. diff --git a/examples/devtools/CMakeLists.txt b/examples/devtools/CMakeLists.txt index c1d44df0d2b..ffb9443b09a 100644 --- a/examples/devtools/CMakeLists.txt +++ b/examples/devtools/CMakeLists.txt @@ -39,7 +39,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) # Find prebuilt libraries. executorch package should contain portable_ops_lib, # etdump, bundled_program. find_package(executorch CONFIG REQUIRED) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) executorch_target_link_options_shared_lib(portable_ops_lib) target_include_directories(executorch INTERFACE ${_common_include_directories}) diff --git a/examples/llm_server/cpp/CMakeLists.txt b/examples/llm_server/cpp/CMakeLists.txt index 8b51b8d9b3c..3065aefddab 100644 --- a/examples/llm_server/cpp/CMakeLists.txt +++ b/examples/llm_server/cpp/CMakeLists.txt @@ -27,7 +27,7 @@ set(_json_include list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) find_package(Threads REQUIRED) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) # Older installed packages may omit this header-only interface target. if(NOT TARGET extension_llm_session) diff --git a/examples/models/dinov2/CMakeLists.txt b/examples/models/dinov2/CMakeLists.txt index 8e83ee44873..d30a4ae3ef6 100644 --- a/examples/models/dinov2/CMakeLists.txt +++ b/examples/models/dinov2/CMakeLists.txt @@ -28,7 +28,7 @@ list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) get_target_property(_executorch_imported executorch IMPORTED) if(NOT _executorch_imported) - executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(prim_ops_lib) endif() set(link_libraries executorch gflags) diff --git a/examples/models/gemma3/CMakeLists.txt b/examples/models/gemma3/CMakeLists.txt index d228ca53c46..90d95212787 100644 --- a/examples/models/gemma3/CMakeLists.txt +++ b/examples/models/gemma3/CMakeLists.txt @@ -34,7 +34,7 @@ find_package(gflags REQUIRED) # Find `executorch` libraries, same as for gflags list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) set(_srcs e2e_runner.cpp) diff --git a/examples/models/gemma4/CMakeLists.txt b/examples/models/gemma4/CMakeLists.txt index d4e05e70306..68b6ee81177 100644 --- a/examples/models/gemma4/CMakeLists.txt +++ b/examples/models/gemma4/CMakeLists.txt @@ -28,7 +28,7 @@ find_package(gflags REQUIRED) # Find `executorch` libraries, same as for gflags list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) set(_srcs e2e_runner.cpp) diff --git a/examples/models/gemma4_31b/CMakeLists.txt b/examples/models/gemma4_31b/CMakeLists.txt index 2d43d2baaf0..2af0f9668e4 100644 --- a/examples/models/gemma4_31b/CMakeLists.txt +++ b/examples/models/gemma4_31b/CMakeLists.txt @@ -27,7 +27,7 @@ find_package(Threads REQUIRED) # executorch list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index 8444f41f77f..bb7d4380f3f 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -81,7 +81,7 @@ find_package(gflags REQUIRED) # find `executorch` libraries Same as for gflags list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(LINK_LIBS executorch gflags extension_llm_runner) set(link_libraries ${LINK_LIBS}) diff --git a/examples/models/muse-glimmer/CMakeLists.txt b/examples/models/muse-glimmer/CMakeLists.txt index 1869dded2fe..d656f6787d7 100644 --- a/examples/models/muse-glimmer/CMakeLists.txt +++ b/examples/models/muse-glimmer/CMakeLists.txt @@ -31,7 +31,7 @@ find_package(Threads REQUIRED) # executorch list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) diff --git a/examples/models/parakeet/CMakeLists.txt b/examples/models/parakeet/CMakeLists.txt index 9449583c613..ec075d3aefb 100644 --- a/examples/models/parakeet/CMakeLists.txt +++ b/examples/models/parakeet/CMakeLists.txt @@ -29,7 +29,7 @@ list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) get_target_property(_executorch_imported executorch IMPORTED) if(NOT _executorch_imported) - executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(prim_ops_lib) endif() set(link_libraries executorch gflags) diff --git a/examples/models/qwen3_5_moe/CMakeLists.txt b/examples/models/qwen3_5_moe/CMakeLists.txt index 65bb7c2015f..99ce36dd379 100644 --- a/examples/models/qwen3_5_moe/CMakeLists.txt +++ b/examples/models/qwen3_5_moe/CMakeLists.txt @@ -27,7 +27,7 @@ find_package(Threads REQUIRED) # executorch list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) diff --git a/examples/models/silero_vad/CMakeLists.txt b/examples/models/silero_vad/CMakeLists.txt index 4ed81b19d84..319aed0cb77 100644 --- a/examples/models/silero_vad/CMakeLists.txt +++ b/examples/models/silero_vad/CMakeLists.txt @@ -26,7 +26,7 @@ list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) get_target_property(_executorch_imported executorch IMPORTED) if(NOT _executorch_imported) - executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(prim_ops_lib) endif() set(common_link_libraries executorch gflags) diff --git a/examples/models/sortformer/CMakeLists.txt b/examples/models/sortformer/CMakeLists.txt index 171eb726ed2..c1ddd840018 100644 --- a/examples/models/sortformer/CMakeLists.txt +++ b/examples/models/sortformer/CMakeLists.txt @@ -28,7 +28,7 @@ list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) get_target_property(_executorch_imported executorch IMPORTED) if(NOT _executorch_imported) - executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(prim_ops_lib) endif() set(link_libraries executorch gflags) diff --git a/examples/models/supertonic/CMakeLists.txt b/examples/models/supertonic/CMakeLists.txt index 2eb01022564..37e6d06fc44 100644 --- a/examples/models/supertonic/CMakeLists.txt +++ b/examples/models/supertonic/CMakeLists.txt @@ -60,7 +60,7 @@ find_package(gflags REQUIRED) list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) if(NOT TARGET mlxdelegate OR NOT TARGET mlx) message( diff --git a/examples/models/voxtral/CMakeLists.txt b/examples/models/voxtral/CMakeLists.txt index 2e8ebb5c5e9..590512a88d5 100644 --- a/examples/models/voxtral/CMakeLists.txt +++ b/examples/models/voxtral/CMakeLists.txt @@ -34,7 +34,7 @@ find_package(gflags REQUIRED) # Find `executorch` libraries, same as for gflags list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) set(_srcs multimodal.cpp) diff --git a/examples/models/voxtral_realtime/CMakeLists.txt b/examples/models/voxtral_realtime/CMakeLists.txt index 2710d86ed83..fbb4e79ccbf 100644 --- a/examples/models/voxtral_realtime/CMakeLists.txt +++ b/examples/models/voxtral_realtime/CMakeLists.txt @@ -26,7 +26,7 @@ find_package(gflags REQUIRED) # Find executorch libraries list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) diff --git a/examples/models/voxtral_tts/CMakeLists.txt b/examples/models/voxtral_tts/CMakeLists.txt index bfd17cd9810..b64f2504ea8 100644 --- a/examples/models/voxtral_tts/CMakeLists.txt +++ b/examples/models/voxtral_tts/CMakeLists.txt @@ -23,7 +23,7 @@ find_package(gflags REQUIRED) # ExecuTorch list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(link_libraries executorch gflags) diff --git a/examples/models/whisper/CMakeLists.txt b/examples/models/whisper/CMakeLists.txt index 08baf3b825f..775dc3558d1 100644 --- a/examples/models/whisper/CMakeLists.txt +++ b/examples/models/whisper/CMakeLists.txt @@ -28,7 +28,7 @@ find_package(gflags REQUIRED) list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) set(_link_libraries executorch gflags) set(_srcs multimodal.cpp) diff --git a/examples/models/yolo26/CMakeLists.txt b/examples/models/yolo26/CMakeLists.txt index 7995566b9e8..70d8353fd9e 100644 --- a/examples/models/yolo26/CMakeLists.txt +++ b/examples/models/yolo26/CMakeLists.txt @@ -30,7 +30,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) # find `executorch` libraries Same as for gflags find_package(executorch CONFIG REQUIRED PATHS ${EXECUTORCH_ROOT}/cmake-out) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) add_subdirectory(${EXECUTORCH_ROOT}/third-party/gflags gflags) set(link_libraries gflags) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index 8722444f519..b4e20353454 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -70,7 +70,7 @@ set_target_properties( "${CMAKE_CURRENT_BINARY_DIR}/third-party/fbjni/prefab/modules/fbjni/libs/android.${ANDROID_ABI}/libfbjni.so" ) -executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(prim_ops_lib) add_library( executorch_jni SHARED jni/jni_layer.cpp jni/log.cpp jni/jni_layer_runtime.cpp