Skip to content

Commit 609c745

Browse files
committed
remove the ability to bring flatc
1 parent 0ccf509 commit 609c745

13 files changed

+7
-146
lines changed

.ci/scripts/build_llama_android.sh

-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,5 @@ build_llama_runner() {
6060

6161
cmake --build cmake-android-out/examples/models/llama -j4 --config Release
6262
}
63-
install_flatc_from_source
6463
install_executorch_and_backend_lib
6564
build_llama_runner

.ci/scripts/utils.sh

-19
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,6 @@ install_pytorch_and_domains() {
7272
sccache --show-stats || true
7373
}
7474

75-
install_flatc_from_source() {
76-
# NB: This function could be used to install flatbuffer from source
77-
pushd third-party/flatbuffers || return
78-
79-
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
80-
if [ "$(uname)" == "Darwin" ]; then
81-
CMAKE_JOBS=$(( $(sysctl -n hw.ncpu) - 1 ))
82-
else
83-
CMAKE_JOBS=$(( $(nproc) - 1 ))
84-
fi
85-
cmake --build . -j "${CMAKE_JOBS}"
86-
87-
# Copy the flatc binary to conda path
88-
EXEC_PATH=$(dirname "$(which python)")
89-
cp flatc "${EXEC_PATH}"
90-
91-
popd || return
92-
}
93-
9475
build_executorch_runner_buck2() {
9576
# Build executorch runtime with retry as this step is flaky on macos CI
9677
retry buck2 build //examples/portable/executor_runner:executor_runner

CMakeLists.txt

+7-8
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,9 @@ cmake_dependent_option(
471471
#
472472
cmake_dependent_option(
473473
EXECUTORCH_BUILD_FLATC "Build the flatc executable." ON
474-
"NOT FLATC_EXECUTABLE;EXECUTORCH_BUILD_HOST_TARGETS" OFF
474+
"NOT FLATC_EXECUTABLE" OFF
475475
)
476476

477-
478477
set(FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "")
479478
set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "")
480479
set(FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "")
@@ -507,6 +506,9 @@ if(EXECUTORCH_BUILD_FLATC)
507506
-DFLATBUFFERS_BUILD_TESTS=${FLATBUFFERS_BUILD_TESTS}
508507
-DFLATBUFFERS_INSTALL=${FLATBUFFERS_INSTALL}
509508
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${FLATBUFFERS_MAX_ALIGNMENT}"
509+
# Flags "unset" to prevent platform flags from being propagated.
510+
$<$<BOOL:${CMAKE_TOOLCHAIN_IOS}>:-DCMAKE_TOOLCHAIN_FILE=>
511+
$<$<BOOL:${CMAKE_TOOLCHAIN_IOS}>:-DCMAKE_OSX_SYSROOT=>
510512
INSTALL_COMMAND ""
511513
BUILD_BYPRODUCTS <BINARY_DIR>/flatc
512514
)
@@ -515,6 +517,8 @@ if(EXECUTORCH_BUILD_FLATC)
515517
# flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release
516518
# config, but from CMake's perspective the build type is always Debug.
517519
set(FLATC_EXECUTABLE ${BINARY_DIR}/$<CONFIG>/flatc.exe)
520+
elseif(CMAKE_TOOLCHAIN_IOS)
521+
set(FLATC_EXECUTABLE ${BINARY_DIR}/$<CONFIG>/flatc)
518522
else()
519523
set(FLATC_EXECUTABLE ${BINARY_DIR}/flatc)
520524
endif()
@@ -528,12 +532,7 @@ if(NOT FLATC_EXECUTABLE)
528532
find_program(FLATC_EXECUTABLE flatc)
529533

530534
if(NOT FLATC_EXECUTABLE)
531-
message(
532-
FATAL_ERROR
533-
"FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled. "
534-
"Note that EXECUTORCH_BUILD_FLATC may be disabled implicitly when "
535-
"cross-compiling or when EXECUTORCH_BUILD_HOST_TARGETS is disabled."
536-
)
535+
message(FATAL_ERROR "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled.")
537536
endif()
538537
endif()
539538

