diff --git a/CMakeLists.txt b/CMakeLists.txt index 963f5edfe32..6ac02b6e4bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,18 +403,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, @@ -486,7 +489,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} ) @@ -737,3 +746,4 @@ if(EXECUTORCH_BUILD_ANDROID_JNI) endif() include(Test.cmake) + 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/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index 7666af45769..1f43b36ec54 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -486,7 +486,7 @@ endif() add_library(executorch STATIC IMPORTED) set_property( TARGET executorch PROPERTY IMPORTED_LOCATION - "${ET_BUILD_DIR_PATH}/libexecutorch.a" + "${ET_BUILD_DIR_PATH}/libexecutorch.a" ) add_library(executorch_core STATIC IMPORTED) 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 b850e4e6c0b..e6b2c319501 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 8c183da4a8a..a1f3fb6f639 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 0432abf10b5..0f82ecc8de4 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -61,7 +61,10 @@ set_target_properties(fbjni PROPERTIES ) set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../lib/cmake/ExecuTorch) -target_link_options_shared_lib(executorch) + +find_package(executorch CONFIG REQUIRED) +# target_link_options_shared_lib(executorch) is now handled by 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 e73104b0f1e..83c9ac843b7 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -56,6 +56,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