Add xcodebuild option to generate compile_commands

Tong Xingang 2019-06-07 18:32:12 +08:00 committed by Fangrui Song
parent 2256fa6a25
commit 3b5358b52d

@ -87,6 +87,14 @@ buck build :helloworld#compilation-database
ln -s $(buck targets --show-output :helloworld#compilation-database | cut -d ' ' -f 2)
```
### [xcodebuild](https://developer.apple.com/library/archive/technotes/tn2339/_index.html)
[xcpretty](https://github.com/xcpretty/xcpretty) is a 3rd party tool that can parse the output of `xcodebuild` and generate a compile_commands.
```sh
xcodebuild | xcpretty -r json-compilation-database --output compile_commands.json
```
### stdout of an external command
If the initialization option `"compilationDatabaseCommand"` is set, the command will be executed by ccls to provide the JSON compilation database. ccls will read its stdout rather than read `compile_commands.json`. This may be useful when ccls cannot parse the `compile_commands.json` correctly (e.g. MSVC cl.exe, Intel C++ Compiler options)
@ -268,4 +276,4 @@ mkdir Debug; cd Debug
../configure --enable-optimize=no --enable-debug --prefix=~/.local/stow/musl
bear make -j
cd ..; ln -s Debug/compile_commands.json
```
```