Skip to content

feat: CMake integration for vortex-ffi & vortex-cpp - #9774

Open
0ax1 wants to merge 24 commits into
developfrom
ad/cmake-rust-integration
Open

feat: CMake integration for vortex-ffi & vortex-cpp#9774
0ax1 wants to merge 24 commits into
developfrom
ad/cmake-rust-integration

Conversation

@0ax1

@0ax1 0ax1 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the C and C++ CMake builds self-contained by having CMake build the Rust FFI archive through Cargo instead of requiring a separate cargo build and manually locating its output.

This adds source-tree CMake targets suitable for vendored downstream projects:

add_subdirectory(path/to/vortex vortex)

target_link_libraries(c_target PRIVATE Vortex::ffi_static)
target_link_libraries(cpp_target PRIVATE Vortex::cpp_static)

0ax1 added 22 commits September 4, 2026 17:01
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Reduce RustToolchain.cmake to one function that finds Cargo and rustc,
reads the rustc host and release, captures RUSTUP_TOOLCHAIN, and forwards
the Apple SDK and deployment target. The rustc host selects the Rust
target directly; SystemDependencies.cmake already rejects unsupported
targets, and Cargo enforces the workspace rust-version.

Replace the concrete-binary pinning by forwarding the configure-time
RUSTUP_TOOLCHAIN to every Cargo build. Default the macOS deployment
target to rustc's 11.0 minimum so the cc crate does not compile for the
SDK version, which ld64 reports as newer than CMake's link target.

Remove the compiler triple validation, platform cross-checks, SDK name
resolution, and version minimums, along with the CMake test harness that
only exercised them.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Reduce RustToolchain.cmake to tool discovery, the rustc host, the
RUSTUP_TOOLCHAIN capture, and the macOS deployment target. Drop the
nightly pre-check, since rustc rejects the nightly-only flags itself,
and stop forwarding CMAKE_OSX_SYSROOT and CMAKE_<LANG>_COMPILER_TARGET,
which only matter for cross builds.

Pass the Rust, C, and C++ flags to CargoBuild.cmake as -D lists instead
of support files, and encode them where the Cargo environment is built.
CMake strips enclosing single quotes from -D values, so the shell-quoted
strings could not cross that boundary intact. Remove the compiler
wrapper for CMAKE_<LANG>_COMPILER_ARG1 and the no-op
--no-default-features.

Default standalone builds to Debug when no build type is given, and map
an empty build type to Cargo's dev profile without a warning.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Call project() unconditionally and use PROJECT_IS_TOP_LEVEL for the
standalone defaults, which removes the embedded language detection and
the helper path variables. Drop the toolchain-file configure dependency,
since configure no longer reads anything it changes, and glob the wrapper
sources like the tests do.

Group the file into commented sections and explain why Catch2 is built
as C++17: its compiled sources gate std::string_view, optional, variant,
and byte support on that standard, and the C++23 tests include its
headers.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Move the Cargo integration modules from lang/cpp/cmake to vortex-ffi/cmake
and make vortex-ffi/CMakeLists.txt own the Cargo build, exporting
Vortex::ffi_static as a global imported target. lang/cpp consumes that
target, adding vortex-ffi itself when nothing else has, and a root
CMakeLists.txt adds both so consumers can link Vortex::ffi_static from C
or Vortex::cpp_static from C++ after one add_subdirectory().

Port the C tests and examples to the static target, prefix example target
names on both sides so a combined build has no clashes, and fix scan.c,
which used pthread_t as a thread count and never compiled on macOS. Drive
the two FFI CI jobs through CMake instead of a manual Cargo step, default
sanitizer builds to rustup's nightly toolchain unless RUSTUP_TOOLCHAIN is
set, and drop the no-op --no-default-features from the Rust sanitizer
tests and docs.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Restore CMAKE_EXPORT_COMPILE_COMMANDS, which the consolidated entry points
had dropped, for configures where a Vortex directory is the top level so
editor tooling keeps working. Embedded builds leave the parent's setting
alone.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Take a comma- or semicolon-separated list of asan, lsan, ubsan, and tsan
instead of two fixed bundles, and map each entry to its native and Rust
names. UBSan has no Rust counterpart, so a native-only selection needs no
nightly toolchain and none is defaulted. CI asks for asan,lsan,ubsan
explicitly to keep the coverage the asan bundle used to imply.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Drop the stray blank line and odd alignment in tests/CMakeLists.txt. Make
gcov-report.sh run from its own directory, rely on the Debug default, use
--coverage so the gcov runtime is linked explicitly, anchor the lcov
exclude globs to full paths, and accept only `html` as the optional
argument as the README documents.

Signed-off-by: "Alexander Droste" <alexander.droste@protonmail.com>

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1 0ax1 changed the title CMake integration for vortex-ffi & vortex-cpp feat: CMake integration for vortex-ffi & vortex-cpp Sep 4, 2026
@0ax1
0ax1 requested review from myrrc and robert3005 September 4, 2026 16:38
@0ax1 0ax1 added feature A feature request changelog/feature A new feature and removed feature A feature request labels Sep 4, 2026
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1

0ax1 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

This lays the foundation to integrate Vortex into other C++ projects such as cuDF.

@codspeed-hq

codspeed-hq Bot commented Sep 4, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 15.38%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
✅ 2196 untouched benchmarks
⏩ 206 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime arrow_checked_add_u32_avx2[16384] 21.4 µs 17.6 µs +21.31%
Simulation allocate_drop_arrow[0] 456.9 ns 402.7 ns +13.45%
Simulation allocate_drop_bytes[0] 520.2 ns 466 ns +11.62%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ad/cmake-rust-integration (4f1a465) with develop (a997c3f)

Open in CodSpeed

Footnotes

  1. 206 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant