Skip to content

Rename CMake target 'executorch' to 'prim_ops_lib' for clarity #11786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
26 changes: 18 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}
Comment on lines +492 to 500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like duplicate? We just need one of the installs

)
Expand Down Expand Up @@ -737,3 +746,4 @@ if(EXECUTORCH_BUILD_ANDROID_JNI)
endif()

include(Test.cmake)

3 changes: 1 addition & 2 deletions backends/cadence/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove this

target_link_options_shared_lib(portable_ops_lib)

target_include_directories(executorch INTERFACE ${_common_include_directories})
Expand Down
2 changes: 1 addition & 1 deletion examples/arm/executor_runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/devtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

target_link_options_shared_lib(portable_ops_lib)

target_include_directories(executorch INTERFACE ${_common_include_directories})
Expand Down
1 change: 0 additions & 1 deletion examples/models/llama/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/models/llava/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


# llava_runner library
add_subdirectory(runner)
Expand Down
5 changes: 4 additions & 1 deletion extension/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we don't need this right?

# target_link_options_shared_lib(executorch) is now handled by executorch-config.cmake

Comment on lines +66 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


add_library(executorch_jni SHARED jni/jni_layer.cpp jni/log.cpp jni/jni_layer_runtime.cpp)

Expand Down
1 change: 1 addition & 0 deletions tools/cmake/executorch-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endforeach()
set(EXECUTORCH_FOUND ON)

target_link_libraries(executorch INTERFACE executorch_core)
target_link_options_shared_lib(prim_ops_lib)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to line 177?


set(lib_list
flatccrt
Expand Down
Loading