[swift-corelibs-dev] Building Foundation with SwiftPM

Philippe Hausler phausler at apple.com
Mon Jan 30 20:43:35 CST 2017


So there are a few issues that would be a bit tricky to deal with:

SwiftPM uses Foundation so you would have to devise some way to build SwiftPM either without Foundation (which seems sub-optimal or replication of effort/code), directly importing parts of Foundation into the code-base for SwiftPM which might result in a synchronization issue of code, or a last-build result re-build of Foundation used in SwiftPM which seems like a pain when it comes to first time setup.

Foundation’s build environment is a bit tricky since it is not just plain C, we have assembly and some really funky linker tricks that might pose an issue. Also it might be a bit difficult to build CoreFoundation as it’s own target (as it stands now you can technically build CF without swift and use that independently on Linux - which elides the need to publish a separate CFLite).

From previous build infrastructure efforts that I have undertaken; the general consensus is that using SwiftPM would be nice but it doesn’t offer enough of a compelling reason to switch and complicate the rest of the Swift build process (which is already very complex).

Now the other alternative is that Foundation could be built with cmake. That has been something I have explored and it shows some promise. However as for fish to fry, it is a very small one. 

Now I think fixing the dirty file bits from the build script might be a good thing to fix even without changing the build infrastructure. I have tried to fix this problem a few times but it ends up getting really complex really quickly.

If you want to dive into the current build system or perhaps look at cmake let me know if there are things that I can help out to clarify.

P.S. what slack server are you discussing this on? I was un-aware of any slack servers setup for swift.

> On Jan 30, 2017, at 4:49 PM, Robert F Dickerson via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> This has probably been discussed in the past, but wanted to revisit the idea of using native Swift tools to build Foundation. I brought this up in the Slack group, and it seemed to be warmly received- although probably still not simple because of some cyclical dependency issues in the build process.
> 
> But, I think that there would be a lot of value in being able to build Foundation (and CoreFoundation) only using SwiftPM, in other words, simply with `swift build`. 
> 
> Now that SwiftPM is improving its ability to pass in compilation flags more easily and C module compilation. I think that the project could be restructured to make this work. What would be the obstacles for getting this working?
> 
> <ecblank.gif>	<ecblank.gif>
> <ecblank.gif>
> <ecblank.gif>
> <ecblank.gif>
> <ecblank.gif>	<ecblank.gif>
> 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20170130/75c1f8b3/attachment.html>


More information about the swift-corelibs-dev mailing list