File tree Expand file tree Collapse file tree 7 files changed +22
-34
lines changed Expand file tree Collapse file tree 7 files changed +22
-34
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,12 @@ set -o xtrace
11
11
12
12
build_qnn_backend () {
13
13
echo " Start building qnn backend."
14
- export ANDROID_NDK_ROOT=/opt/ndk
15
- export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
14
+ export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT :- / opt/ ndk}
15
+ export QNN_SDK_ROOT=${QNN_SDK_ROOT :- / tmp/ qnn/ 2.28.0.241029}
16
16
export EXECUTORCH_ROOT=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) /../.." && pwd) "
17
17
18
- # Workaround to avoid issues around missing flatccrt library (depending on the
19
- # number of jobs used), see issue #7300:
20
- # Build twice (second time with `--no_clean`) to make sure libflatccrt.a is
21
- # available.
22
- # TODO: Remove this workaround once the underlying issue is fixed.
23
- bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release || \
24
- bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release --no_clean
18
+ parallelism=$(( $(nproc) - 1 ))
19
+ bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number ${parallelism} --release
25
20
}
26
21
27
22
set_up_aot () {
Original file line number Diff line number Diff line change @@ -582,6 +582,7 @@ if(EXECUTORCH_BUILD_PYBIND)
582
582
${TORCH_PYTHON_LIBRARY}
583
583
bundled_program
584
584
etdump
585
+ flatccrt
585
586
executorch
586
587
extension_data_loader
587
588
util
Original file line number Diff line number Diff line change @@ -97,12 +97,6 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
97
97
list (TRANSFORM _mps_executor_runner__srcs PREPEND "${EXECUTORCH_ROOT} /" )
98
98
add_executable (mps_executor_runner ${_mps_executor_runner__srcs} )
99
99
100
- if (CMAKE_BUILD_TYPE MATCHES "Debug" )
101
- set (FLATCC_LIB flatccrt_d )
102
- else ()
103
- set (FLATCC_LIB flatccrt )
104
- endif ()
105
-
106
100
if (CMAKE_BUILD_TYPE MATCHES "Debug" )
107
101
target_link_options (mps_executor_runner PUBLIC -fsanitize=undefined )
108
102
endif ()
@@ -113,7 +107,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
113
107
executorch
114
108
gflags
115
109
etdump
116
- ${FLATCC_LIB}
110
+ flatccrt
117
111
mpsdelegate
118
112
mps_portable_ops_lib
119
113
${mps_executor_runner_libs}
Original file line number Diff line number Diff line change @@ -583,22 +583,16 @@ if(EXECUTORCH_ENABLE_EVENT_TRACER)
583
583
"${ET_BUILD_DIR_PATH} /lib/libetdump.a"
584
584
)
585
585
586
- if (CMAKE_BUILD_TYPE MATCHES "Debug" )
587
- set (FLATCCRT_LIB flatccrt_d )
588
- else ()
589
- set (FLATCCRT_LIB flatccrt )
590
- endif ()
591
-
592
- add_library (${FLATCCRT_LIB} STATIC IMPORTED )
586
+ add_library (flatccrt STATIC IMPORTED )
593
587
set_property (
594
- TARGET ${FLATCCRT_LIB}
588
+ TARGET flatccrt
595
589
PROPERTY IMPORTED_LOCATION
596
- "${ET_BUILD_DIR_PATH} /lib/lib ${FLATCCRT_LIB} .a"
590
+ "${ET_BUILD_DIR_PATH} /lib/libflatccrt .a"
597
591
)
598
592
599
593
list (APPEND arm_executor_runner_link
600
594
etdump
601
- ${FLATCCRT_LIB}
595
+ flatccrt
602
596
)
603
597
endif ()
604
598
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ target_include_directories(
20
20
)
21
21
target_link_libraries (
22
22
qnn_executor_runner qnn_executorch_backend full_portable_ops_lib etdump
23
- ${FLATCCRT_LIB} gflags
23
+ flatccrt gflags
24
24
)
25
25
set_target_properties (
26
26
qnn_executor_runner PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ ExternalProject_Add(
68
68
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
69
69
BUILD_BYPRODUCTS <INSTALL_DIR>/bin/flatcc
70
70
)
71
+ file (REMOVE_RECURSE ${PROJECT_SOURCE_DIR} /third-party/flatcc/lib )
71
72
ExternalProject_Get_Property (flatcc_external_project INSTALL_DIR )
72
73
add_executable (flatcc_cli IMPORTED GLOBAL )
73
74
add_dependencies (flatcc_cli flatcc_external_project )
@@ -83,6 +84,11 @@ set(FLATCC_REFLECTION OFF CACHE BOOL "")
83
84
set (FLATCC_DEBUG_CLANG_SANITIZE OFF CACHE BOOL "" )
84
85
set (FLATCC_INSTALL OFF CACHE BOOL "" )
85
86
add_subdirectory (flatcc )
87
+ # Unfortunately flatcc writes libs directly in to the source tree [1]. So to
88
+ # ensure the target lib is created last, force flatcc_cli to build first.
89
+ #
90
+ # [1] https://github.com/dvidelabs/flatcc/blob/896db54787e8b730a6be482c69324751f3f5f117/CMakeLists.txt#L168
91
+ add_dependencies (flatccrt flatcc_cli )
86
92
# Fix for "relocation R_X86_64_32 against `.rodata' can not be used when making
87
93
# a shared object; recompile with -fPIC" when building on some x86 linux
88
94
# systems.
Original file line number Diff line number Diff line change @@ -56,18 +56,12 @@ set(EXECUTORCH_FOUND ON)
56
56
57
57
target_link_libraries (executorch INTERFACE executorch_core )
58
58
59
- if (CMAKE_BUILD_TYPE MATCHES "Debug" )
60
- set (FLATCCRT_LIB flatccrt_d )
61
- else ()
62
- set (FLATCCRT_LIB flatccrt )
63
- endif ()
64
-
65
59
set (lib_list
60
+ flatccrt
66
61
etdump
67
62
bundled_program
68
63
extension_data_loader
69
64
extension_flat_tensor
70
- ${FLATCCRT_LIB}
71
65
coreml_util
72
66
coreml_inmemoryfs
73
67
coremldelegate
@@ -154,6 +148,10 @@ if(TARGET coremldelegate)
154
148
)
155
149
endif ()
156
150
151
+ if (TARGET etdump )
152
+ set_target_properties (etdump PROPERTIES INTERFACE_LINK_LIBRARIES "flatccrt;executorch" )
153
+ endif ()
154
+
157
155
if (TARGET optimized_native_cpu_ops_lib )
158
156
if (TARGET optimized_portable_kernels )
159
157
set (_maybe_optimized_portable_kernels_lib optimized_portable_kernels )
You can’t perform that action at this time.
0 commit comments