You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A script for generating an Xcode project for the Swift repo, that sits on top of an existing Ninja build. This has a few advantages over CMake's Xcode generator (using `build-script --xcode`):
4
+
5
+
- Fast to regenerate (less than a second)
6
+
- Native Swift targets for ASTGen/SwiftCompilerSources + Standard Library
7
+
- Better file organization (by path rather than by target)
8
+
- Much fewer targets, easier to manage
9
+
10
+
This script is primarily focussed on providing a good editor experience for working on the Swift project; it is not designed to produce compiled products or run tests, that should be done with `ninja` and `build-script`. It can however be used to [debug executables produced by the Ninja build](#debugging).
11
+
12
+
## Running
13
+
14
+
Run as:
15
+
16
+
```
17
+
./swift-xcodegen <path to Ninja build directory>
18
+
```
19
+
20
+
An Xcode project will be created in the grandparent directory (i.e `build/../Swift.xcodeproj`). Projects for LLVM, LLDB, and Clang may also be created by passing `--llvm`, `--lldb`, and `--clang` respectively. Workspaces of useful combinations will also be created (e.g Swift+LLVM, Clang+LLVM).
21
+
22
+
An `ALL` meta-target is created that depends on all the targets in the given project or workspace. A scheme for this target is automatically generated too (and automatic scheme generation is disabled). You can manually add individual schemes for targets you're interested in. Note however that Clang targets do not currently have dependency information.
23
+
24
+
## Debugging
25
+
26
+
By default, schemes are added for executable products, which can be used for debugging in Xcode. These use `ninja` to build the product before running. If using a separate build for debugging, you can specify it with `--runnable-build-dir`.
27
+
28
+
## Standard library targets
29
+
30
+
By default, C/C++ standard library + runtime files are added to the project. Swift targets may be added by passing `--stdlib-swift`, which adds a target for the core standard library as well as auxiliary libraries (e.g CxxStdlib, Backtracing, Concurrency). This requires using Xcode with an up-to-date development snapshot, since the standard library expects to be built using the just-built compiler.
31
+
32
+
## Command usage
33
+
34
+
```
35
+
USAGE: swift-xcodegen [<options>] <build-dir>
36
+
37
+
ARGUMENTS:
38
+
<build-dir> The path to the Ninja build directory to generate for
39
+
40
+
LLVM PROJECTS:
41
+
--clang/--no-clang Generate an xcodeproj for Clang (default: --no-clang)
42
+
--clang-tools-extra/--no-clang-tools-extra
43
+
When generating a project for Clang, whether to include clang-tools-extra (default: --clang-tools-extra)
44
+
--lldb/--no-lldb Generate an xcodeproj for LLDB (default: --no-lldb)
45
+
--llvm/--no-llvm Generate an xcodeproj for LLVM (default: --no-llvm)
46
+
47
+
SWIFT TARGETS:
48
+
--swift-targets/--no-swift-targets
49
+
Generate targets for Swift files, e.g ASTGen, SwiftCompilerSources. Note
50
+
this by default excludes the standard library, see '--stdlib-swift'. (default: --swift-targets)
51
+
--swift-dependencies/--no-swift-dependencies
52
+
When generating Swift targets, add dependencies (e.g swift-syntax) to the
53
+
generated project. This makes build times slower, but improves syntax
54
+
highlighting for targets that depend on them. (default: --swift-dependencies)
55
+
56
+
RUNNABLE TARGETS:
57
+
--runnable-build-dir <runnable-build-dir>
58
+
If specified, runnable targets will use this build directory. Useful for
59
+
configurations where a separate debug build directory is used.
60
+
--runnable-targets/--no-runnable-targets
61
+
Whether to add runnable targets for e.g swift-frontend. This is useful
62
+
for debugging in Xcode. (default: --runnable-targets)
0 commit comments