Skip to content

Commit 1322f48

Browse files
authored
Expand IDE setup documentation (#8)
Adds more detailed instructions on how to configure the Nova Icarus extension and the VSCode Swift extension.
1 parent f8b4354 commit 1322f48

File tree

4 files changed

+66
-11
lines changed

4 files changed

+66
-11
lines changed

Sources/Playdate/Documentation.docc/BuildingTheExamples.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The examples' Makefiles depend on two supporting Makefiles for common logic. The
1414
> - `common.mk: $HOME/Developer/PlaydateSDK/C_API/buildsupport/common.mk`
1515
> - `swift.mk: $REPO_ROOT/Examples/swift.mk`
1616
17-
### Build with Make
17+
## Build with Make
1818

1919
To build an example with make, enter the example's directory and run `make`.
2020

@@ -36,9 +36,39 @@ $ $HOME/Developer/PlaydateSDK/bin/Playdate\ Simulator.app/Contents/MacOS/Playdat
3636

3737
> Note: Learn more about [`make`](https://man.freebsd.org/cgi/man.cgi?make(1))
3838
39-
### Build with Nova
39+
## Build with Nova
4040

41-
> Prerequisites: Install Nova, the Playdate extension, and the Icarus extension.
41+
Prerequisites: Install Nova, the Playdate extension, and the Icarus extension.
42+
43+
### Configure the Icarus extension
44+
45+
Configure the Icarus Swift language support extension to use a Swift nightly toolchain. See <doc:DownloadingTheTools> for instructions on how to install a nightly toolchain.
46+
47+
Use the Menu bar to navigate to the extension library Extension > Extension Library or press Cmd+Shift+2. Select the Icarus extension, then select the Settings panel. Finally, select the "Toolchain: Custom" option and provide a full path to your nightly toolchain in the "Custom Toolchain Path" field.
48+
49+
@Image(source: "nova-icarus-configuration", alt: "A screenshot of the Icarus extension settings in Nova with \"Custom\" selected.")
50+
51+
> Note: This path should end in `.xctoolchain`.
52+
53+
### Make the Playdate module available
54+
55+
Icarus uses the `Playdate.swiftmodule` built by SwiftPM to drive autocomplete and other editor integration. In order for this to work properly, you must first manually perform a release build in the example directory.
56+
57+
```console
58+
$ cd $REPO_ROOT/Example/Life
59+
$ TOOLCHAINS="org.swift.59202312211a" swift build -c release
60+
```
61+
62+
Lastly, we need to create a debug symlink the release build directory.
63+
64+
```console
65+
$ cd $REPO_ROOT/Example/Life/.build/arm64-apple-macosx
66+
$ ln -s release debug
67+
```
68+
69+
> Why is this needed? By default SourceKit-LSP looks for a debug build, but can be configured to use a release build. Unfortunately, Icarus does not yet allow us to pass custom SourceKit-LSP options, so we trick SourceKit-LSP into working by pretending our release build is a debug build.
70+
71+
### Perform a Build
4272

4373
The examples included in this repository have been preconfigured with Panic's Playdate extension for Nova found under each example's `.nova` directory.
4474

@@ -48,9 +78,32 @@ Open an example directory with Nova and select the Run icon in the toolbar or pr
4878

4979
> Note: Learn more about [Nova](https://nova.app)
5080
51-
### Build with VSCode
81+
## Build with VSCode
82+
83+
Prerequisites: Install VSCode and the Swift extension.
84+
85+
### Configure the Swift extension
86+
87+
Configure the VSCode Swift extension to use a Swift nightly toolchain. See <doc:DownloadingTheTools> for instructions on how to install a nightly toolchain.
88+
89+
Under the Swift Settings, select the "Swift: Path" option and provide a full path to the `usr/bin` folder inside your nightly toolchain.
90+
91+
@Image(source: "vscode-swift-path-configuration", alt: "A screenshot of VSCode Swift extension with the \"Swift: Path\" option set to \"/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-03-07-a.xctoolchain/usr/bin\".")
92+
93+
Under the Swift Settings, select the "Swift > Sourcekit-LSP: Server Arguments" option and pass the arguments `['--configuration', 'release']`.
94+
95+
@Image(source: "vscode-sourcekit-lsp-configuration", alt: "A screenshot of VSCode Swift extension with the \"Swift > Sourcekit-LSP: Server Arguments\" option set to \"['--configuration', 'release']\".")
96+
97+
### Make the Playdate module available
5298

53-
> Prerequisites: Install VSCode and the Swift extension.
99+
The Swift extension uses the `Playdate.swiftmodule` built by SwiftPM to drive autocomplete and other editor integration. In order for this to work properly, you must first manually perform a release build in the example directory.
100+
101+
```console
102+
$ cd $REPO_ROOT/Example/Life
103+
$ TOOLCHAINS="org.swift.59202312211a" swift build -c release
104+
```
105+
106+
### Perform a Build
54107

55108
The examples included in this repository have been preconfigured with VSCode `tasks.json` files found under each example's `.vscode` directory.
56109

@@ -60,7 +113,7 @@ Open an example directory with VSCode and select the Terminal > Run Build Task m
60113

61114
> Note: Learn more about [VSCode](https://code.visualstudio.com)
62115
63-
### Build with Swift Package Manager
116+
## Build with Swift Package Manager
64117

65118
To build an example with swift package manager, enter the example’s directory, set the TOOLCHAINS environment variable to the name of your Swift nightly toolchain, and run `swift build` in release mode.
66119

@@ -73,10 +126,9 @@ After a successful build, the `.build/release` directory will contain object fil
73126

74127
> Note: Learn more about [Swift Package Manager](https://www.swift.org/package-manager/)
75128
76-
### Build with Xcode
129+
## Build with Xcode
77130

78-
> IMPORTANT:
79-
> Xcode 15.3+ is required to run the examples in Xcode.
131+
> Important: Xcode 15.3+ is required to run the examples in Xcode.
80132
81133
Open an example's `Package.swift` with Xcode via the command line or the Xcode graphical interface.
82134

@@ -85,11 +137,14 @@ $ cd Examples/Life
85137
$ open Package.swift
86138
```
87139

140+
### Configure the Toolchain
141+
88142
Select your Swift nightly toolchain from the Xcode > Toolchains menu item.
89143

90144
@Image(source: "xcode-toolchain-selection", alt: "A screenshot of the Xcode toolchain selection menu with a recent Swift nightly toolchain selected and highlighted.")
91145

146+
### Perform a Build
147+
92148
Select the Run icon in the toolbar or press Cmd+R on your keyboard to start a build. This will first build the example for the host machine using `xcbuild`. After a successful initial build, Xcode will automatically build again with `make` then open the Simulator with the newly built game.
93149

94-
> Note:
95-
> Learn more about [Xcode](https://developer.apple.com/xcode/)
150+
> Note: Learn more about [Xcode](https://developer.apple.com/xcode/)
577 KB
Loading
597 KB
Loading
620 KB
Loading

0 commit comments

Comments
 (0)