Repository navigation
Conversation
A C enum without a fixed underlying type is UInt32 on Darwin/Linux and Int32 on Windows. numericCast lets the generated Swift compile on all three.
C long is 64-bit on Linux/macOS and 32-bit on Windows; numericCast keeps the generated Swift compiling on all three.
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.
The SwiftPM package currently links Cocoa and excludes every platform layer except macOS, so it cannot compile on the other two desktop targets the core supports.
This makes the package host-aware:
core/src/platform/linuxand gets gtk+-3.0, x11 and xi include/link flags fromsystemLibrarytargets using pkg-config (nounsafeFlags, so the package stays usable as a dependency).core/src/platform/windowswithout the optional WinUI 3 layer and links the Win32 libraries the core imports.WindowsManifest.cembeds the Common Controls v6 manifest dependency thatGetWindowSubclassneeds.Two generated-code fixes make the bindings portable:
numericCastbecause an untyped C enum is UInt32 on Darwin/Linux but Int32 on Windows.numericCastbecause Clongis 64-bit on Linux/macOS but 32-bit on Windows.Verified with
swift buildandswift teston macOS. Linux and Windows builds, tests and a GUI smoke run are exercised by the swiftui-port CI that consumes this branch.