diff --git a/.gitignore b/.gitignore index 4f01d1da..65c5980d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ packages # The solution files get generated by vcpkg on Windows # and by the C# Dev Kit within a dev container. *.sln + +# clangd language server support +compile_commands.json +.cache diff --git a/CMakeLists.txt b/CMakeLists.txt index 5576523d..fa536bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ if (UNIX AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Specifies the build type on single-configuration generators" FORCE) endif () +set(CMAKE_EXPORT_COMPILE_COMMANDS true) + set(CMAKE_DEBUG_POSTFIX d) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/${VCPKG_TARGET_TRIPLET}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/${VCPKG_TARGET_TRIPLET}) diff --git a/build_unix.sh b/build_unix.sh index 914acf49..46384909 100755 --- a/build_unix.sh +++ b/build_unix.sh @@ -83,4 +83,8 @@ do build_dir=build/$triplet-$(tr A-Z a-z <<<$build_type) cmake -B $build_dir -S . -D VCPKG_TARGET_TRIPLET=$triplet -D CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake -D CMAKE_BUILD_TYPE=$build_type $options cmake --build $build_dir -j ${nproc} -done \ No newline at end of file + if [ "${build_type}" == "Debug" ] + then + ln -snf $build_dir/compile_commands.json . + fi +done