Skip to content

Commit cc26e15

Browse files
authored
Merge pull request #42175 from apple/ktoso-patch-11
[Guide] Add guide to set up CLion for compiler development
2 parents 7ce94fe + fe53939 commit cc26e15

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/HowToGuides/GettingStarted.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ toolchain as a one-off, there are a couple of differences:
2525
- [Editing code](#editing-code)
2626
- [Setting up your fork](#setting-up-your-fork)
2727
- [First time Xcode setup](#first-time-xcode-setup)
28+
- [Other IDEs setup](#other-ides-setup)
2829
- [Editing](#editing)
2930
- [Incremental builds with Ninja](#incremental-builds-with-ninja)
3031
- [Incremental builds with Xcode](#incremental-builds-with-xcode)
@@ -358,6 +359,28 @@ select the following schemes:
358359
run.
359360
<!-- TODO: Insert SourceKit/stdlib specific instructions? -->
360361
362+
### Other IDEs setup
363+
364+
You can also use other editors and IDEs to work on Swift.
365+
366+
#### IntelliJ CLion
367+
368+
CLion supports CMake and Ninja. In order to configure it properly, build the swift project first using the `build-script`, then open the `swift` directory with CLion and proceed to project settings (`cmd + ,`).
369+
370+
In project settings, locate `Build, Execution, Deployment > CMake`. You will need to create a new profile named `RelWithDebInfoAssert` (or `Debug` if going to point it at the debug build). Enter the following information:
371+
372+
- Name: mirror the name of the build configuration here, e.g. `RelWithDebInfoAssert` or `Debug`
373+
- Build type: This corresponds to `CMAKE_BUILD_TYPE` so should be e.g. `RelWithDebInfoAssert` or `Debug`
374+
- latest versions of the IDE suggest valid values here. Generally `RelWithDebInfoAssert` is a good one to work with
375+
- Toolchain: Default should be fine
376+
- Generator: Ninja
377+
- CMake options:
378+
- `-D SWIFT_PATH_TO_CMARK_BUILD=SOME_PATH/swift-project/build/Ninja-RelWithDebInfoAssert/cmark-macosx-arm64 -D LLVM_DIR=SOME_PATH/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/cmake/llvm -D Clang_DIR=SOME_PATH/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/cmake/clang -D CMAKE_BUILD_TYPE=RelWithDebInfoAssert -G Ninja -S .`
379+
- replace the `SOME_PATH` to the path where your `swift-project` directory is
380+
- the CMAKE_BUILD_TYPE should match the build configuration name, so if you named this profile `RelWithDebInfo` the CMAKE_BUILD_TYPE should also be `RelWithDebInfo`
381+
382+
With this done, CLion should be able to successfully import the project and have full autocomplete and code navigation powers.
383+
361384
### Editing
362385
363386
Make changes to the code as appropriate. Implement a shiny new feature!

0 commit comments

Comments
 (0)