Fix clangd in nix shell

This commit is contained in:
Sameer Rahmani 2024-03-26 19:24:32 +00:00
parent 1ffdf050e4
commit 51a20bfbc8
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 13 additions and 7 deletions

View File

@ -23,6 +23,13 @@ project(Feynman
# Clangd command file
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
if(CMAKE_EXPORT_COMPILE_COMMANDS)
# We need this setup for clangd to work inside of a Nix shell.
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.html
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
# =============================================================================
# Policies
# =============================================================================

View File

@ -24,8 +24,7 @@ find_package(argparse REQUIRED)
find_package(fmt REQUIRED)
find_package(RocksDB REQUIRED)
add_executable(feynman
)
add_executable(feynman)
set_target_properties(feynman PROPERTIES
VERSION ${PROJECT_VERSION}
@ -56,7 +55,7 @@ target_include_directories(feynman SYSTEM PUBLIC
# We don't want the generated files from table gen
# to be treated as local since the contain warnings
${PROJECT_BINARY_DIR}/feynman/include
${argparse_INCLUDE_DIRS}
)
target_link_libraries(feynman PRIVATE
argparse::argparse

View File

@ -175,7 +175,6 @@
build
run
compile
blah
]);
@ -185,7 +184,7 @@
buildInputs = deps;
CPP_LS = "clangd -j 30 --query-driver=${pkgs.clang_17}/bin/clang++-*";
CPP_LS = "clangd -j 30 --query-driver=${pkgs.clang_17}/bin/clang-*";
shellHook = ''
fish && exit
'';

View File

@ -18,10 +18,11 @@ let
compile = writeShellApplication {
name = "compile";
runtimeInputs = deps;
text = ''
mkdir -p ./build
cd build
${cmake}/bin/cmake -GNinja .. "$@"
${cmake}/bin/cmake -GNinja .. -DCMAKE_CXX_FLAGS="-v" "$@"
${ninja}/bin/ninja -j32 -v
'';
};
@ -44,5 +45,5 @@ let
};
in {
inherit compile run build blah;
inherit compile run build;
}