Просмотр исходного кода

Remove .clangd config and add separate markdown file explaining some CMake options

Alexander Wilms 1 год назад
Родитель
Сommit
775b20bfe2
3 измененных файлов с 41 добавлено и 12 удалено
  1. 0 2
      .clangd
  2. 4 10
      docs/developers/Building_Linux.md
  3. 37 0
      docs/developers/CMake.md

+ 0 - 2
.clangd

@@ -1,2 +0,0 @@
-CompileFlags:
-	CompilationDatabase: ../vcmi-build

+ 4 - 10
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
 

+ 37 - 0
docs/developers/CMake.md

@@ -0,0 +1,37 @@
+# CMake options
+
+<!-- Pure markdown doesn't support code blocks within tables -->
+<table>
+    <thead>
+        <tr>
+            <th>Option</th>
+            <th>Effect</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>-D CMAKE_BUILD_TYPE=Debug</td>
+            <td>Enables debug info and disables optimizations</td>
+        </tr>
+        <tr>
+            <td>-D CMAKE_EXPORT_COMPILE_COMMANDS=ON</td>
+            <td>Creates <code>compile_commands.json</code> for <a href="https://clangd.llvm.org/"><code>clangd</code></a> language server
+            <br><br>
+            For clangd to find the JSON, create a file named <code>.clangd</code>
+            <pre>.
+├── vcmi -> contains sources and is under git control
+├── build -> contains build output, makefiles, object files,...
+└── .clangd</pre>
+            with the following content
+            <pre>CompileFlags:<br>	CompilationDatabase: build</pre></td>
+        </tr>
+        <tr>
+            <td>-D ENABLE_CCACHE:BOOL=ON</td>
+            <td>Speeds up recompilation</td>
+        </tr>
+        <tr>
+            <td>-G Ninja</td>
+            <td>Use Ninja build system instead of make, which speeds up the build and doesn't require a <code>-j</code> flag</td>
+        </tr>
+    </tbody>
+</table>