Adds a cargo wrapper script for closer integration with Xcode projects#658
Adds a cargo wrapper script for closer integration with Xcode projects#658akitchen wants to merge 2 commits intocorrosion-rs:masterfrom
Conversation
Introduce a shell script which will interpret the env variables set dynamically by Xcode and invoke cargo build Adds support for creating multi-architecture binaries if multiple ARCHS specified This solution is awkward because we need to manually add the rust static library to the list of libraries to link in Xcode, since it is not a true native target
What is the use-case for this? Is it simply to manage the default mapping to
Is the list of SDKs that the user wants to support known at configuration time? Corrosion does some configure-time checks, including checking which native libraries a default rust project needs to link to on the given platform, so it would be helpful if we had a list of targets that are potential targets when configuring.
How does this look like? I'm not familiar with how CMake is integrated into XCode (or XCode at all really), so I'm missing quite a bit of context here. |
|
@ogoffart I'd also be interested on your teams opinions on multi-SDK support, since AFAIK you also target mac and iOS, so you are probably much more familiar with XCode than me. See also #649 (comment) for a bit more context. |
In order to reduce the friction of integrating rust crates into existing complex C++ projects on Apple platforms, this PR introduces a script phase in the generated Xcode project which is capable of interpreting the environment variables set by Xcode during the build. This makes it possible to drive cargo rustc more dynamically without needing to regenerate the project, significantly improving development experience on Apple platforms when integrating rust into existing complex multi-SDK projects.
This solution has been in use on a large proprietary project for a while now and is working well for our purposes. Opening this Draft PR for discussion since a few details would likely need to be ironed out before upstreaming into Corrosion.
I wonder what ideas the maintainers or community might have when it comes to improving on this, or if there are any better solutions to this problem. Thank you for an otherwise very useful project!