Skip to content

Commit a9b271f

Browse files
Support for compile_commands.json/clangd (#87)
1 parent 977ae2a commit a9b271f

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CompileFlags:
2+
CompilationDatabase: .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ lib/
3131
*.exe
3232
livekit.log
3333
web/
34+
compile_commands.json

CMakePresets.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"hidden": true,
3939
"generator": "Ninja",
4040
"cacheVariables": {
41-
"LIVEKIT_USE_VCPKG": "OFF"
41+
"LIVEKIT_USE_VCPKG": "OFF",
42+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
4243
},
4344
"condition": {
4445
"type": "equals",
@@ -51,7 +52,8 @@
5152
"hidden": true,
5253
"generator": "Ninja",
5354
"cacheVariables": {
54-
"LIVEKIT_USE_VCPKG": "OFF"
55+
"LIVEKIT_USE_VCPKG": "OFF",
56+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
5557
},
5658
"condition": {
5759
"type": "equals",

build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ configure() {
152152
cmake -S . -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
153153
fi
154154
fi
155+
156+
if [[ -f "${BUILD_DIR}/compile_commands.json" ]]; then
157+
ln -sf "${BUILD_DIR}/compile_commands.json" "${PROJECT_ROOT}/compile_commands.json"
158+
echo "==> Symlinked compile_commands.json -> ${BUILD_DIR}/compile_commands.json"
159+
fi
155160
}
156161

157162
build() {

0 commit comments

Comments
 (0)