Skip to content

Commit 4e3f774

Browse files
committed
remove the ability to bring flatc
1 parent a05c4da commit 4e3f774

13 files changed

+9
-154
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
@@ -80,25 +80,6 @@ install_pytorch_and_domains() {
8080
sccache --show-stats || true
8181
}
8282

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

CMakeLists.txt

+7-11
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ endif()
460460
# tools like `flatc`, along with example executables like `executor_runner` and
461461
# libraries that it uses, like `gflags`. Disabling this can be helpful when
462462
# cross-compiling, but some required tools that would have been built need to be
463-
# provided directly (via, for example, FLATC_EXECUTABLE).
463+
# provided directly.
464464
cmake_dependent_option(
465465
EXECUTORCH_BUILD_HOST_TARGETS "Build host-only targets." ON
466466
"NOT CMAKE_TOOLCHAIN_IOS" OFF
@@ -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 "")
@@ -498,15 +497,15 @@ if(EXECUTORCH_BUILD_FLATC)
498497
include(ExternalProject)
499498
ExternalProject_Add(
500499
flatbuffers
501-
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third-party/flatbuffers
502-
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/third-party/flatbuffers
503500
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/flatbuffers
504501
CMAKE_ARGS -DFLATBUFFERS_BUILD_FLATC=ON
505502
-DFLATBUFFERS_BUILD_FLATHASH=${FLATBUFFERS_BUILD_FLATHASH}
506503
-DFLATBUFFERS_BUILD_FLATLIB=${FLATBUFFERS_BUILD_FLATLIB}
507504
-DFLATBUFFERS_BUILD_TESTS=${FLATBUFFERS_BUILD_TESTS}
508505
-DFLATBUFFERS_INSTALL=${FLATBUFFERS_INSTALL}
509506
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${FLATBUFFERS_MAX_ALIGNMENT}"
507+
# If building for iOS, "unset" these variables to rely on the host (macOS) defaults.
508+
$<$<AND:$<BOOL:${CMAKE_TOOLCHAIN_IOS}>,$<BOOL:$<FILTER:${PLATFORM},EXCLUDE,^MAC>>>:-DCMAKE_OSX_SYSROOT=>
510509
INSTALL_COMMAND ""
511510
BUILD_BYPRODUCTS <BINARY_DIR>/flatc
512511
)
@@ -515,6 +514,8 @@ if(EXECUTORCH_BUILD_FLATC)
515514
# flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release
516515
# config, but from CMake's perspective the build type is always Debug.
517516
set(FLATC_EXECUTABLE ${BINARY_DIR}/$<CONFIG>/flatc.exe)
517+
elseif(CMAKE_GENERATOR STREQUAL "Xcode")
518+
set(FLATC_EXECUTABLE ${BINARY_DIR}/$<CONFIG>/flatc)
518519
else()
519520
set(FLATC_EXECUTABLE ${BINARY_DIR}/flatc)
520521
endif()
@@ -528,12 +529,7 @@ if(NOT FLATC_EXECUTABLE)
528529
find_program(FLATC_EXECUTABLE flatc)
529530

530531
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-
)
532+
message(FATAL_ERROR "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled.")
537533
endif()
538534
endif()
539535

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

-4
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 \
@@ -71,9 +69,7 @@ else
7169
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
7270
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
7371
-DEXECUTORCH_BUILD_CPUINFO=OFF \
74-
-DEXECUTORCH_BUILD_FLATC=OFF \
7572
-DEXECUTORCH_BUILD_CADENCE=ON \
76-
-DFLATC_EXECUTABLE="$(which flatc)" \
7773
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
7874
-DEXECUTORCH_ENABLE_LOGGING=ON \
7975
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \

backends/cadence/build_cadence_hifi4.sh

-4
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 \
@@ -69,9 +67,7 @@ else
6967
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
7068
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
7169
-DEXECUTORCH_BUILD_CPUINFO=OFF \
72-
-DEXECUTORCH_BUILD_FLATC=OFF \
7370
-DEXECUTORCH_BUILD_CADENCE=ON \
74-
-DFLATC_EXECUTABLE="$(which flatc)" \
7571
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
7672
-DEXECUTORCH_ENABLE_LOGGING=ON \
7773
-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

+1-4
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ cmake -DCMAKE_TOOLCHAIN_FILE=<path_to_executorch>/backends/cadence/cadence.cmake
174174
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
175175
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
176176
-DEXECUTORCH_BUILD_CPUINFO=OFF \
177-
-DEXECUTORCH_BUILD_FLATC=OFF \
178-
-DFLATC_EXECUTABLE="$(which flatc)" \
179177
-Bcmake-out .
180178

181179
cmake --build cmake-out -j<num_cores> --target install --config Debug
@@ -184,8 +182,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug \
184182
-DCMAKE_TOOLCHAIN_FILE=<path_to_executorch>/examples/backends/cadence.cmake \
185183
-DCMAKE_PREFIX_PATH=<path_to_executorch>/cmake-out \
186184
-DMODEL_PATH=<path_to_program_file_generated_in_previous_step> \
187-
-DNXP_SDK_ROOT_DIR=<path_to_nxp_sdk_root> -DEXECUTORCH_BUILD_FLATC=0 \
188-
-DFLATC_EXECUTABLE="$(which flatc)" \
185+
-DNXP_SDK_ROOT_DIR=<path_to_nxp_sdk_root> \
189186
-DNN_LIB_BASE_DIR=<path_to_nnlib_cloned_in_step_2> \
190187
-Bcmake-out/examples/cadence \
191188
examples/cadence

examples/apple/coreml/scripts/build_executor_runner.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ 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 \
4039
-DEXECUTORCH_BUILD_COREML=ON \
4140
-Dprotobuf_BUILD_TESTS=OFF \
4241
-Dprotobuf_BUILD_EXAMPLES=OFF \
4342
-DCOREML_BUILD_EXECUTOR_RUNNER=ON \
44-
-DCMAKE_MACOSX_BUNDLE=OFF \
43+
-DCMAKE_MACOSX_BUNDLE=OFF
4544

4645
cmake --build "$CMAKE_BUILD_DIR_PATH" -j9 -t coremldelegate
4746
cmake --build "$CMAKE_BUILD_DIR_PATH" -j9 -t etdump -t flatccrt

0 commit comments

Comments
 (0)