Skip to content

fix(cmake): export external flatcc runtime dependencies - #963

Open
bmehta001 wants to merge 1 commit into
apache:mainfrom
bmehta001:fix-external-flatcc-export
Open

bmehta001 wants to merge 1 commit into
apache:mainfrom
bmehta001:fix-external-flatcc-export

Conversation

@bmehta001

@bmehta001 bmehta001 commented Oct 15, 2026 •

Copy link
Copy Markdown

Problem

With NANOARROW_IPC=ON and an external flatcc runtime, the exported static IPC target contains $<LINK_ONLY:flatccrt>, but the package does not define that target for its consumers. Standalone consumers therefore depend on incidental caller-defined targets or linker search paths. This affects build-tree exports as well as installed packages.

The vcpkg port currently compensates on Windows by replacing this dependency with a Release-only library path; Unix consumers are left with the bare library name. A source-level fix lets package maintainers remove that workaround when updating nanoarrow.

Related to #922. This addresses exported dependency metadata, separately from #949's build-time static/shared runtime discovery.

Changes

  • Give external runtime targets the actual name nanoarrow::flatccrt, rather than an alias of an unqualified imported target. CMake resolves imported aliases back to the underlying name when exporting them.
  • Preserve the existing vendored runtime export by adding its corresponding build-tree alias, and consistently use the namespaced target in IPC libraries and tests.
  • Resolve external Release/Debug runtime libraries during package discovery, using the package prefix, configured external locations, and consumer prefix paths. Report a normal package-not-found result when the runtime is unavailable.
  • Add a dependency-free regression driver and Windows/Linux/macOS CI coverage. It builds a real flatcc runtime from the existing vendored sources, then compiles and runs actual package consumers.
  • Document installed-package consumption and explicit runtime overrides.

Validation

Windows (Visual Studio 2026 / MSVC 19.51) and Linux (WSL / GCC 13.3):

  • 24 IPC consumer executions passed per platform: external root, separate include/library directories, and vendored runtime; Debug and Release; build-tree and relocated installed packages; caller-defined flatccrt declared both before and after package discovery.
  • All three Debug build modes also passed with nanoarrow's default extra warnings enabled.
  • Additional Debug/Release consumers passed with flatcc in a separate relocated prefix. Assertions checked the selected configuration-specific runtime path.
  • Missing-runtime package discovery returned the expected failure, including with find_package(... QUIET).
  • Core-only Debug/Release consumers passed without creating or requiring a flatcc target.
  • The same regression driver on unmodified upstream failed with flatccrt-NOTFOUND, demonstrating that the test detects the original export defect.

Regression entry point, from the repository root:

python ci/scripts/test_cmake_package.py --build-dir build/package-tests

On Windows the local run explicitly selected CMAKE_GENERATOR=Visual Studio 18 2026.

CMake formatting (0.6.13), Black (22.3.0), Flake8 (7.1.1), isort (5.12.0), codespell, workflow YAML parsing, and git diff --check passed. No runtime tests in these selections were skipped or excluded. Native macOS was not available locally; the added CI job covers it.

AI assistance: GitHub Copilot assisted with implementation and regression coverage.

Keep the external runtime namespaced so exported IPC targets do not depend
on a caller-defined flatccrt target or link-directory settings. Resolve
configuration-specific runtime libraries when finding the package, including
after relocating a combined install prefix.

Exercise real build-tree and installed-package consumers on Windows, Linux,
and macOS CI without downloading test dependencies. Preserve vendored flatcc
exports and document installed-package consumption.

Files changed:
- CMakeLists.txt
- cmake/config.cmake.in
- ci/scripts/test_cmake_package.py
- .github/workflows/build-and-test-ipc.yaml
- examples/cmake-ipc/README.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f6f6eb9-6891-4b8c-8e40-e252aec061d4
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.24%. Comparing base (ea215b0) to head (b84a944).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #963   +/-   ##
=======================================
  Coverage   78.24%   78.24%           
=======================================
  Files         106      106           
  Lines       16867    16867           
  Branches     1993     1993           
=======================================
  Hits        13198    13198           
  Misses       2437     2437           
  Partials     1232     1232           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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