diff --git a/CMakeLists.txt b/CMakeLists.txt index a53a8cd..b4166eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # ============================================================================= diff --git a/feynman/CMakeLists.txt b/feynman/CMakeLists.txt index dad6e5d..b1def5a 100644 --- a/feynman/CMakeLists.txt +++ b/feynman/CMakeLists.txt @@ -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 diff --git a/flake.nix b/flake.nix index 0a8667a..0f48bce 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ''; diff --git a/nix/utils.nix b/nix/utils.nix index 5849491..dae3144 100644 --- a/nix/utils.nix +++ b/nix/utils.nix @@ -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; }