Skip to content

feat(cpp): add C++ packaging for protobuf, ANTLR and extensions - #33

Merged
andrew-coleman merged 3 commits into
mainfrom
add-cpp-packaging
Jun 29, 2026
Merged

feat(cpp): add C++ packaging for protobuf, ANTLR and extensions#33
andrew-coleman merged 3 commits into
mainfrom
add-cpp-packaging

Conversation

@nielspardon

Copy link
Copy Markdown
Member

Adds C++ support to the packaging machinery, alongside Python, Rust and Go. Based on main independently 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 CMake FetchContent (tag-as-package model, like Go — no registry, no credentials; pushing cpp/<pkg>/vx.y.z publishes it):

  • substrait-protobuf — vendors the .proto files and generates C++ at build time with the consumer's own protoc via protobuf_generate. Generated .pb.cc is deliberately not committed: C++ protobuf code is ABI-coupled to a protobuf runtime, so committing it would pin every consumer to one protobuf version. Exposes substrait::proto + a find_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 via FetchContent (pinned to the generator version), so no system/conda ANTLR runtime is required on any platform. Exposes substrait::antlr.
  • substrait-extensionsdata-only: C++ has no canonical YAML/JSON schema code generation (no typify / datamodel-code-generator equivalent), so it vendors+installs the raw spec data and exposes SubstraitExtensions_DATA_DIR; typed parsing lives downstream.

Generated/vendored content lives only on tags; main keeps scaffolding (CMakeLists, generate scripts, READMEs, cmake config templates, smoke tests, .gitkeep placeholders).

Tooling & CI

  • pixi.toml: cpp-generate-{protobuf,antlr,extensions} tasks + cmake/cxx-compiler/protobuf deps.
  • scripts/cpp/next_alpha_version.sh (alpha-by-default, mirrors Go); reuses tag_exists.sh and attach_subtree.sh.
  • Workflows: cpp_publish.ymlcpp_{protobuf,antlr,extensions}.yml (generate → cmake build → ctest → commit → tag-push), ci_cpp.yml (validates on cpp/** PRs), and a publish-cpp-artifacts job in publish_artifacts.yml.
  • README updated with the C++ workflow hierarchy and a "C++ Code Generation" section.

Consumer adoption

Intended to let substrait-cpp and the DuckDB Substrait extension eventually drop their third_party/substrait submodule + bespoke protoc machinery for a pinned FetchContent dependency. 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 protobuf cmake --install produces the full find_package surface. ci_cpp.yml runs the same generate+build+test against the latest spec release on every cpp/** PR.

🤖 Generated with AI

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
andrew-coleman merged commit 2f16401 into main Jun 29, 2026
3 checks passed
@andrew-coleman
andrew-coleman deleted the add-cpp-packaging branch June 29, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants