diff options
author | Sven Göthel <[email protected]> | 2024-05-03 17:21:45 +0200 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-05-03 17:21:45 +0200 |
commit | e029f9f2139092818d6e0d9b198a57c60513af7c (patch) | |
tree | f92f6c9ed2411c42ff4f60adbe8065ca7452684f | |
parent | b63e1ca57b09386d5ceb8b65df34cdbd7e007ed2 (diff) |
IDE Eclipse CDT: Add CDT-LSP (clangd languages server [protocol]) setup (recommendation), update .clang* settings, recommend llvm-clang 16+
-rw-r--r-- | .clang-format | 3 | ||||
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | .clangd | 10 | ||||
-rw-r--r-- | README.md | 22 | ||||
-rwxr-xr-x | scripts/setup_clang_alternatives.sh | 2 |
5 files changed, 28 insertions, 10 deletions
diff --git a/.clang-format b/.clang-format index 90cce8c..7de946f 100644 --- a/.clang-format +++ b/.clang-format @@ -165,7 +165,8 @@ RawStringFormats: ReferenceAlignment: Pointer ReflowComments: true ShortNamespaceLines: 1 -SortIncludes: CaseSensitive +# SortIncludes: CaseSensitive +SortIncludes: Never SortJavaStaticImport: Before SortUsingDeclarations: true SpaceAfterCStyleCast: false diff --git a/.clang-tidy b/.clang-tidy index 5ccc4ec..d065b0f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,6 @@ Checks: 'clang-diagnostic-*, clang-analyzer-*, modernize-*, bugprone-*, performance-*, + misc-include-cleaner, -clang-diagnostic-unknown-warning-option, -clang-analyzer-security.insecureAPI.bzero, -modernize-use-auto, -modernize-use-nodiscard, -modernize-use-using, -modernize-use-trailing-return-type, @@ -12,10 +12,20 @@ # CheckOptions: # modernize-use-default-member-init.UseAssignment: true +# Tell clangd to use the compile_commands.json file in the build/default folder +CompileFlags: + CompilationDatabase: Release + +Diagnostics: + UnusedIncludes: Strict + InlayHints: Enabled: Yes + BlockEnd: Yes + Designators: No ParameterNames: Yes DeducedTypes: Yes + TypeNameLimit: 24 Hover: ShowAKA: Yes @@ -70,13 +70,13 @@ but currently only intended to support unit testing and to produce a Doxygen API - C++ compiler - gcc >= 8.3.0 (C++17) - gcc >= 10.2.1 (C++17 and C++20) - - clang >= 15 (C++17 and C++20) + - clang >= 16 (C++17 and C++20) - Optional for `lint` validation - - clang-tidy >= 15 -- Optional for `vscodium` integration - - clangd >= 15 - - clang-tools >= 15 - - clang-format >= 15 + - clang-tidy >= 16 +- Optional for `eclipse` and `vscodium` integration + - clangd >= 16 + - clang-tools >= 16 + - clang-format >= 16 - Optional - libunwind8 >= 1.2.1 - libcurl4 >= 7.74 (tested, lower may work) @@ -131,7 +131,7 @@ Installing build dependencies on Debian >= 11 and Ubuntu >= 20.04: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh} apt install git apt install build-essential g++ gcc libc-dev libpthread-stubs0-dev -apt install clang-15 clang-tidy-15 clangd-15 clang-tools-15 clang-format-15 +apt install clang-16 clang-tidy-16 clangd-16 clang-tools-16 clang-format-16 apt install libunwind8 libunwind-dev apt install cmake cmake-extras extra-cmake-modules apt install doxygen graphviz @@ -300,7 +300,13 @@ a Raspi-arm64, Raspi-armhf or PC-amd64 target image. IDE integration configuration files are provided for - [Eclipse](https://download.eclipse.org/eclipse/downloads/) with extensions - [CDT](https://github.com/eclipse-cdt/) or [CDT @ eclipse.org](https://projects.eclipse.org/projects/tools.cdt) - - Not used due to lack of subproject include file and symbol resolution: + - [CDT-LSP](https://github.com/eclipse-cdt/cdt-lsp) *recommended* + - Should work with clang toolchain >= 16 + - Utilizes clangd, clang-tidy and clang-format to support C++20 and above + - Add to available software site: `https://download.eclipse.org/tools/cdt/releases/cdt-lsp-latest` + - Install `C/C++ LSP Support` in the `Eclipse CDT LSP Category` + - `CMake Support`, install `C/C++ CMake Build Support` with ID `org.eclipse.cdt.cmake.feature.group` + - Not used due to lack of passing properties to `cmake` as well as subproject include file and symbol resolution: - `CMake Support`, install `C/C++ CMake Build Support` with ID `org.eclipse.cdt.cmake.feature.group` From the project root directory, prepare the `Debug` folder using `cmake` diff --git a/scripts/setup_clang_alternatives.sh b/scripts/setup_clang_alternatives.sh index 8eb1f91..798282d 100755 --- a/scripts/setup_clang_alternatives.sh +++ b/scripts/setup_clang_alternatives.sh @@ -1,6 +1,6 @@ #!/bin/sh -CLANG_VERSION=15 +CLANG_VERSION=16 update-alternatives --remove-all clang update-alternatives --remove-all clangd |