Skip to content

Commit 6d937e5

Browse files
committed
fix libflatccrt
1 parent 54e7c75 commit 6d937e5

File tree

6 files changed

+12
-32
lines changed

6 files changed

+12
-32
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ if(EXECUTORCH_BUILD_PYBIND)
582582
${TORCH_PYTHON_LIBRARY}
583583
bundled_program
584584
etdump
585+
flatccrt
585586
executorch
586587
extension_data_loader
587588
util

examples/apple/mps/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
9797
list(TRANSFORM _mps_executor_runner__srcs PREPEND "${EXECUTORCH_ROOT}/")
9898
add_executable(mps_executor_runner ${_mps_executor_runner__srcs})
9999

100-
if(CMAKE_BUILD_TYPE MATCHES "Debug")
101-
set(FLATCC_LIB flatccrt_d)
102-
else()
103-
set(FLATCC_LIB flatccrt)
104-
endif()
105-
106100
if(CMAKE_BUILD_TYPE MATCHES "Debug")
107101
target_link_options(mps_executor_runner PUBLIC -fsanitize=undefined)
108102
endif()
@@ -113,7 +107,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
113107
executorch
114108
gflags
115109
etdump
116-
${FLATCC_LIB}
110+
flatccrt
117111
mpsdelegate
118112
mps_portable_ops_lib
119113
${mps_executor_runner_libs}

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -576,23 +576,7 @@ if(EXECUTORCH_ENABLE_EVENT_TRACER)
576576
"${ET_BUILD_DIR_PATH}/lib/libetdump.a"
577577
)
578578

579-
if(CMAKE_BUILD_TYPE MATCHES "Debug")
580-
set(FLATCCRT_LIB flatccrt_d)
581-
else()
582-
set(FLATCCRT_LIB flatccrt)
583-
endif()
584-
585-
add_library(${FLATCCRT_LIB} STATIC IMPORTED)
586-
set_property(
587-
TARGET ${FLATCCRT_LIB}
588-
PROPERTY IMPORTED_LOCATION
589-
"${ET_BUILD_DIR_PATH}/lib/lib${FLATCCRT_LIB}.a"
590-
)
591-
592-
list(APPEND arm_executor_runner_link
593-
etdump
594-
${FLATCCRT_LIB}
595-
)
579+
list(APPEND arm_executor_runner_link etdump flatccrt)
596580
endif()
597581

598582
if(ET_BUNDLE_IO)

examples/qualcomm/executor_runner/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ target_include_directories(
2020
)
2121
target_link_libraries(
2222
qnn_executor_runner qnn_executorch_backend full_portable_ops_lib etdump
23-
${FLATCCRT_LIB} gflags
23+
flatccrt gflags
2424
)
2525
set_target_properties(
2626
qnn_executor_runner PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"

third-party/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ add_subdirectory(flatcc)
8989
#
9090
# Learn more: https://github.com/pytorch/executorch/pull/2467
9191
set_property(TARGET flatccrt PROPERTY POSITION_INDEPENDENT_CODE ON)
92+
# flatcc appends a "_d" suffix (flatccrt_d) to debug builds. To simplify our
93+
# reference to the lib, remove the suffix.
94+
set_property(TARGET flatccrt PROPERTY DEBUG_POSTFIX "")
9295
install(
9396
TARGETS flatccrt
9497
DESTINATION ${CMAKE_BINARY_DIR}/lib

tools/cmake/executorch-config.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,12 @@ set(EXECUTORCH_FOUND ON)
5656

5757
target_link_libraries(executorch INTERFACE executorch_core)
5858

59-
if(CMAKE_BUILD_TYPE MATCHES "Debug")
60-
set(FLATCCRT_LIB flatccrt_d)
61-
else()
62-
set(FLATCCRT_LIB flatccrt)
63-
endif()
64-
6559
set(lib_list
60+
flatccrt
6661
etdump
6762
bundled_program
6863
extension_data_loader
6964
extension_flat_tensor
70-
${FLATCCRT_LIB}
7165
coreml_util
7266
coreml_inmemoryfs
7367
coremldelegate
@@ -154,6 +148,10 @@ if(TARGET coremldelegate)
154148
)
155149
endif()
156150

151+
if(TARGET etdump)
152+
set_target_properties(etdump PROPERTIES INTERFACE_LINK_LIBRARIES "flatccrt;executorch")
153+
endif()
154+
157155
if(TARGET optimized_native_cpu_ops_lib)
158156
if(TARGET optimized_portable_kernels)
159157
set(_maybe_optimized_portable_kernels_lib optimized_portable_kernels)

0 commit comments

Comments
 (0)