From 4bc106e7a5de1c577d0c2af631c73be0fce93970 Mon Sep 17 00:00:00 2001 From: JawadKhan65 Date: Wed, 18 Jun 2025 19:37:28 +0500 Subject: [PATCH 1/3] Rename CMake target 'executorch' to 'prim_ops_lib' for clarity - Renamed executorch target to prim_ops_lib in CMakeLists.txt - Added executorch as an alias for backward compatibility - Updated executorch-config.cmake to use prim_ops_lib - Removed redundant manual target_link_options_shared_lib calls in examples - Updated documentation to reflect the new target name --- CMakeLists.txt | 27 ++++++++++++++++++--------- backends/cadence/CMakeLists.txt | 3 +-- examples/devtools/CMakeLists.txt | 2 +- examples/models/llama/CMakeLists.txt | 1 - examples/models/llava/CMakeLists.txt | 2 +- extension/android/CMakeLists.txt | 2 +- tools/cmake/executorch-config.cmake | 1 + 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a3b1f7bfe0..e789e2e6cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -392,18 +392,21 @@ 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. # -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) -target_compile_options(executorch PUBLIC ${_common_compile_options}) -target_link_options_shared_lib(executorch) +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) +target_compile_options(prim_ops_lib PUBLIC ${_common_compile_options}) +target_link_options_shared_lib(prim_ops_lib) + +# Legacy alias for backward compatibility during transition +add_library(executorch ALIAS prim_ops_lib) # # portable_ops_lib: A library to register core ATen ops using portable kernels, @@ -469,7 +472,13 @@ install( PATTERN "*.h" ) install( - TARGETS executorch executorch_core + TARGETS prim_ops_lib executorch_core + INCLUDES + DESTINATION ${_common_include_directories} +) +#prim_ops_lib install +install( + TARGETS prim_ops_lib executorch_core INCLUDES DESTINATION ${_common_include_directories} ) @@ -709,4 +718,4 @@ if(EXECUTORCH_BUILD_VULKAN) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/vulkan) endif() -include(Test.cmake) +include(Test.cmake) \ No newline at end of file diff --git a/backends/cadence/CMakeLists.txt b/backends/cadence/CMakeLists.txt index 17c88af8e11..bdfefb776b6 100644 --- a/backends/cadence/CMakeLists.txt +++ b/backends/cadence/CMakeLists.txt @@ -31,11 +31,10 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER) include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) set(_common_compile_options -Wno-deprecated-declarations -fPIC) - # Find prebuilt libraries. executorch package should contain portable_ops_lib, # etdump, bundled_program. find_package(executorch CONFIG REQUIRED) - target_link_options_shared_lib(executorch) + # Note: target_link_options_shared_lib(prim_ops_lib) is now called automatically in executorch-config.cmake target_link_options_shared_lib(portable_ops_lib) target_include_directories(executorch INTERFACE ${_common_include_directories}) diff --git a/examples/devtools/CMakeLists.txt b/examples/devtools/CMakeLists.txt index 74cbf5e78e6..b63d4d072c0 100644 --- a/examples/devtools/CMakeLists.txt +++ b/examples/devtools/CMakeLists.txt @@ -37,7 +37,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) -target_link_options_shared_lib(executorch) +# Note: target_link_options_shared_lib(prim_ops_lib) is now called automatically in executorch-config.cmake target_link_options_shared_lib(portable_ops_lib) target_include_directories(executorch INTERFACE ${_common_include_directories}) diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 8c27de20845..11012fb0092 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -80,7 +80,6 @@ find_package(gflags REQUIRED) # find `executorch` libraries Same as for gflags set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/cmake/ExecuTorch) find_package(executorch CONFIG REQUIRED) -target_link_options_shared_lib(executorch) # llama_runner library add_subdirectory(runner) diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index 64be6111674..b59c1fb8e31 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -78,7 +78,7 @@ find_package(gflags REQUIRED) # find `executorch` libraries Same as for gflags set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/cmake/ExecuTorch) find_package(executorch CONFIG REQUIRED) -target_link_options_shared_lib(executorch) +# Note: target_link_options_shared_lib(prim_ops_lib) is now called automatically in executorch-config.cmake # llava_runner library add_subdirectory(runner) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index 3b7a04c2e97..0f0e04471f1 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -62,7 +62,7 @@ set_target_properties(fbjni PROPERTIES set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../lib/cmake/ExecuTorch) find_package(executorch CONFIG REQUIRED) -target_link_options_shared_lib(executorch) +# Note: target_link_options_shared_lib(prim_ops_lib) is now called automatically in executorch-config.cmake add_library(executorch_jni SHARED jni/jni_layer.cpp jni/log.cpp jni/jni_layer_runtime.cpp) diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index aa5776163a9..5adb9230cfb 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -55,6 +55,7 @@ endforeach() set(EXECUTORCH_FOUND ON) target_link_libraries(executorch INTERFACE executorch_core) +target_link_options_shared_lib(prim_ops_lib) set(lib_list flatccrt From 88db625470623d9146b515d5f72b89f2c214777e Mon Sep 17 00:00:00 2001 From: JawadKhan65 Date: Fri, 20 Jun 2025 00:48:08 +0500 Subject: [PATCH 2/3] Fix CMake build references to use executorch alias instead of prim_ops_lib --- examples/arm/executor_runner/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index b3bae768996..1b27deaff46 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -470,7 +470,7 @@ endif() add_library(executorch STATIC IMPORTED) set_property( TARGET executorch PROPERTY IMPORTED_LOCATION - "${ET_BUILD_DIR_PATH}/libexecutorch.a" + "${ET_BUILD_DIR_PATH}/libprim_ops_lib.a" ) add_library(executorch_core STATIC IMPORTED) From 3960a9270a047b9ca9b8dcd84225dded1c27ff55 Mon Sep 17 00:00:00 2001 From: JawadKhan65 Date: Fri, 20 Jun 2025 00:52:07 +0500 Subject: [PATCH 3/3] Fix CMake build references to use executorch alias instead of prim_ops_lib --- examples/arm/executor_runner/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index 1b27deaff46..ec862769c89 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -470,7 +470,7 @@ endif() add_library(executorch STATIC IMPORTED) set_property( TARGET executorch PROPERTY IMPORTED_LOCATION - "${ET_BUILD_DIR_PATH}/libprim_ops_lib.a" + "${ET_BUILD_DIR_PATH}/libexecutorch.a" ) add_library(executorch_core STATIC IMPORTED)