pw_flatbuffers#
Experimental
The flatbuffers module supports the use of cmake to build C++ headers from a set of flatbuffers schema files. The user of these build files may either use the provided flatbuffers distribution or provide their own.
Flatbuffers compilation#
pw_flatbuffers currently only supports cmake
as the build system.
CMake#
CMake provides a pw_flatbuffer_library
function to build flatbuffer schema
files into C++ headers. The user of this function is expected to configure the
flatbuffers compiler as well as provide any needed dependencies such as
flatbuffers headers. Support for outputting other languages supported by
flatc
is currently not implemented.
Arguments
NAME
: Name of dependency to create. The dependency target name will beNAME.cpp
SOURCES
: Source schema files to compile to headersDEPS
: Dependencies needed to compile the passed in schema filesFLATC_FLAGS
: flags to be passed toflatc
when building
Globals
Additionally, several global cache variables influence the behavior of
pw_flatbuffer_library
.
pw_flatbuffers_FLATC
: Path to the flatbuffers compiler executable. This defaults to simply usingflatc
and relying on the shellPATH
to locate the compiler.pw_flatbuffers_FLATC_FLAGS
: Global flags to pass to all invocations of theflatc
compiler. Defaults to empty.pw_flatbuffers_LIBRARY
: Flatbuffer header library dependency to automatically add to all flatbuffers libraries built. Defaults to unset unless using the pigweed provided flatbuffers by settingdir_pw_third_party_flatbuffers
, in which case this will default to the pigweed provided third party flatbuffers. If left unset, the user takes responsibility for properly providing the flatbuffer dependencies to code.
Example*
GN#
GN is not currently supported.
Bazel#
Bazel is not currently supported.