[swift-dev] Beginner's questions about building Swift from source etc.
jens at bitcycle.com
Wed Dec 9 16:22:03 CST 2015
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:
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:
-Ounchecked -gnone -whole-module-optimization main.swift
(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
- 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
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev