Planned home for CPP libraries to help build/consume Substrait query plans.
We provide scripts to help developers setup and install substrait-cpp dependencies.
git clone --recursive https://github.com/substrait-io/substrait-cpp.git
cd substrait-cpp
# if you are updating an existing checkout
git submodule sync --recursive
git submodule update --init --recursive
Once you have checked out substrait-cpp, install the build tools and build.
Run the setup script from the repository root. It installs system packages, so
it needs sudo (you will be prompted for your password unless you are root).
| Distribution | Setup script | Package manager |
|---|---|---|
| Ubuntu (24.04 or later) | ./scripts/setup-ubuntu.sh |
apt |
| Fedora | ./scripts/setup-fedora.sh |
dnf |
Note: Building substrait-cpp requires CMake 3.24 or newer. Ubuntu 24.04 supplies CMake 3.28; if using older Ubuntu releases (e.g. 22.04), install CMake >= 3.24 (e.g. via the Kitware APT repository or
pip).
What the scripts install: a C++ compiler, CMake, Ninja, ccache, git, tzdata,
libuuid and libcurl development headers, a Java runtime (needed at build time by
ANTLR), clang-format/clang-tidy and cmake-format. The Fedora script also
installs GoogleTest from the distribution.
make format uses clang-format-15 to match CI. Fedora does not package that
version under this name, so install it yourself and point the script at it,
e.g. CLANG_FORMAT=/path/to/clang-format make format.
Ubuntu:
$ ./scripts/setup-ubuntu.sh
$ makeFedora:
$ ./scripts/setup-fedora.sh
$ makemake builds the debug configuration. make release and make asan build
the other configurations. Builds use CMake presets
(debug, release, asan, and ci, which also uses ccache):
$ cmake --preset debug
$ cmake --build --preset debug
$ ctest --preset debugThe first build takes several minutes because Protobuf and Abseil are
downloaded and compiled. If the system Protobuf is older than
SUBSTRAIT_CPP_PROTOBUF_MIN_VERSION (5.28), a suitable version is fetched
automatically. The Fedora script does not install Protobuf; the Ubuntu script
only installs a protoc binary into ~/.local.
Other dnf-based distributions can usually use the Fedora script. Without root
access, run the script inside a container (for example fedora:latest or
ubuntu:24.04) with the repository copied in.
Install it, then find it with find_package:
$ cmake --install build-debug --prefix /path/to/prefixfind_package(Substrait 0.1 CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE Substrait::substrait_io)Configure your project with -DCMAKE_PREFIX_PATH=/path/to/prefix. The install
includes Protobuf, Abseil, fmt, yaml-cpp, date and the ANTLR4 runtime, which the
package config locates for you. The library directory is lib64 on Fedora and
lib on Ubuntu.
The ANTLR parser jar is downloaded at configure time and verified against a pinned SHA-256 hash, so a changed or corrupted download fails the configure step.
Basically the coding style is based on Google C++ Style, but there are some naming style changed:
- Function case style change to 'camelBack'
- Variable case style change to 'camelBack'
- Class Member case style change to 'camelBack' with '_' as suffix
For more detail information please refer to .clang-tidy.
You can run make format script to formatting source code. To enable clang-tidy checks during compilation, use the options from cmake/clang-tidy.cmake. To apply the suggested fixes, run the following command in the root directory:
clang-apply-replacements-22 --ignore-insert-conflict build/clang-tidy-fixes/substrait-cpp is licensed under the Apache 2.0 License. A copy of the license can be found here.