swift-embedded-examples icon indicating copy to clipboard operation
swift-embedded-examples copied to clipboard

Add example that builds with Xcode

Open rauhul opened this issue 1 year ago • 6 comments

We should have an example project that builds with xcodeproj for users in that ecosystem.

rauhul avatar Aug 06 '24 16:08 rauhul

This would make my workflow much easier if I knew how to do this.

mredig avatar Aug 28 '24 05:08 mredig

What needs to be done to allow building in Xcode?

Are there a rough series of steps or configurations?

PaulSolt avatar Sep 05 '24 16:09 PaulSolt

Oh that's a good question - unless Paul wants to do this, I expect I'd be able to set it up given a little guidance.

mredig avatar Sep 05 '24 21:09 mredig

So I think we should probably choose a simple project in this repo that could host examples for multiple build systems. I would like that example to consist of at least 1 module and an end binary using that module.

Actually building the example in Xcode should be pretty straightforward. We just need to setup an xcconfig file with some EXTRA_SWIFT_FLAGS and enable WMO as well as create an xcproj with 2 targets (library and executable)

rauhul avatar Sep 07 '24 20:09 rauhul

I've honestly never done anything outside the box like this with Xcode before. The most advanced skill I've gotten to myself is setting up some build configurations in the Xcode build settings.

I've seen xcconfig files and others in other projects, but never really dug into why I'd use them over the built in build settings, so I only have a small bit of familiarity with this...

However the biggest blocker I have is how to manage the build environment for Espressif idf "stuff" (I don't know what to call it). I installed a supporting pip package in a venv (which I can't remember which one it was, just that it's a dep of idf.py) and, once I'm in that env, I need to activate the idf env with export.sh. I don't know how to go about leveraging these sub environments in Xcode (and I also wouldn't want to install into the global namespace on my computer, nor require it on others via an example)

mredig avatar Sep 08 '24 21:09 mredig

I took a crack at this with SPM and plugins, it’s a bit clunky.

ericlewis avatar Mar 31 '25 01:03 ericlewis