feat(cpp): add C++ packaging for protobuf, ANTLR and extensions - #33
Merged
Conversation
Add a cpp/ language with three CMake source packages distributed as
git tags consumed via FetchContent (no registry):
- substrait-protobuf: vendors the .proto files and generates C++ at
build time with the consumer's own protoc (C++ protobuf code is
ABI-coupled to a runtime, so generated sources are not committed)
- substrait-antlr: commits stock ANTLR C++-target parsers and builds
the ANTLR C++ runtime hermetically via FetchContent
- substrait-extensions: data-only (C++ has no schema codegen like
Rust typify / Python datamodel-code-generator)
Includes pixi tasks + deps, scripts/cpp/next_alpha_version.sh, the
cpp_publish/cpp_{protobuf,antlr,extensions} publish workflows, ci_cpp.yml,
publish_artifacts.yml wiring and README docs.
andrew-coleman
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds C++ support to the packaging machinery, alongside Python, Rust and Go. Based on
mainindependently of the Go PR (#32) so it can be reviewed/merged on its own.What this adds
Three CMake source packages under
cpp/, distributed as git tags consumed via CMakeFetchContent(tag-as-package model, like Go — no registry, no credentials; pushingcpp/<pkg>/vx.y.zpublishes it):substrait-protobuf— vendors the.protofiles and generates C++ at build time with the consumer's ownprotocviaprotobuf_generate. Generated.pb.ccis deliberately not committed: C++ protobuf code is ABI-coupled to a protobuf runtime, so committing it would pin every consumer to one protobuf version. Exposessubstrait::proto+ afind_package(SubstraitProtobuf)config. This matches how substrait-cpp consumes the protos today.substrait-antlr— commits parsers from the stock ANTLR C++ target (no fork, unlike Rust) and builds the ANTLR C++ runtime hermetically viaFetchContent(pinned to the generator version), so no system/conda ANTLR runtime is required on any platform. Exposessubstrait::antlr.substrait-extensions— data-only: C++ has no canonical YAML/JSON schema code generation (notypify/datamodel-code-generatorequivalent), so it vendors+installs the raw spec data and exposesSubstraitExtensions_DATA_DIR; typed parsing lives downstream.Generated/vendored content lives only on tags;
mainkeeps scaffolding (CMakeLists, generate scripts, READMEs, cmake config templates, smoke tests,.gitkeepplaceholders).Tooling & CI
pixi.toml:cpp-generate-{protobuf,antlr,extensions}tasks +cmake/cxx-compiler/protobufdeps.scripts/cpp/next_alpha_version.sh(alpha-by-default, mirrors Go); reusestag_exists.shandattach_subtree.sh.cpp_publish.yml→cpp_{protobuf,antlr,extensions}.yml(generate → cmake build → ctest → commit → tag-push),ci_cpp.yml(validates oncpp/**PRs), and apublish-cpp-artifactsjob inpublish_artifacts.yml.Consumer adoption
Intended to let substrait-cpp and the DuckDB Substrait extension eventually drop their
third_party/substraitsubmodule + bespokeprotocmachinery for a pinnedFetchContentdependency. Adoption is a follow-up conversation with the substrait-cpp maintainers; this PR just produces the packages.Verification
Each package builds + passes a ctest smoke test (compile a generated proto header / lex+parse a type / resolve an extension data file). Verified locally end-to-end (
pixi run cpp-generate-* → cmake build → ctest) and a protobufcmake --installproduces the fullfind_packagesurface.ci_cpp.ymlruns the same generate+build+test against the latest spec release on everycpp/**PR.🤖 Generated with AI