fix(windows): plugin builds against current Flutter Windows registrant#85
Merged
Merged
Conversation
- target_include_directories scope INTERFACE -> PUBLIC - INTERFACE only exposes the dir to consumers, so the plugin target itself cannot resolve "ratex_flutter/ratex_flutter_plugin.h" and the Windows build fails with error C1083 - PUBLIC is a strict superset, so consumers see no behavioural change
- Adds ratex_flutter_plugin_c_api.{h,cpp} exporting RatexFlutterPluginCApiRegisterWithRegistrar, the name pattern Flutter auto-generated generated_plugin_registrant.cc has called since ~Flutter 2.10
- Without it the registrant fails to compile (missing header) and again at link time (missing symbol)
- New entry delegates to the existing RatexFlutterPluginRegisterWithRegistrar so both name variants resolve to the same body — no runtime behaviour change
- Hooks the new .cpp into PLUGIN_SOURCES
Owner
|
thanks! |
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
Two patches that together make
ratex_flutter's Windows plugin build out-of-the-box against current Flutter (verified against Flutter 3.41.9 stable / Dart 3.11.5 on Windows 10).Bug 1 — plugin's own .cpp can't find its own header
windows/CMakeLists.txtdeclarestarget_include_directories(... INTERFACE ...). INTERFACE exposes the dir only to consumers — the plugin's ownratex_flutter_plugin.cppcannot resolve#include "ratex_flutter/ratex_flutter_plugin.h". Fix: widen scope to PUBLIC (strict CMake superset; consumers see no behavioural change).Bug 2 — missing C API registrant
Flutter's auto-generated
generated_plugin_registrant.cc(since Flutter ~2.10) includes<ratex_flutter/ratex_flutter_plugin_c_api.h>and callsRatexFlutterPluginCApiRegisterWithRegistrar(...). The plugin only shipped the legacyRatexFlutterPluginRegisterWithRegistrar. Fix: add the C API header + a one-line shim that delegates to the legacy entry, so both name variants resolve to the same body.Reproduction
Before this PR fails with:
After commit 1 alone, build progresses further then fails at:
After commit 2 the build succeeds.
Backwards compatibility
RatexFlutterPluginRegisterWithRegistrarentry remains inratex_flutter_plugin.cppunchanged. Any consumer still using the legacy name (older Flutter, manual registrant) sees no change — the new entry just calls into it.Test plan
flutter build windows --debugsucceeds on a freshflutter createconsumer (Flutter 3.41.9 stable / Win10)flutter build apk --debugstill succeeds (Android path untouched)flutter build linux --debugnot regressed (Linux CMakeLists untouched)Versioning / CHANGELOG
Left to the maintainer's release process. No version bump or CHANGELOG entry in this PR.