From 775b20bfe2b42f578a66ce6a6435420455641dca Mon Sep 17 00:00:00 2001 From: Alexander Wilms Date: Mon, 15 Jul 2024 11:27:23 +0200 Subject: [PATCH] Remove .clangd config and add separate markdown file explaining some CMake options --- .clangd | 2 -- docs/developers/Building_Linux.md | 14 ++++-------- docs/developers/CMake.md | 37 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 12 deletions(-) delete mode 100644 .clangd create mode 100644 docs/developers/CMake.md diff --git a/.clangd b/.clangd deleted file mode 100644 index 18890244f..000000000 --- a/.clangd +++ /dev/null @@ -1,2 +0,0 @@ -CompileFlags: - CompilationDatabase: ../vcmi-build diff --git a/docs/developers/Building_Linux.md b/docs/developers/Building_Linux.md index 9b5144890..a0b72f5e4 100644 --- a/docs/developers/Building_Linux.md +++ b/docs/developers/Building_Linux.md @@ -52,7 +52,7 @@ We recommend the following directory structure: ``` . ├── vcmi -> contains sources and is under git control -└── vcmi-build -> contains build output, makefiles, object files,... +└── build -> contains build output, makefiles, object files,... ``` You can get the latest source code with: @@ -64,22 +64,16 @@ You can get the latest source code with: ## Configuring Makefiles ```sh -mkdir vcmi-build -cd vcmi-build +mkdir build +cd build cmake -S ../vcmi ``` > [!NOTE] > The `../vcmi` is not a typo, it will place Makefiles into the build dir as the build dir is your working dir when calling CMake. -### Additional options that you may want to use: +See [CMake](CMake.md) for a list of options -| Option | Effect | -|--------|--------| -| -D CMAKE_BUILD_TYPE=Debug | Debug info and no optimizations | -| -D ENABLE_CCACHE:BOOL=ON | Speeds up recompilation | -| -D CMAKE_EXPORT_COMPILE_COMMANDS=ON | Creates `compile_commands.json` for `clangd` language server | -| -G Ninja | Use Ninja build system instead of make, which speeds up the build and doesn't require a `-j` flag | ## Building diff --git a/docs/developers/CMake.md b/docs/developers/CMake.md new file mode 100644 index 000000000..720491e4b --- /dev/null +++ b/docs/developers/CMake.md @@ -0,0 +1,37 @@ +# CMake options + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionEffect
-D CMAKE_BUILD_TYPE=DebugEnables debug info and disables optimizations
-D CMAKE_EXPORT_COMPILE_COMMANDS=ONCreates compile_commands.json for clangd language server +

+ For clangd to find the JSON, create a file named .clangd +
.
+├── vcmi -> contains sources and is under git control
+├── build -> contains build output, makefiles, object files,...
+└── .clangd
+ with the following content +
CompileFlags:
CompilationDatabase: build
-D ENABLE_CCACHE:BOOL=ONSpeeds up recompilation
-G NinjaUse Ninja build system instead of make, which speeds up the build and doesn't require a -j flag