You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build flatc for the host instead of the target platform (#9077)
### Summary
* Fixes#7260
* We use flatc as part of the build step to generate some files from
FlatBuffer definitions. This implies the tool runs on the host. However,
we currently build flatc as part of the main build — which propagates
the target CXX flags to flatc. Thus, flatc gets built targeting the
target platform. To ensure flatc is built for the host, we can use
include flatc as an
[ExternalProject](https://cmake.org/cmake/help/latest/module/ExternalProject.html).
This does not propagate the CXX flags
* Some targets implicitly depended on flatc, we now make that
requirement explicit
* We currently spread the `FLATC_EXECUTABLE` defaulting across the
project. Let's just centralize this at the root
### Test plan
```bash
$ ./install_executorch.sh
# Previously flatc was built against the Android target, now they target the host
$ ./build/build_android_library.sh
$ file /Users/jathu/executorch/cmake-out-android-arm64-v8a/third-party/flatbuffers/flatc
/Users/jathu/executorch/cmake-out-android-arm64-v8a/third-party/flatbuffers/flatc: Mach-O 64-bit executable arm64
# Apple builds work as usual, but they use flatc from pip
$ ./build/build_apple_frameworks.sh
```
cc @larryliu0820@lucylq@swolchok@dbort
0 commit comments