Skip to content

feat: C/C++ API shared library targets - #9878

Merged
0ax1 merged 14 commits into
developfrom
ad/cxx-shared-lib
Sep 15, 2026
Merged

0ax1 merged 14 commits into
developfrom
ad/cxx-shared-lib

Conversation

@0ax1

@0ax1 0ax1 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Allow users to build and link against shared library targets for the C/C++ API:

target_link_libraries(cpp_target PRIVATE Vortex::cpp_shared)
target_link_libraries(c_target PRIVATE Vortex::ffi_shared)

To enable shared libs, enable: BUILD_SHARED_LIBS=ON.

As part of this, we switch to using shared libs on CI to cut down link time from static libs.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Let BUILD_SHARED_LIBS select default builds and test/example linkage without controlling target availability.

Generate the Linux export policy in the build tree, document linker settings, reject unsupported export platforms, and honor CMake output directories.

Assert exact fixture results and cover explicit shared linkage with BUILD_SHARED_LIBS off. Remove the redundant CI debug-info flag while retaining full symbols through the default level of 2 for sanitizer diagnostics.


Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1 0ax1 added the changelog/feature A new feature label Sep 15, 2026
@codspeed

codspeed Bot commented Sep 15, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ 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.

⚡ 4 improved benchmarks
❌ 1 regressed benchmark
✅ 2193 untouched benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime words_gather_scalar_avx2[65536] 8.3 µs 9.4 µs -11.73%
WallTime arrow_checked_add_u32_avx512[16384] 21.4 µs 17.6 µs +21.51%
WallTime arrow_checked_add_u32_avx2[16384] 21.4 µs 17.6 µs +21.15%
WallTime filtered_owned_i64_avx512[OneNullInEight] 26.3 µs 22.7 µs +15.71%
WallTime mul_i32_nonnull_avx512 7.9 µs 7.1 µs +11.18%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ad/cxx-shared-lib (cd1c57b) with develop (fefcab0)2

Open in CodSpeed

Footnotes

  1. 218 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.

  2. No successful run was found on develop (a65c653) during the generation of this report, so fefcab0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

0ax1 added 10 commits September 15, 2026 09:47
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Defer disabling linker depfiles until the FFI directory finishes configuring, preserving child settings and explicit archive and export-script dependencies. This avoids GNU ld's unescaped paths forcing relinks in build directories containing spaces.

Format the shared-build freshness assertion for Ruff.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Rename vortex_cxx to vortex_cxx_static and update coverage and test references. Keep the public alias and archive filename unchanged, and document the PIC and visibility settings.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Cached GCC objects embed the original gcda output path, so sccache hits after the static target rename leave the coverage directory empty. Clear inherited and cached C++ compiler launchers in the coverage script while preserving caching for other builds.

Add isolated CMake regression tests for environment and cache launcher settings, exercising real compilation, CTest, and coverage data generation.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Enable shared linkage for the C API test build and both FFI sanitizer jobs, matching the existing C++ API job. This avoids linking the Rust archive separately into each test and example executable.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Build shared libraries in the coverage script and collect data from vortex_cxx_shared.dir. Update the regression fixture to honor BUILD_SHARED_LIBS and require coverage in the shared target directory.

Clarify how the empty environment assignment and CMake cache option disable compiler launchers for coverage builds.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Remove the coverage and shared-FFI integration tests and their supporting fixture changes. Preserve compatibility updates to existing tests and shorten the coverage launcher comment.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Keep the CMake cache option that disables caching for coverage targets and remove the environment override used only for compiler probes. Explain the stale gcda path issue next to the flag.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Namespace sccache entries by the CMake target's build directory and name so renamed targets cannot reuse GCC objects with stale gcda paths. Preserve the inherited launcher and any existing custom cache key while retaining warm-cache hits.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1
0ax1 requested a review from myrrc September 15, 2026 10:03
@0ax1
0ax1 marked this pull request as ready for review September 15, 2026 10:03
Pass --coverage through CMAKE_SHARED_LINKER_FLAGS so the C-linked FFI shared library resolves its gcov runtime internally. Document the runtime-linking and target-specific compiler cache settings.

Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1
0ax1 enabled auto-merge (squash) September 15, 2026 11:01
@0ax1
0ax1 requested a review from robert3005 September 15, 2026 11:09
@0ax1
0ax1 merged commit d0a42e6 into develop Sep 15, 2026
84 of 85 checks passed
@0ax1
0ax1 deleted the ad/cxx-shared-lib branch September 15, 2026 11:29
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.

2 participants