Skip to content

Commit c28a0b4

Browse files
authored
Install NXP and OpenVINO backends, top-level CMake targets (#13673)
Make the top-level backends, extensions, and kernels targets installable. See #12949. Add CMake export directives for NXP and OpenVINO, which are needed to support the exportable top-level targets. I've also removed the apple and llm/apple extensions from the executorch_extensions target. From what I understand, these won't be consumed this way, as they are build via apple frameworks. There is some installation complexity to make it work with install, so I'm inclined to skip it if it won't be used. Will check with Anthony in the comments.
1 parent dcf8580 commit c28a0b4

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ endif()
582582

583583
if(EXECUTORCH_BUILD_EXTENSION_APPLE)
584584
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/apple)
585-
list(APPEND _executorch_extensions apple_extension)
586585
endif()
587586

588587
if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
@@ -649,7 +648,6 @@ endif()
649648

650649
if(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
651650
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/apple)
652-
list(APPEND _executorch_extensions extension_llm_apple)
653651
endif()
654652

655653
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
@@ -968,6 +966,10 @@ else()
968966
endif()
969967
target_link_libraries(executorch_kernels INTERFACE ${_executorch_kernels})
970968

969+
install(TARGETS executorch_backends executorch_extensions executorch_kernels
970+
EXPORT ExecuTorchTargets
971+
)
972+
971973
if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
972974
# Baseline libraries that executor_runner will link against.
973975
set(_executor_runner_libs executorch extension_evalue_util

backends/nxp/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
set(_common_include_directories
7-
${CMAKE_CURRENT_SOURCE_DIR}/../../..
8-
${CMAKE_CURRENT_SOURCE_DIR}/../../runtime/core/portable_type/c10
9-
)
6+
set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
107
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
118

129
set(_neutron_sources ${CMAKE_CURRENT_SOURCE_DIR}/runtime/NeutronBackend.cpp)
1310

1411
add_library(executorch_delegate_neutron STATIC ${_neutron_sources})
1512
target_include_directories(
16-
executorch_delegate_neutron PUBLIC ${_common_include_directories}
13+
executorch_delegate_neutron
14+
PRIVATE ${_common_include_directories}
15+
${PROJECT_SOURCE_DIR}/runtime/core/portable_type/c10
16+
)
17+
install(
18+
TARGETS executorch_delegate_neutron
19+
EXPORT ExecuTorchTargets
20+
DESTINATION lib
1721
)

backends/openvino/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ add_library(openvino_backend STATIC .)
3838
target_compile_options(openvino_backend PRIVATE -frtti -fexceptions)
3939

4040
# Include Executorch directories
41-
target_include_directories(openvino_backend PUBLIC ${COMMON_INCLUDE_DIRS})
41+
target_include_directories(openvino_backend PRIVATE ${COMMON_INCLUDE_DIRS})
4242

4343
# Link OpenVINO and ExecuteTorch core libraries
4444
target_link_libraries(
@@ -78,4 +78,10 @@ if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
7878
endif()
7979

8080
# Install OpenVINO backend library to the lib directory
81-
install(TARGETS openvino_backend DESTINATION lib)
81+
install(
82+
TARGETS openvino_backend
83+
EXPORT ExecuTorchTargets
84+
DESTINATION lib
85+
INCLUDES
86+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
87+
)

0 commit comments

Comments
 (0)