6 ms·
Haven't used Meson, but if you know a nice way to cross compile a project with generated source I'd like to know. More specifically, I'd like the following thi
by rfoo 6y ago
Haven't used Meson, but if you know a nice way to cross compile a project with generated source I'd like to know.
More specifically, I'd like the following things happen:
1. Compile flatc with the host compiler since we have to run it later, the FlatBuffers schema compiler which compiles .fbs schemas to .cpp, just like protoc of protobuf.
2. Run the flatc on all my .fbs schemas.
3. Compile the output of 2 with the cross-compiler for the target.
With Bazel it can automatically detect the fact that it is going to run the flatc on the same box so it would be compiled with the host compiler. With CMake it seems impossible since it does not have a concept of "build host", so my current solution is to add the FlatBuffers repo via ExternalProject_Add twice, once for host configuration with a patch to change its CMake target namespace prefix to "flatbuffers_host" (because apparently this is not possible to override later) to avoid name collision, once for the target configuration, then change every reference of flatc in my project to "flatbuffers_host::flatc".