x/mobile: enable building frameworks for Catalyst #36856
As of macOS 10.15, users can build iPad apps to run on macOS using Catalyst. However if you build a framework using gomobile, even though the framework has support for
To fix this, all you need to do is target clang for the macOS sdk & add a cflag with
Gomobile should support specifying a target
case "catalyst": clang, cflags, err = envClang('macosx') cflags += " -target x86_64-apple-ios13.0-macabi"
The text was updated successfully, but these errors were encountered:
See: golang/go#36856 As of macOS 10.15 target catalyst can be used to build an iPad app to run on macOS. Existing .Framework built with gomobile produces the following error when targetting catalyst: ``` error: Building for Mac Catalyst, but the linked framework 'Sample.framework' was built for iOS + iOS Simulator. You may need to restrict the platforms for which this framework should be linked in the target editor, or replace it with an XCFramework that supports both platforms. (in target 'MySampleApp' from project 'MySampleApp') ``` This commit adds a case for catalyst (although architecture is just amd64) when configuring the environment for each architecture, providing the flags needed to enable the built .Framework to be used with catalyst.
I looked at this quickly last night, and had a bit of trouble coming up with a solution as elegant as I had hoped. The environment is configured in
Rather, when setting up the environment in
Feedback is appreciated, after which I'll mark ready for review.