backends/apple/coreml/scripts/build_tests.sh

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_EXECUTORCH_BUILD_DIR_PATH" \
3232
-DCMAKE_TOOLCHAIN_FILE="$IOS_TOOLCHAIN_PATH" \
3333
-DPLATFORM=MAC_UNIVERSAL \
3434
-DDEPLOYMENT_TARGET=13.0 \
35-
-DFLATC_EXECUTABLE="$(which flatc)" \
3635
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
3736
-DEXECUTORCH_BUILD_XNNPACK=OFF \
3837
-DEXECUTORCH_BUILD_GFLAGS=OFF

backends/arm/scripts/build_executorch.sh

-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ if [ "$build_with_etdump" = true ] ; then
8484
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
8585
-DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=ON \
8686
-DFLATCC_ALLOW_WERROR=OFF \
87-
-DFLATC_EXECUTABLE="$(which flatc)" \
8887
-B"${et_build_host_dir}" \
8988
"${et_root_dir}"
9089

@@ -133,7 +132,6 @@ cmake \
133132
-DEXECUTORCH_ENABLE_LOGGING=ON \
134133
${build_devtools_flags} \
135134
${build_with_etdump_flags} \
136-
-DFLATC_EXECUTABLE="$(which flatc)" \
137135
-B"${et_build_dir}" \
138136
"${et_root_dir}"
139137

backends/cadence/build_cadence_fusionG3.sh

-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ if $STEPWISE_BUILD; then
3232
-DEXECUTORCH_ENABLE_LOGGING=ON \
3333
-DEXECUTORCH_USE_DL=OFF \
3434
-DEXECUTORCH_BUILD_CADENCE=OFF \
35-
-DFLATC_EXECUTABLE="$(which flatc)" \
3635
-DHAVE_FNMATCH_H=OFF \
3736
-Bcmake-out .
3837

@@ -45,7 +44,6 @@ if $STEPWISE_BUILD; then
4544
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
4645
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
4746
-DEXECUTORCH_BUILD_CADENCE=ON \
48-
-DFLATC_EXECUTABLE="$(which flatc)" \
4947
-DEXECUTORCH_ENABLE_LOGGING=ON \
5048
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \
5149
-DEXECUTORCH_USE_DL=OFF \
@@ -73,7 +71,6 @@ else
7371
-DEXECUTORCH_BUILD_CPUINFO=OFF \
7472
-DEXECUTORCH_BUILD_FLATC=OFF \
7573
-DEXECUTORCH_BUILD_CADENCE=ON \
76-
-DFLATC_EXECUTABLE="$(which flatc)" \
7774
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
7875
-DEXECUTORCH_ENABLE_LOGGING=ON \
7976
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \

backends/cadence/build_cadence_hifi4.sh

-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ if $STEPWISE_BUILD; then
3232
-DEXECUTORCH_ENABLE_LOGGING=ON \
3333
-DEXECUTORCH_USE_DL=OFF \
3434
-DEXECUTORCH_BUILD_CADENCE=OFF \
35-
-DFLATC_EXECUTABLE="$(which flatc)" \
3635
-Bcmake-out .
3736

3837
echo "Building any Cadence-specific binaries on top"
@@ -44,7 +43,6 @@ if $STEPWISE_BUILD; then
4443
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
4544
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
4645
-DEXECUTORCH_BUILD_CADENCE=ON \
47-
-DFLATC_EXECUTABLE="$(which flatc)" \
4846
-DEXECUTORCH_ENABLE_LOGGING=ON \
4947
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \
5048
-DEXECUTORCH_USE_DL=OFF \
@@ -71,7 +69,6 @@ else
7169
-DEXECUTORCH_BUILD_CPUINFO=OFF \
7270
-DEXECUTORCH_BUILD_FLATC=OFF \
7371
-DEXECUTORCH_BUILD_CADENCE=ON \
74-
-DFLATC_EXECUTABLE="$(which flatc)" \
7572
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
7673
-DEXECUTORCH_ENABLE_LOGGING=ON \
7774
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \

build/build_android_library.sh

100644100755
File mode changed.

build/build_apple_frameworks.sh

