From 3b5358b52deb59f28ad93eeae4c1443cd7299d42 Mon Sep 17 00:00:00 2001 From: Tong Xingang Date: Fri, 7 Jun 2019 18:32:12 +0800 Subject: [PATCH] Add xcodebuild option to generate compile_commands --- Project-Setup.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Project-Setup.md b/Project-Setup.md index dffbb70..03d9425 100644 --- a/Project-Setup.md +++ b/Project-Setup.md @@ -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 -``` +``` \ No newline at end of file