From 2e817dc4f6d9c2efe05c1160e0f98c95838925af Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 20 Sep 2023 17:12:17 +0300 Subject: [PATCH] README: Document compile_commands.json. --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 115e7714..db66b9ba 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,42 @@ script `wine/tools/gdbinit.py` (source it) that provides `load-symbol-files` (or `lsf` for short) command which loads the symbols for all the mapped files. +`compile_commands.json` +----------------------- + +For use with [clangd](https://clangd.llvm.org/) LSP server and similar tooling. + +Projects built using cmake or meson (e.g. vkd3d-proton) automatically come with +`compile_commands.json`. For autotools (e.g. wine) you have to [configure the +build](#configuring-the-build) with `--enable-bear` that uses +[bear](https://github.com/rizsotto/Bear) to create the compilation database. +It's not on by default as it make the build slightly slower. + +The build system collects all the created compile_commands.json files in a +build subdirectory named `compile_commands/`. + +The paths are translated to point to the real source (i.e. not the rsynced +copy). It still may depend on build directory for things like auto-generated +`config.h` though and for wine it may be beneficial to run `tools/make_requests` +in you source directories as those changes are not committed. + +You can then configure your editor to use that file for clangd in a few ways: + +1) directly - some editors/plugins allow you to specify the path to `compile_commands.json` +2) via `.clangd` file, e.g. +```bash +cd src/proton/wine/ +cat > .clangd <