File: Using%20SourceKit-LSP%20with%20Embedded%20Projects.md

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (26 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Using SourceKit-LSP with Embedded Projects

If you need to pass additional options in the `swift build` invocation to build your project, SourceKit-LSP needs to know about these as well to fully understand your project. To tell SourceKit-LSP about these options, add a `.sourcekit-lsp/config.json` file to your project’s root folder and add the arguments you pass to `swift build` to that configuration file as described [here](Configuration%20File.md).

For example, if you use the following invocation to build your project

```sh
swift build \
  --configuration release \
  --triple armv7em-apple-none-macho \
  -Xcc -D__APPLE__ -Xcc -D__MACH__ \
  -Xswiftc -Xfrontend -Xswiftc -disable-stack-protector
```

Then the `.sourcekit-lsp/config.json` file should contain

```json
{
  "swiftPM": {
    "configuration": "release",
    "triple": "armv7em-apple-none-macho",
    "cCompilerFlags": ["-D__APPLE__", "-D__MACH__"],
    "swiftCompilerFlags": ["-Xfrontend", "-disable-stack-protector"]
  }
}
```