cmake: link magic_enum into add_native_contract targets#65
Open
heifner wants to merge 1 commit into
Open
Conversation
Native contract builds compile OPP system contracts whose generated protobuf headers (types.pb.hpp) include magic_enum. add_native_contract set up the CDT include paths but never provided magic_enum, so the host compiler could not find <magic_enum/magic_enum.hpp>. Call find_cdt_magic_enum() and link magic_enum::magic_enum -- the same imported target name in the CDT and consumer vcpkg trees -- so native contract targets resolve the header.
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.
Summary
add_native_contract()compiles contract sources with the host compiler into a dlopen-able.sofor the native-module runtime. It sets up the CDT include paths but never providedmagic_enum.Wire's OPP system contracts include generated protobuf headers (
types.pb.hpp) that depend onmagic_enum, so native builds of those contracts fail to find<magic_enum/magic_enum.hpp>.This calls
find_cdt_magic_enum()and linksmagic_enum::magic_enuminto native contract targets. The imported target name is identical in the CDT and consumer (wire-sysio) vcpkg trees, so the host compiler resolves the header either way.Context
This is the CDT-side half of the fix for the Wire-Network/wire-sysio#281 review feedback. The wire-sysio side reverts a per-contract
-Iworkaround that had been masking this gap; the proper fix belongs here in the native-contract template.