Skip to content

Commit d84df14

Browse files
Arm backend: Import executorch deps using find_package (#13060)
- Renames portable_ops_lib to arm_portable_ops_lib to not conflict with the op_lib from the executorch_package regestring all ops. - Adds install target to the ethos_u_delegate to make it findable using find_package. - Removes the --whole-archive arg for quantized_ops_lib to avoid re-registiring runtime error. Signed-off-by: Adrian Lundell <[email protected]>
1 parent 964a57a commit d84df14

File tree

2 files changed

+13
-70
lines changed

2 files changed

+13
-70
lines changed

backends/arm/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ endif()
1414

1515
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
1616

17-
set(_common_include_directories ${EXECUTORCH_ROOT}/.. ${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
17+
set(_common_include_directories
18+
${EXECUTORCH_ROOT}/.. ${EXECUTORCH_ROOT}/runtime/core/portable_type/c10
19+
)
1820
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
1921

2022

@@ -34,13 +36,12 @@ set(_arm_baremetal_sources backends/arm/runtime/EthosUBackend.cpp
3436
list(TRANSFORM _arm_baremetal_sources PREPEND "${EXECUTORCH_ROOT}/")
3537

3638
add_library(executorch_delegate_ethos_u STATIC ${_arm_baremetal_sources})
37-
target_include_directories(
38-
executorch_delegate_ethos_u PUBLIC ${_common_include_directories}
39-
)
40-
target_include_directories(
41-
executorch_delegate_ethos_u PUBLIC ${DRIVER_ETHOSU_INCLUDE_DIR}
39+
target_link_libraries(
40+
executorch_delegate_ethos_u PUBLIC executorch_core ethosu_core_driver
4241
)
4342

43+
install(TARGETS executorch_delegate_ethos_u EXPORT ExecuTorchTargets)
44+
4445
# end config for bare metal builds
4546
endif()
4647

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -111,50 +111,16 @@ add_corstone_subdirectory(${SYSTEM_CONFIG} ${ETHOS_SDK_PATH})
111111
configure_timing_adapters(${SYSTEM_CONFIG} ${MEMORY_MODE})
112112

113113
# Dependencies from the ExecuTorch build
114-
add_library(executorch STATIC IMPORTED)
115-
set_property(
116-
TARGET executorch PROPERTY IMPORTED_LOCATION
117-
"${ET_BUILD_DIR_PATH}/libexecutorch.a"
118-
)
119-
120-
add_library(executorch_core STATIC IMPORTED)
121-
set_property(
122-
TARGET executorch_core PROPERTY IMPORTED_LOCATION
123-
"${ET_BUILD_DIR_PATH}/libexecutorch_core.a"
114+
find_package(
115+
executorch REQUIRED HINTS "${ET_BUILD_DIR_PATH}/lib/cmake/ExecuTorch"
124116
)
125-
target_link_libraries(executorch INTERFACE executorch_core)
126117

127-
add_library(executorch_delegate_ethos_u STATIC IMPORTED)
118+
add_library(arm_portable_ops_lib STATIC IMPORTED)
128119
set_property(
129-
TARGET executorch_delegate_ethos_u
130-
PROPERTY IMPORTED_LOCATION
131-
"${ET_BUILD_DIR_PATH}/backends/arm/libexecutorch_delegate_ethos_u.a"
132-
)
133-
134-
add_library(portable_ops_lib STATIC IMPORTED)
135-
set_property(
136-
TARGET portable_ops_lib
120+
TARGET arm_portable_ops_lib
137121
PROPERTY IMPORTED_LOCATION
138122
"${ET_BUILD_DIR_PATH}/examples/arm/libarm_portable_ops_lib.a"
139123
)
140-
add_library(portable_kernels STATIC IMPORTED)
141-
set_property(
142-
TARGET portable_kernels
143-
PROPERTY IMPORTED_LOCATION
144-
"${ET_BUILD_DIR_PATH}/kernels/portable/libportable_kernels.a"
145-
)
146-
add_library(quantized_ops_lib STATIC IMPORTED)
147-
set_property(
148-
TARGET quantized_ops_lib
149-
PROPERTY IMPORTED_LOCATION
150-
"${ET_BUILD_DIR_PATH}/kernels/quantized/libquantized_ops_lib.a"
151-
)
152-
add_library(quantized_kernels STATIC IMPORTED)
153-
set_property(
154-
TARGET quantized_kernels
155-
PROPERTY IMPORTED_LOCATION
156-
"${ET_BUILD_DIR_PATH}/kernels/quantized/libquantized_kernels.a"
157-
)
158124
add_library(cortex_m_ops_lib STATIC IMPORTED)
159125
set_property(
160126
TARGET cortex_m_ops_lib
@@ -167,13 +133,6 @@ set_property(
167133
PROPERTY IMPORTED_LOCATION
168134
"${ET_BUILD_DIR_PATH}/backends/cortex_m/libcortex_m_kernels.a"
169135
)
170-
add_library(extension_runner_util STATIC IMPORTED)
171-
set_property(
172-
TARGET extension_runner_util
173-
PROPERTY
174-
IMPORTED_LOCATION
175-
"${ET_BUILD_DIR_PATH}/extension/runner_util/libextension_runner_util.a"
176-
)
177136

178137
# Convert pte to header
179138
if(NOT ${SEMIHOSTING})
@@ -208,11 +167,11 @@ list(
208167
extension_runner_util
209168
ethosu_target_init
210169
executorch
170+
quantized_ops_lib
211171
"-Wl,--whole-archive"
212172
executorch_delegate_ethos_u
213173
cortex_m_ops_lib
214-
quantized_ops_lib
215-
portable_ops_lib
174+
arm_portable_ops_lib
216175
quantized_kernels
217176
cortex_m_kernels
218177
portable_kernels
@@ -224,27 +183,10 @@ list(
224183
if(EXECUTORCH_ENABLE_EVENT_TRACER)
225184
target_compile_options(arm_executor_runner PUBLIC -DET_EVENT_TRACER_ENABLED)
226185

227-
add_library(etdump STATIC IMPORTED)
228-
set_property(
229-
TARGET etdump PROPERTY IMPORTED_LOCATION
230-
"${ET_BUILD_DIR_PATH}/lib/libetdump.a"
231-
)
232-
233-
add_library(flatccrt STATIC IMPORTED)
234-
set_property(
235-
TARGET flatccrt PROPERTY IMPORTED_LOCATION
236-
"${ET_BUILD_DIR_PATH}/lib/libflatccrt.a"
237-
)
238-
239186
list(APPEND arm_executor_runner_link etdump flatccrt)
240187
endif()
241188

242189
if(ET_BUNDLE_IO)
243-
add_library(bundled_program STATIC IMPORTED)
244-
set_property(
245-
TARGET bundled_program
246-
PROPERTY IMPORTED_LOCATION "${ET_BUILD_DIR_PATH}/lib/libbundled_program.a"
247-
)
248190
list(APPEND arm_executor_runner_link bundled_program)
249191
endif()
250192

0 commit comments

Comments
 (0)