mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-29 22:24:26 +02:00
Improve clangd support (in Nix development shell) (#3526)
This commit is contained in:
commit
9fe78fa86a
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ CMakeCache.txt
|
||||
/.vs
|
||||
cmake-build-*/
|
||||
Debug
|
||||
compile_commands.json
|
||||
|
||||
# Build dirs
|
||||
build
|
||||
|
@ -99,6 +99,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTOML_ENABLE_FLOAT16=0")
|
||||
# set CXXFLAGS for build targets
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -D_FORTIFY_SOURCE=2 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
# Export compile commands for debug builds if we can (useful in LSPs like clangd)
|
||||
# https://cmake.org/cmake/help/v3.31/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html
|
||||
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja" AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
endif()
|
||||
|
||||
option(DEBUG_ADDRESS_SANITIZER "Enable Address Sanitizer in Debug builds" OFF)
|
||||
|
||||
# If this is a Debug build turn on address sanitiser
|
||||
|
11
flake.nix
11
flake.nix
@ -78,7 +78,18 @@
|
||||
buildInputs = with pkgs; [
|
||||
ccache
|
||||
ninja
|
||||
llvmPackages_19.clang-tools
|
||||
];
|
||||
|
||||
cmakeFlags = self.packages.${system}.prismlauncher-unwrapped.cmakeFlags ++ [
|
||||
"-GNinja"
|
||||
"-Bbuild"
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug
|
||||
ln -s {build/,}compile_commands.json
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user