Skip to content

Commit

Permalink
Add the building script for compile db (BoomingTech#180)
Browse files Browse the repository at this point in the history
* Add the building script for compile db

* Fix line wrapping

* Rename clangd helper script to generate_compile_db.bat
  • Loading branch information
huandzh authored and KaygNas committed Feb 10, 2023
1 parent d0b8f25 commit 69fc2bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,19 @@ Or you can execute the **build_macos.sh** to build the binaries.
### Build on Ubuntu 20.04
You can execute the **build_linux.sh** to build the binaries.

### Documentation
## Documentation
For documentation, please refer to the Wiki section.

## Extra

### Generate Compilation Database

You can build `compile_commands.json` with the following commands when `Unix Makefiles` generaters are avaliable. `compile_commands.json` is the file
required by `clangd` language server, which is a backend for cpp lsp-mode in Emacs.

For Windows:

``` powershell
cmake -DCMAKE_TRY_COMPILE_TARGET_TYPE="STATIC_LIBRARY" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S . -B compile_db_temp -G "Unix Makefiles"
copy compile_db_temp\compile_commands.json .
```
5 changes: 5 additions & 0 deletions scripts/generate_compile_db.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

rem export compile_commands.json for clangd lsp
cmake -DCMAKE_TRY_COMPILE_TARGET_TYPE="STATIC_LIBRARY" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S . -B .\compile_db_temp -G "Unix Makefiles"
copy .\compile_db_temp\compile_commands.json .

0 comments on commit 69fc2bb

Please sign in to comment.