From e6ed5a388dee8954f1aa94e50430c191f4b2a0a5 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 26 Sep 2024 15:14:54 +0300 Subject: [PATCH] BuildSystem: Export compile commands for clangd --- .clangd | 13 +++++++++++++ .vscode/settings.json | 8 ++++++-- CMakeLists.txt | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 .clangd diff --git a/.clangd b/.clangd new file mode 100644 index 00000000..efffbc65 --- /dev/null +++ b/.clangd @@ -0,0 +1,13 @@ +Diagnostics: + Suppress: target_unsupported_type + +CompileFlags: + Remove: [ + -fstrict-volatile-bitfields, + -fno-tree-loop-distribute-patterns + ] + Add: [ + -D__banan_os__, + -D__arch__=x86_64, + -D__x86_64__ + ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 1b010970..09fcad78 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,9 @@ "cmake.configureOnOpen": false, "editor.tabSize": 4, "editor.insertSpaces": false, - "editor.detectIndentation": false -} \ No newline at end of file + "editor.detectIndentation": false, + "clangd.arguments": [ + "--compile-commands-dir=${workspaceFolder}/build", + "-header-insertion=never" + ] +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 160643a9..4db2613d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "") set(BUILD_SHARED_LIBS True) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")