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 + + +
Option | +Effect | +
---|---|
-D CMAKE_BUILD_TYPE=Debug | +Enables debug info and disables optimizations | +
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON | +Creates 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: |
+
-D ENABLE_CCACHE:BOOL=ON | +Speeds up recompilation | +
-G Ninja | +Use Ninja build system instead of make, which speeds up the build and doesn't require a -j flag |
+