Skip to content

Commit d97b786

Browse files
committed
docs: document working with two build directories
1 parent 5566c75 commit d97b786

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/DevelopmentTips.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ Going further, for various reasons the standard library has lots of warnings. Th
2020

2121
Copy the invocation that has ` -o <build-path>/swift-macosx-x86_64/stdlib/public/core/iphonesimulator/i386/Swift.o`, so that we can perform the actual call to swiftc ourselves. Tack on `-suppress-warnings` at the end, and now we have the command to just build `Swift.o` for i386 while only displaying the actual errors.
2222

23+
### Working with two build directories
24+
For developing and debugging you are probably building a debug configuration of swift. But it's often beneficial to also build a release-assert configuration in parallel (`utils/build-script -R`).
25+
26+
The standard library takes very long to build with a debug compiler. It's much faster to build everything (including the standard library) with a release compiler and only the swift-frontend (with `ninja swift-frontend`) in debug. Then copy the release-built standard library to the debug build:
27+
```
28+
src=/path/to/build/Ninja-ReleaseAssert/swift-macosx-x86_64
29+
dst=/path/to/build/Ninja-DebugAssert/swift-macosx-x86_64
30+
cp -r $src/stdlib $dst/
31+
cp -r $src/lib/swift/macosx $dst/lib/swift/
32+
cp -r $src/lib/swift/shims $dst/lib/swift/
33+
```
34+
2335
### Use sccache to cache build artifacts
2436

2537
Compilation times for the compiler and the standard library can be agonizing, especially for cold builds. This is particularly painful if

0 commit comments

Comments
 (0)