compnerd/swift-cmake-examples

Support for use with XCode?

atyshka opened this issue · 1 comments

Hi Saleem, maybe not the most relevant place to post but better then filing a CMake issue: have you successfully gotten CMake swift support working so that a Swift library can be compiled with CMake and imported into XCode? Presumably the problem is twofold, both getting CMake to properly compile for the architecture and getting XCode to import the library. Regarding the first, I'm aware of several ios CMake toolchains with guides for C but not swift, hopefully differences would be minor or just work out of the box. I'm unsure how one would go about the latter. No need to implement an example here, I'm undertaking this myself and may submit a PR with example if I get this working, just thought I'd see if you had any resources/tips to point me in the right direction.

I think that the existing examples should give you a pretty starting point. I think that the one big difference you will find is that CMAKE_OSX_ARCHITECTURES may not (at least I do not expect it to) work.

As to the latter, it might be easier to brush up on someone else's work and use the Xcode generator instead of ninja (replace -G Ninja with -G Xcode). That should allow you to generate an Xcode project that can be added to a workspace.

If you get a nice working example, please feel free to send a PR, that sounds like it would be pretty cool.