Skip to content

Commit

Permalink
Add compile_commands.json CMake script, and Lapce runners (#302)
Browse files Browse the repository at this point in the history
* Add Lapce runner to run CMake

This is necessary to generate the compile_commands.json file which
clangd uses to be able to load libaries like gtkmm.

* Move compile_commands generation script into separate file

* Add more Lapce run settings

* Set execute bit on gen_compile_commands.sh

* Move Lapce run files to .lapce
  • Loading branch information
wallabra authored Jun 26, 2024
1 parent 10e4368 commit 766be26
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# Build directory contents
build/*

# User-specific files
*.rsuser
*.suo
Expand Down
7 changes: 7 additions & 0 deletions .lapce/gen_compile_commands.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
# Use this script to create the compile_commands.json file.
# This is necessary for clangd completion.

cmake . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=True
24 changes: 24 additions & 0 deletions .lapce/run.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# The run config is used for both run mode and debug mode

[[configs]]
name = "cmake-debug"
program = "sh"
args = [".lapce/gen_compile_commands.sh"]

[configs.env]
CC = "/usr/bin/clang"
CXX = "/usr/bin/clang++"

[[configs]]
name = "cmake"
program = "cmake"
args = ["--build", "build"]

[configs.env]
CC = "/usr/bin/clang"
CXX = "/usr/bin/clang++"

[[configs]]
name = "run"
type = "lldb"
program = "build/abaddon"
1 change: 1 addition & 0 deletions compile_commands.json

0 comments on commit 766be26

Please sign in to comment.