Conversation
Summary of ChangesHello @ta7mid, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the CMake build system for reflect-cpp to enhance compatibility with updated versions of external dependencies, specifically libbson (2.0.0+) and Apache Arrow (21.0.0+). It addresses breaking changes in how these libraries expose their CMake packages and targets, ensuring reflect-cpp can correctly find and link against them. The changes also streamline the selection between static and shared library linkage based on the project's build type, improving overall build robustness. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses several issues with dependency handling in CMake for libbson and Apache Arrow. The changes correctly adapt to new package and target names in recent versions of these libraries and simplify the logic for linking static or shared variants. My main concern is with the version range specified for libbson, which is too restrictive and would prevent using versions newer than 2.0.0. I've left specific suggestions to address this in the code.
|
@ta7mid thanks for the PR. However, it appears that this has broken the Conan build. Could you take another look? |
|
@liuzicheng1987 Can you check if it works now? |
|
@ta7mid , there still appear to be the same issue with Conan... |
|
It's probably fixed now. |
8cc9516 to
4a7d7ad
Compare
|
@liuzicheng1987 Please do another run of the workflow. |
955c934 to
c24da88
Compare
|
@liuzicheng1987 I think it's fixed now. Check? |
|
I haven't been able to reproduce that error locally. And it's probably not fixed yet, but this time around I've added some log statements to list all imported targets so I can find the correct Parquet target from the build logs :) And I hope a follow-up commit will have the fix. Run the check again please? |
|
@ta7mid , I am closing this PR due to inactivity and since some of the tests do not pass. If you want to continue your work here, feel free to repoen. |
|
Hey, I've just pushed a potential fix :) |
|
@liuzicheng1987 Can this be reopened? |
|
Sure. |
|
@ta7mid I just reopened the PR. Thanks for continuing to work on this |
|
Thanks. Can you run the workflows too? |
|
@liuzicheng1987 Can you please run the workflows? |
- Accept both the libbson 2.x (`bson` package, `bson::static`/`bson::shared`)
and libbson 1.x (`bson-1.0`, `mongo::bson_*`) names, in CMakeLists.txt as
well as in the installed reflectcpp-config.cmake.
- Link Arrow and Parquet via `Arrow::arrow_{static,shared}` and
`Parquet::parquet_{static,shared}` outside vcpkg too: `arrow::arrow` is not
provided by Arrow's own CMake packages (e.g. Homebrew, distros). Only look
for the Parquet package if the Arrow package didn't provide it (Conan).
- Resolve dependency targets at configure time instead of with generator
expressions, which end up verbatim in the exported reflectcpp-exports.cmake.
reflectcpp_link_one_of() picks the variant of the same library type as
reflectcpp (static/shared) and falls back to any that exists, e.g.
`flatbuffers::flatbuffers_shared` for shared Conan builds and
`msgpack-c-static` for static builds against msgpack-c installs that ship
both.
- Link libbson PUBLIC again: rfl/bson/*.hpp include <bson/bson.h>, and libbson
2.x installs its headers under include/bson-<version>/.
- conanfile.py: make `with_csv` enable Arrow's CSV support.
This PR addresses the following issues encountered/noted when creating a Homebrew formula for reflect-cpp:
bson-1.0→bson) and imported targets (mongo::bson_*→bson::*).CMakeLists.txtwas switched to the new names in Fix the Github Actions runners #695, but the installedreflectcpp-config.cmakestill looks forbson-1.0. Both files now accept either naming, so libbson 1.x keeps working too.REFLECTCPP_USE_VCPKGis false, reflect-cpp links witharrow::arrow, but no such target is provided by the CMake config packages installed with Apache Arrow ≥21.0.0, regardless of whether vcpkg is used. Arrow/Parquet are now linked viaArrow::arrow_{static,shared}andParquet::parquet_{static,shared}, which upstream Arrow, vcpkg and Conan's recipe all provide.target_link_libraries(reflectcpp PUBLIC $<IF:$<TARGET_EXISTS:…>…,…>)) are not evaluated and get copied verbatim into the exportedreflectcpp-exports.cmake. Targets are now resolved at configure time, so the export lists plain target names.flatbuffers::flatbuffers_sharedexists there) and picksmsgpack-c-staticfor static builds where it exists.Also:
PUBLICagain (it was madePRIVATEin Fix the Github Actions runners #695):rfl/bson/*.hppinclude<bson/bson.h>, and upstream libbson 2.x installs its headers underinclude/bson-<version>/, so consumers of an installed reflect-cpp need the include path. vcpkg patches that layout away, which is why CI doesn't notice. Happy to revert this ifPRIVATEwas intentional.conanfile.py:with_csv=Truenow enables Arrow's CSV module, which the Arrow recipe disables by default.Tested:
shared=True, FlatBuffers + msgpack): builds and exportsflatbuffers::flatbuffers_shared, wheremainfails to configure.find_package(reflectcpp)round-trips JSON/BSON/msgpack/CSV.🤖 Generated with Claude Code