-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ OUTPUT="cmake-out"
1212
MODES=()
1313
TOOLCHAIN=""
1414
PYTHON=$(which python3)
15-
FLATC=$(which flatc)
1615
COREML=OFF
1716
CUSTOM=OFF
1817
MPS=OFF
@@ -83,7 +82,6 @@ usage() {
8382
echo " --Release Build Release version."
8483
echo " --toolchain=FILE CMake toolchain file. Default: '\$SOURCE_ROOT_DIR/third-party/ios-cmake/ios.toolchain.cmake'"
8584
echo " --python=FILE Python executable path. Default: Path of python3 in \$PATH"
86-
echo " --flatc=FILE FlatBuffers Compiler executable path. Default: Path of flatc in \$PATH"
8785
echo " --coreml Build the Core ML backend."
8886
echo " --custom Build the Custom kernels."
8987
echo " --mps Build the Metal Performance Shaders backend."
@@ -113,7 +111,6 @@ for arg in "$@"; do
113111
;;
114112
--toolchain=*) TOOLCHAIN="${arg#*=}" ;;
115113
--python=*) PYTHON="${arg#*=}" ;;
116-
--flatc=*) FLATC="${arg#*=}" ;;
117114
--coreml) COREML=ON ;;
118115
--custom) CUSTOM=ON ;;
119116
--mps) MPS=ON ;;
@@ -152,7 +149,6 @@ check_command() {
152149
check_command cmake
153150
check_command rsync
154151
check_command "$PYTHON"
155-
check_command "$FLATC"
156152

157153
echo "Building libraries"
158154

@@ -173,7 +169,6 @@ cmake_build() {
173169
-DCMAKE_C_FLAGS="-ffile-prefix-map=$SOURCE_ROOT_DIR=/executorch -fdebug-prefix-map=$SOURCE_ROOT_DIR=/executorch" \
174170
-DCMAKE_CXX_FLAGS="-ffile-prefix-map=$SOURCE_ROOT_DIR=/executorch -fdebug-prefix-map=$SOURCE_ROOT_DIR=/executorch" \
175171
-DPYTHON_EXECUTABLE="$PYTHON" \
176-
-DFLATC_EXECUTABLE="$FLATC" \
177172
-DEXECUTORCH_BUILD_COREML=$COREML \
178173
-DEXECUTORCH_BUILD_MPS=$MPS \
179174
-DEXECUTORCH_BUILD_XNNPACK=$XNNPACK \

build/install_flatc.sh

-99
This file was deleted.

build/test_ios.sh

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ say "Installing Requirements"
6464
pip install --upgrade cmake pip setuptools wheel zstd
6565

6666
./install_executorch.sh --pybind coreml mps xnnpack
67-
export PATH="$(realpath third-party/flatbuffers/cmake-out):$PATH"
68-
./build/install_flatc.sh
6967

7068
say "Installing CoreML Backend Requirements"
7169

docs/source/backends-cadence.md

-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ cmake -DCMAKE_TOOLCHAIN_FILE=<path_to_executorch>/backends/cadence/cadence.cmake
175175
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
176176
-DEXECUTORCH_BUILD_CPUINFO=OFF \
177177
-DEXECUTORCH_BUILD_FLATC=OFF \
178-
-DFLATC_EXECUTABLE="$(which flatc)" \
179178
-Bcmake-out .
180179

181180
cmake --build cmake-out -j<num_cores> --target install --config Debug
@@ -185,7 +184,6 @@ cmake -DCMAKE_BUILD_TYPE=Debug \
185184
-DCMAKE_PREFIX_PATH=<path_to_executorch>/cmake-out \
186185
-DMODEL_PATH=<path_to_program_file_generated_in_previous_step> \
187186
-DNXP_SDK_ROOT_DIR=<path_to_nxp_sdk_root> -DEXECUTORCH_BUILD_FLATC=0 \
188-
-DFLATC_EXECUTABLE="$(which flatc)" \
189187
-DNN_LIB_BASE_DIR=<path_to_nnlib_cloned_in_step_2> \
190188
-Bcmake-out/examples/cadence \
191189
examples/cadence

examples/apple/coreml/scripts/build_executor_runner.sh

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_BUILD_DIR_PATH" \
3333
-DCMAKE_TOOLCHAIN_FILE="$IOS_TOOLCHAIN_PATH" \
3434
-DPLATFORM=MAC_UNIVERSAL \
3535
-DDEPLOYMENT_TARGET=13.0 \
36-
-DFLATC_EXECUTABLE="$(which flatc)" \
3736
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
3837
-DEXECUTORCH_BUILD_XNNPACK=OFF \
3938
-DEXECUTORCH_BUILD_DEVTOOLS=ON \

0 commit comments

Comments
 (0)