Repository navigation
build(cmake): isolate bundled yyjson visibility, support external yyjson, and add reflectcpp::headers target - #258
Open
clockblocker wants to merge 1 commit into
Conversation
…son, and add reflectcpp::headers target Improve library packaging and embedding hygiene for static/shared consumers and header-only / OBJECT-library builds: - **Bundled yyjson hidden visibility & external yyjson target (#140 Part 2):** Default-hide bundled `yyjson` symbols on static non-Windows builds (`yyjson_api=__attribute__((visibility("hidden")))` + `-fvisibility=hidden` on `src/yyjson.c`) so consumer DSOs never export `yyjson_*` symbols even with `REFLECTCPP_HIDDEN_VISIBILITY=OFF`, while keeping shared and Windows static builds untouched. Add `REFLECTCPP_USE_BUNDLED_YYJSON` and `REFLECTCPP_YYJSON_TARGET` (preserving parent normal variables under CMP0126 OLD and failing fast on misconfiguration or missing targets, including alias targets), gate `include/rfl/thirdparty` on both `REFLECTCPP_USE_BUNDLED_YYJSON` and `_REFLECTCPP_NEEDS_JSON_IMPL` so JSON-disabled builds never receive thirdparty includes, enable `POSITION_INDEPENDENT_CODE ON` by default for static subprojects when unset, and add opt-in `REFLECTCPP_HIDDEN_VISIBILITY`. - **Header-only `reflectcpp::headers` interface target (#141):** Add and export `INTERFACE` target `reflectcpp_headers` (`reflectcpp::headers`) mirroring `reflectcpp`'s C++ standard compile features, public compile definitions, SYSTEM/non-SYSTEM include directories, and conditional bundled/external dependency headers (without CMake 3.20-3.25 directory-scope `TARGET_PROPERTY` failures) without linking compiled objects, and document usage in `docs/content/install.md`. Depends on CMake PR 1 (subproject ergonomics & CMake 3.20 support). Addresses #140 and #141.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Linking static
reflect-cppinto a shared library or plugin re-exports bundledyyjson_*C symbols and causes duplicate-symbol errors when consumers bring their ownyyjson.Header-only and
OBJECT-library targets also have no way to pullreflect-cppheaders without linking its compiled objects.Summary
yyjsonsymbols by default on static non-Windows builds (verified 0 leakedyyjson_*symbols in consumer DSOs vianm -D), defaults static subproject PIC, and adds opt-inREFLECTCPP_HIDDEN_VISIBILITY.REFLECTCPP_USE_BUNDLED_YYJSONandREFLECTCPP_YYJSON_TARGETwith fail-fast validation (preserving parent normal variables under CMake 3.20) and omitsinclude/rfl/thirdpartywhen JSON is disabled.reflectcpp::headers(INTERFACEtarget mirroring compile features, definitions, and headers without compiled objects).OSS consumers
NVIDIA/cuda-quantumNVIDIA/cuda-quantumreflect-cppinto plugin shared libraries that must export zeroyyjson_*symbols.hudson-trading/slang-serverhudson-trading/slang-serverreflectcpp::headers) from compiled JSON linking.For Agents
upstream-queue(a7ae2e65) · Score69+/100(post-polish) ·+135/-19(2f)