|
FlatBuffers
An open source project by FPL.
|
The distribution comes with a cmake file that should allow you to build project/make files for any platform. For details on cmake, see https://www.cmake.org. In brief, depending on your platform, use one of e.g.:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release cmake -G "Visual Studio 10" -DCMAKE_BUILD_TYPE=Release cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release
Then, build as normal for your platform. This should result in a flatc executable, essential for the next steps. Note that to use clang instead of gcc, you may need to set up your environment variables, e.g. CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -G "Unix Makefiles".
Optionally, run the flattests executable from the root flatbuffers/ directory to ensure everything is working correctly on your system. If this fails, please contact us!
Building should also produce two sample executables, flatsamplebinary and flatsampletext, see the corresponding .cpp files in the flatbuffers/samples directory.
Note that you MUST be in the root of the FlatBuffers distribution when you run 'flattests' or flatsampletext, or it will fail to load its files.
By default all Flatbuffers cmake targets are not built with the -Werror (or /WX for MSVC) flag that treats any warning as an error. This allows more flexibility for users of Flatbuffers to use newer compilers and toolsets that may add new warnings that would cause a build failure.
To enable a stricter build that does treat warnings as errors, set the FLATBUFFERS_STRICT_MODE cmake compliation flag to ON.
Our CI builds run with strict mode on, ensuring the code that is committed to the project is as portable and warning free as possible. Thus developers contributing to the project should enable strict mode locally before making a PR.
You can download and install flatbuffers using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install flatbuffers
The flatbuffers port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
You can download the binaries from the GitHub release page.
We generate SLSA3 signatures using the OpenSSF's slsa-framework/slsa-github-generator. To verify the binaries:
attestation.intoto.jsonl from the GitHub releaseflatbuffers library will be compiled and linked to a target as part of your project.To override the depth limit of recursion, add this directive:
to CMakeLists.txt file before add_subdirectory(${FLATBUFFERS_SRC_DIR}) line.