[swift-dev] Beginner's questions about building Swift from source etc.
aprantl at apple.com
Thu Dec 10 13:05:26 CST 2015
> On Dec 9, 2015, at 2:22 PM, Jens Persson via swift-dev <swift-dev at swift.org> wrote:
> Hi all,
> First of all, sorry for not being able to formulate these presumably basic questions in a better/shorter way.
> Background: We're working on an app that will benefit greatly from Swift's ability to generate optimized code from relatively high level abstractions.
> I've successfully compiled Swift from sources and observed some significant improvements in the optimizer (for details see the following forum thread, especially edit1 and edit2 of this post:
> https://forums.developer.apple.com/thread/27204#93327 <https://forums.developer.apple.com/thread/27204#93327>
> Now I'd like to be able to use Swift built from sources from within Xcode (or at least have some way of using it with code completion and probably swiftpm), but I haven't been able to find information on how to do that.
> Here's my journey so far:
> 1. Read the main swift repos readme.
> 2. Cloned the 9 repositories listed there (for read-only access).
> 3. Built using:
> swift/utils/build-script -R --no-assertions --no-swift-stdlib-assertions
> (Found out about the no-assert-flags through Twitter. Without them, the resulting compiler compiled binaries that were very slow.)
> 3. Compiled my "performance critical" test code like this:
> xcrun /blabla/build/Ninja-Release/swift-macosx-x86_64/bin/swift -Ounchecked -gnone -whole-module-optimization main.swift
Note that none of the options starting with “-g" have any effect on the generated code and thus won’t affect the performance of the resulting executable.
> (My first try was without xcrun, but then it would complain about "no such module". So I asked Twitter and got the info about using xcrun.)
> 4. Noted significant improvements in what the optimizer was able to do with my test code (compared to when compiling it with Xcode 7.2. The compiled-from-sources-compiler produced 340 times faster code. See details in the above forum thread.)
> 5. Feeling happy. Can't wait until this gets into an Xcode GM.
> 6. Wish I knew more about how to build Swift from sources, so I could make my workflow more convenient, ie switching between compiling with Swift-built-from-sources, Xcode and Xcode-beta. Eg:
> - Is there a way to use the built-from-sources-version of Swift from within Xcode (can I build a toolchain or something)?
> - How do I build and use the package manager (swiftpm)? It doesn't seem to get built when I build everything(?) using the build-script as described above.
> - Can I use any of the build-presets for this, and if so will it use the --no-assertions and --no-swift-stdlib-assertions options?
> My goal is to be able to have a convenient way of being able to write and compile my (performance critical) code using, switching between and comparing, the three different Swift versions in current
> Xcode (GM),
> Xcode-beta and
> Are the answers to these (and similar) questions plain to see in some documentation somewhere or do I have to dig around in various scripts etc and try to figure things out?
> swift-dev mailing list
> swift-dev at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev