zed icon indicating copy to clipboard operation
zed copied to clipboard

Issues with C++ support

Open juanbono opened this issue 1 year ago • 28 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Create a .cpp file with some code like the following one:

#include <iostream>

int main() { std::cout << "Hello World!\n"; }

The C++ integration highlights in red the iostream include and std::cout and signals an error.

Other editors that have C++ support via clangd (like vscode) doesn't show the same errors.

Environment

Zed: v0.122.2 (Zed) OS: macOS 14.3.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

image

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

juanbono avatar Feb 19 '24 13:02 juanbono

Clangd generally relies on a compile_commands.json to work, and that in turn is usually generated by CMake, meson or similar. I take it this is just a standalone .cpp file in a clean directory and not a "proper" project structure?

jansol avatar Feb 19 '24 15:02 jansol

yeah, this is a .cpp file without build system files.

juanbono avatar Feb 19 '24 18:02 juanbono

Should this be closed in favor of an issue filed over at clangd?

JosephTLyons avatar Feb 20 '24 17:02 JosephTLyons

Is it possible to feed clangd some options on startup / on the command line to handle standalone files "correctly"? If not then yeah, seems like something that should be taken up with upstream. (a workaround would of course be to just generate a naïve compile_commands.json.)

jansol avatar Feb 20 '24 17:02 jansol

image

I have compile_command.json but c++ development doesnt work for me in zed editor.

xbz-24 avatar Apr 01 '24 15:04 xbz-24

maybe I can indicate c++20 standard for compile_commands but what about spdlog?

my project is running fine but I am getting clangd warnings that spdlog is not included?

xbz-24 avatar Apr 01 '24 15:04 xbz-24

I said about c++20 because its indicating about std::unique_ptr and std::unique_ptr::make_unique.

xbz-24 avatar Apr 01 '24 15:04 xbz-24

please let me know if there is a way to fix this

xbz-24 avatar Apr 01 '24 15:04 xbz-24

image

xbz-24 avatar Apr 02 '24 04:04 xbz-24

image

xbz-24 avatar Apr 02 '24 04:04 xbz-24

This code inside zed terminal runs when I do cmake .. inside my build-cmake-debug directory (after that, I do ninja, since that is my build system for cmake)

however clang is giving false claiming that glfw is not being found, which is strange since It is being found by cmake

plase note that I am doing cmake with compile_commands.json, that way clangd gets the libraries I am using, I have the compile_commands.json at the root of the project, since that is where the cmakelists.txt is located this is the compile_commands.json

xbz-24 avatar Apr 02 '24 04:04 xbz-24

[
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/main.cpp.o -c /Users/xbz/Developer/Vk-Render/src/main.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/main.cpp",
  "output": "CMakeFiles/main.dir/src/main.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/engine.cpp.o -c /Users/xbz/Developer/Vk-Render/src/engine.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/engine.cpp",
  "output": "CMakeFiles/main.dir/src/engine.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/instance.cpp.o -c /Users/xbz/Developer/Vk-Render/src/instance.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/instance.cpp",
  "output": "CMakeFiles/main.dir/src/instance.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/device.cpp.o -c /Users/xbz/Developer/Vk-Render/src/device.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/device.cpp",
  "output": "CMakeFiles/main.dir/src/device.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/swapchain.cpp.o -c /Users/xbz/Developer/Vk-Render/src/swapchain.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/swapchain.cpp",
  "output": "CMakeFiles/main.dir/src/swapchain.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/queue_families.cpp.o -c /Users/xbz/Developer/Vk-Render/src/queue_families.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/queue_families.cpp",
  "output": "CMakeFiles/main.dir/src/queue_families.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/shaders.cpp.o -c /Users/xbz/Developer/Vk-Render/src/shaders.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/shaders.cpp",
  "output": "CMakeFiles/main.dir/src/shaders.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/pipeline.cpp.o -c /Users/xbz/Developer/Vk-Render/src/pipeline.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/pipeline.cpp",
  "output": "CMakeFiles/main.dir/src/pipeline.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/framebuffer.cpp.o -c /Users/xbz/Developer/Vk-Render/src/framebuffer.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/framebuffer.cpp",
  "output": "CMakeFiles/main.dir/src/framebuffer.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/commands.cpp.o -c /Users/xbz/Developer/Vk-Render/src/commands.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/commands.cpp",
  "output": "CMakeFiles/main.dir/src/commands.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/sync.cpp.o -c /Users/xbz/Developer/Vk-Render/src/sync.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/sync.cpp",
  "output": "CMakeFiles/main.dir/src/sync.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/app.cpp.o -c /Users/xbz/Developer/Vk-Render/src/app.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/app.cpp",
  "output": "CMakeFiles/main.dir/src/app.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/scene.cpp.o -c /Users/xbz/Developer/Vk-Render/src/scene.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/scene.cpp",
  "output": "CMakeFiles/main.dir/src/scene.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/mesh.cpp.o -c /Users/xbz/Developer/Vk-Render/src/mesh.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/mesh.cpp",
  "output": "CMakeFiles/main.dir/src/mesh.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/memory.cpp.o -c /Users/xbz/Developer/Vk-Render/src/memory.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/memory.cpp",
  "output": "CMakeFiles/main.dir/src/memory.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/triangle_mesh.cpp.o -c /Users/xbz/Developer/Vk-Render/src/triangle_mesh.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/triangle_mesh.cpp",
  "output": "CMakeFiles/main.dir/src/triangle_mesh.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/logging.cpp.o -c /Users/xbz/Developer/Vk-Render/src/logging.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/logging.cpp",
  "output": "CMakeFiles/main.dir/src/logging.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/quad_mesh.cpp.o -c /Users/xbz/Developer/Vk-Render/src/quad_mesh.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/quad_mesh.cpp",
  "output": "CMakeFiles/main.dir/src/quad_mesh.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/vma.cpp.o -c /Users/xbz/Developer/Vk-Render/src/vma.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/vma.cpp",
  "output": "CMakeFiles/main.dir/src/vma.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/device_check.cpp.o -c /Users/xbz/Developer/Vk-Render/src/device_check.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/device_check.cpp",
  "output": "CMakeFiles/main.dir/src/device_check.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/logger.cpp.o -c /Users/xbz/Developer/Vk-Render/src/logger.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/logger.cpp",
  "output": "CMakeFiles/main.dir/src/logger.cpp.o"
},
{
  "directory": "/Users/xbz/Developer/Vk-Render/cmake-builde-debug",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/debug/lib/pkgconfig/../../../include -I/Users/xbz/Developer/Vk-Render/inc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/include -isystem /Users/xbz/Developer/Vk-Render/cmake-builde-debug/vcpkg_installed/x64-osx/share/unofficial-vulkan-memory-allocator-hpp/../../include -std=gnu++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o CMakeFiles/main.dir/src/cube_mesh.cpp.o -c /Users/xbz/Developer/Vk-Render/src/cube_mesh.cpp",
  "file": "/Users/xbz/Developer/Vk-Render/src/cube_mesh.cpp",
  "output": "CMakeFiles/main.dir/src/cube_mesh.cpp.o"
}
]

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is my settings.json for zed

xbz-24 avatar Apr 02 '24 04:04 xbz-24

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  "languages": {
    "C++": {
      "enable_language_server": true,
      "use_autoclose": true,
      "extend_comment_on_newline": true,
      "remove_trailing_whitespace_on_save": true,
      "tab_size": 4,
      "indent_size": 4,
      "indent_style": "space",
      "code_actions_on_format": {
        "clangd": true
      },
      "always_treat_brackets_as_autoclosed": true,
      "ensure_final_newline_on_save": true,
      "show_copilot_suggestions": true
    },
    "C": {
      "show_copilot_suggestions": true,
      "enable_language_server": true,
      "use_autoclose": true,
      "extend_comment_on_newline": true,
      "remove_trailing_whitespace_on_save": true,
      "code_actions_on_format": {
        "clangd": true
      },
      "always_treat_brackets_as_autoclosed": true,
      "ensure_final_newline_on_save": true
    },
    "Rust": {
      "enable_language_server": true,
      "use_autoclose": true,
      "extend_comment_on_newline": true,
      "remove_trailing_whitespace_on_save": true,
      "code_actions_on_format": {
        "rust-analyzer": true
      },
      "always_treat_brackets_as_autoclosed": true,
      "ensure_final_newline_on_save": true,
      "show_copilot_suggestions": true
    }
  },
  "nightly": {
    "enabled": true,
    "version": "1.0.0",
    "url": "https://nightly.zedapp.org",
    "update": true,
    "auto_update": true,
    "auto_update_interval": 86400,
    "auto_update_check": true,
    "auto_update_check_interval": 86400,
    "auto_update_check_last": 0
  },
  "ui_font_family": "Comic Sans MS",
  "scrollbar": {
    "visible": true,
    "vertical": "auto",
    "horizontal": "auto",
    "git_diff": true,
    "diagnostics": true,
    "hover": true,
    "references": true,
    "definition": true,
    "document_symbols": true,
    "workspace_symbols": true
  },
  "cursor_blink": true,
  "always_treat_brackets_as_autoclosed": false,
  "active_pane_magnification": 0,
  "stable": {
    "enabled": false,
    "version": "1.0.0",
    "url": "https://stable.zedapp.org",
    "update": true,
    "auto_update": true,
    "auto_update_interval": 86400,
    "auto_update_check": true,
    "auto_update_check_interval": 86400,
    "auto_update_check_last": 0
  },
  "assistant": {
    "version": "1",
    "enabled": false,
    "url": "https://assistant.zedapp.org",
    "update": true,
    "auto_update": true,
    "auto_update_interval": 86400,
    "auto_update_check": true,
    "auto_update_check_interval": 86400,
    "auto_update_check_last": 0
  },
  "autosave": "on_focus_change",
  "theme": "New Darcula",
  "confirm_quit": false,
  "vim_mode": true,
  "ui_font_size": 36,
  "buffer_font_size": 36,
  "lsp": {
    "clangd": {
      "enabled": true,
      "version": "12.0.0",
      "url": "https://clangd.zedapp.org",
      "update": true,
      "auto_update": true,
      "auto_update_interval": 86400,
      "auto_update_check": true,
      "auto_update_check_interval": 86400,
      "auto_update_check_last": 0,
      "initialization_options": {
        "clangd": {
          "completion": {
            "detailedLabel": true
          },
          "diagnostics": {
            "onOpen": true,
            "onSave": true
          },
          "highlight": {
            "lsRanges": true
          },
          "hover": {
            "contentFormat": ["markdown", "plaintext"]
          },
          "semanticHighlighting": true,
          "workspaceSymbol": {
            "sort": true
          },
          "codeLens": {
            "localVariables": true
          },
          "foldingRange": {
            "rangeLimit": 5000
          },
          "selectionRange": true,
          "semanticTokens": {
            "enabled": true,
            "legend": {
              "tokenTypes": [
                "namespace",
                "type",
                "class",
                "enum",
                "interface",
                "struct",
                "typeParameter",
                "parameter",
                "variable",
                "property",
                "enumMember",
                "event",
                "function",
                "method",
                "macro",
                "keyword",
                "modifier",
                "comment",
                "string",
                "number",
                "regexp",
                "operator"
              ],
              "tokenModifiers": [
                "declaration",
                "definition",
                "readonly",
                "static",
                "deprecated",
                "abstract",
                "async",
                "modification",
                "documentation",
                "defaultLibrary"
              ]
            }
          }
        },
        "show_diagnostics": true,
        "show_hover": true,
        "show_references": true,
        "show_definition": true,
        "show_document_symbols": true,
        "show_workspace_symbols": true,
        "show_code_actions": true,
        "show_code_lens": true,
        "show_formatting": true,
        "show_rename": true,
        "show_signature_help": true,
        "show_type_hierarchy": true,
        "show_semantic_tokens": true,
        "show_semantic_highlighting": true,
        "show_semantic_tokens_legend": true,
        "show_semantic_tokens_legend_hover": true,
        "show_semantic_tokens_hover": true,
        "show_semantic_tokens_decorations": true,
        "show_semantic_tokens_decorations_hover": true,
        "show_semantic_tokens_decorations_sticky": true,
        "show_semantic_tokens_decorations_sticky_hover": true,
        "show_semantic_tokens_decorations_sticky_stickiness": 1
      },
      "rust-analyzer": {
        "initialization_options": {
          "checkOnSave": {
            "command": "clippy"
          }
        }
      }
    }
  }
}

xbz-24 avatar Apr 02 '24 04:04 xbz-24

image

please take a look at what zed editor c++ error clang is describing, I just have a VkScene but zed editor c++ support is too stupid to understand think is part of the std namespace

please let me know what you think of this.

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is the command being used please let me know what you think

➜ build-debug git:(osx) ✗ sudo rm -rf ./* && cmake .. -DCMAKE_TOOLCHAIN_FILE=/Users/xbz/.clion-vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-osx -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

sudo rm ./* to remove the contents inside this dir without having to create the directory again, cmake with the flag of make tool chian file with the route to my vcpkg toolchain (I am using the clion one since that is the one that has most of my packages) triplet target is my architecture and os.

Again, please let me know what you think about this.

xbz-24 avatar Apr 02 '24 04:04 xbz-24

# CMakeLists.txt

cmake_minimum_required(VERSION 3.25)
project(Vk-Render LANGUAGES CXX)
enable_testing()
include(cmake/platform_config.cmake)
include(cmake/compiler_options.cmake)
include(cmake/find_dependencies.cmake)
include(cmake/find_vulkan.cmake)
include(FindPkgConfig)
include(cmake/find_glfw3.cmake)
include(cmake/find_glm.cmake)
include(cmake/find_fmt.cmake)
include(cmake/find_spdlog.cmake)
include(cmake/find_imgui.cmake)
include(cmake/find_gtest.cmake)
set(CMAKE_EXPORT_COMPILE_COMMANDS)
set(GLFW_BUILD_STATIC_LIBS ON)
include(cmake/targets_config.cmake)

this is the contents of my cmakelists.txt

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is my compiler_options.cmake

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
        add_compile_options(-fsanitize=address -fno-omit-frame-pointer -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wmisleading-indentation -Wnull-dereference -Wdouble-promotion -Wformat=2 -Werror -Wfloat-equal -Wredundant-decls -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-parameter -Wunreachable-code -Wstrict-overflow=5 -Winline -Werror=return-type -Werror=uninitialized -Wold-style-cast -Wlogical-not-parentheses -Wnull-dereference -Wdangling-else -Wmissing-declarations -Wextra-semi -Wimplicit-fallthrough -Wdisabled-optimization -Wctor-dtor-privacy -Wsign-promo -Winit-self -Wdelete-non-virtual-dtor -Wzero-as-null-pointer-constant -Wdeprecated -Wformat-security -Wmissing-noreturn -Wstrict-null-sentinel -Warray-bounds -Wattribute-warning -Wstrict-aliasing=2)
        add_link_options(-fsanitize=address)
    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
        add_compile_options(-fsanitize=address -Weverything -Werror -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-switch-enum -Wno-weak-vtables -Wno-float-equal -Wno-covered-switch-default -Wno-unused-macros -Wno-newline-eof -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-double-promotion -Wno-disabled-macro-expansion -Wno-float-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-unknown-warning-option -Wno-shadow -Wno-unused-parameter -Wno-unused-lambda-capture -Wno-reserved-id-macro -Wno-implicit-int-float-conversion -Wno-extra-semi-stmt -Wno-reserved-id-macro -Wno-ctad-maybe-unsupported -Wno-nested-anon-types)
        add_link_options(-fsanitize=address)
    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
        add_compile_options(/W4 /WX /std:c++20 /analyze)
    endif()
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
    # No flags in release.
endif()

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is find_dependencies.cmake

find_package(Vulkan QUIET)
find_package(glfw3 QUIET)
find_package(glm CONFIG QUIET)
find_package(fmt REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
find_package(unofficial-vulkan-memory-allocator-hpp CONFIG REQUIRED)
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
find_package(GTest CONFIG REQUIRED)

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is the contents of find_fmt.cmake

if(NOT FMT_FOUND)
    pkg_check_modules(FMT fmt)
    message(STATUS "Using FMT found by pkg-config")
    include_directories(${FMT_INCLUDE_DIRS})
else()
    message(STATUS "Using FMT found by find_package")
endif()

find_glfw.cmake

if(NOT GLFW3_FOUND AND UNIX)
    pkg_check_modules(GLFW REQUIRED glfw3)
    message(STATUS "Using GLFW found by pkg-config")
    include_directories(${GLFW_INCLUDE_DIRS})
    link_directories(${GLFW_LIBRARY_DIRS})
    set(GLFW_LIBS ${GLFW_LIBRARIES})
else()
    message(STATUS "Using GLFW found by find_package")
    set(GLFW_LIBS glfw)
endif()

find_glm.cmake

if(NOT GLM_FOUND AND NOT WIN32)
    pkg_check_modules(GLM glm)
    message(STATUS "Using GLM found by pkg-config")
    include_directories(${GLM_INCLUDE_DIRS})
else()
    message(STATUS "Using GLM found by find_package")
endif()

find_gtest.cmake

if(NOT GTEST_FOUND)
    pkg_check_modules(gtest gtest)
    message(STATUS "Using gtest found by pkg-config")
    include_directories(${GTEST_INCLUDE_DIRS})
    link_directories(${GTEST_LIBRARY_DIRS})
    add_definitions(${GTEST_CFLAGS_OTHER})
else()
    message(STATUS "Using gtest found by find_package")
endif()

find_spdlog.cmake

if(NOT SPDLOG_FOUND)
    pkg_check_modules(SPDLOG spdlog)
    message(STATUS "Using SPDLOG found by pkg-config")
    include_directories(${SPDLOG_INCLUDE_DIRS})
else()
    message(STATUS "Using SPDLOG found by find_package")
endif()

find_vulkan.cmake

if(Vulkan_FOUND)
    message(STATUS "Using Vulkan found by find_package")
    include_directories(${Vulkan_INCLUDE_DIRS})
    set(VULKAN_LIBS ${Vulkan_LIBRARIES})
else()
    if(UNIX)
        find_package(PkgConfig REQUIRED)
        pkg_check_modules(VULKAN REQUIRED vulkan)
        message(STATUS "Using Vulkan found by pkg-config")
        include_directories(${VULKAN_INCLUDE_DIRS})
        link_directories(${VULKAN_LIBRARY_DIRS})
        set(VULKAN_LIBS ${VULKAN_LIBRARIES})
    else()
        message(FATAL_ERROR "Vulkan not found and pkg-config is not available on Windows")
    endif()
endif()

platform_config.cmake

# C++23 standard.
set(CMAKE_CXX_STANDARD 23)

# platform specific configurations.
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(VCPKG_TARGET_TRIPLET "arm64-osx")
# /Users/xbz/.clion-vcpkg/vcpkg
set(CMAKE_TOOLCHAIN_FILE "Users/xbz/.clion-vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake")

if(NOT DEFINED ENV{VCPKG_INSTALLATION_ROOT})
    set(ENV{VCPKG_INSTALLATION_ROOT} "$ENV{HOME}/.clion-vcpkg/vcpkg")
endif()

targets_config.cmake

add_executable(
        main
        src/main.cpp
        src/engine.cpp
        inc/engine.hpp
        inc/instance.hpp
        inc/config.hpp
        inc/logging.hpp
        src/instance.cpp
        src/device.cpp
        inc/device.hpp
        src/swapchain.cpp
        inc/swapchain.hpp
        src/queue_families.cpp
        inc/queue_families.hpp
        inc/frame.hpp
        src/shaders.cpp
        inc/shaders.hpp
        src/pipeline.cpp
        inc/pipeline.hpp
        src/framebuffer.cpp
        inc/framebuffer.hpp
        src/commands.cpp
        inc/commands.hpp
        src/sync.cpp
        inc/sync.hpp
        src/app.cpp
        inc/app.hpp
        inc/render_structs.hpp
        src/scene.cpp
        inc/scene.hpp
        src/mesh.cpp
        inc/mesh.hpp
        src/memory.cpp
        inc/memory.hpp
        src/triangle_mesh.cpp
        inc/triangle_mesh.hpp
        src/logging.cpp
        src/quad_mesh.cpp
        inc/quad_mesh.hpp
        inc/cube_mesh.hpp
        src/vma.cpp
        inc/vma.hpp
        src/device_check.cpp
        inc/device_check.hpp
        inc/logger.hpp
        src/logger.cpp
        inc/engine_config.hpp
        src/app.cpp
        inc/exceptions.hpp
        inc/exceptions.hpp
        inc/cube_mesh.hpp
        src/cube_mesh.cpp
        inc/app_factory.hpp
        inc/app_builder.hpp
        inc/app_builder.hpp)

target_link_libraries(
        main unofficial::VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp
        ${COCOA_LIBRARY}
        ${IOKIT_LIBRARY}
        ${CORE_FOUNDATION_FRAMEWORK}
        ${VULKAN_LIBS}
        ${GLFW_LIBS}
        glm::glm
        fmt::fmt
        spdlog::spdlog
        imgui::imgui
        GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main
)

target_include_directories(
        main PRIVATE inc
        ${glfw3_INCLUDE_DIRS}
)

xbz-24 avatar Apr 02 '24 04:04 xbz-24

this is the contents of my vcpkg.json since I am using vcpkg as my package manager for cmake, in cmake I am only using find_package is my default and using pck-config as a fallback option

this is the contents:

{
  "name" : "vk-render",
  "version-string" : "1.0.0",
  "builtin-baseline" : "be9eb6694585a8db137872b29fcad3619a5f893a",
  "dependencies" : [ {
    "name" : "pkgconf",
    "version>=" : "2.1.0"
  }, {
    "name" : "glfw3",
    "version>=" : "3.4",
    "$comment" : "  # this is heuristically generated, and may not be correct\n\n  find_package(glfw3 CONFIG REQUIRED)\n\n  target_link_libraries(main PRIVATE glfw)\n"
  }, {
    "name" : "fmt",
    "version>=" : "10.2.1#1",
    "$comment" : "    find_package(fmt CONFIG REQUIRED)\n\n    target_link_libraries(main PRIVATE fmt::fmt)\n"
  }, {
    "name" : "vulkan-memory-allocator",
    "version>=" : "3.0.1#4"
  }, {
    "name" : "vulkan-memory-allocator-hpp",
    "version>=" : "3.0.1.1",
    "$comment" : "  # this is heuristically generated, and may not be correct\n\n  find_package(unofficial-vulkan-memory-allocator-hpp CONFIG REQUIRED)\n\n  target_link_libraries(main PRIVATE unofficial::VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp)\n"
  }, {
    "name" : "glm",
    "version>=" : "1.0.1#1",
    "$comment" : "    find_package(glm CONFIG REQUIRED)\n\n    target_link_libraries(main PRIVATE glm::glm)\n"
  }, {
    "name" : "imgui",
    "version>=" : "1.90.2",
    "$comment" : "  # this is heuristically generated, and may not be correct\n\n  find_package(imgui CONFIG REQUIRED)\n\n  target_link_libraries(main PRIVATE imgui::imgui)\n"
  }, {
    "name" : "spdlog",
    "version>=" : "1.13.0"
  }, {
    "name" : "gtest",
    "version>=" : "1.14.0"
  } ]
}

xbz-24 avatar Apr 02 '24 04:04 xbz-24

image

also I just wanted to point out that this editor has no cmake syntax support whatsoever, I think c++ development is discarded entirely for this zed editor project?

Please let me know what you think.

xbz-24 avatar Apr 02 '24 04:04 xbz-24

I have compile_command.json but c++ development doesnt work for me in zed editor.

compile_commands.json needs to be either at the top of your worktree or in a top-level folder called build IIRC.

Anyway, check language server logs to see what flags clangd is using and comparethem to 1. what you expect to see 2. what is actually listed in compile_commands.json

jansol avatar Apr 02 '24 09:04 jansol

image

I just do it like this, I have a .clangd file with a parameter for passing the path to compile_commands.json

this is easier for me because in cmake I can just set the flag for outputting the compile_commands.json

what do I need to check? language server logs?

xbz-24 avatar Apr 02 '24 09:04 xbz-24

please let me know if zed has c++ syntax support or no

xbz-24 avatar Apr 02 '24 09:04 xbz-24

please let me know if zed has c++ syntax support or no

It does have C++ syntax highlighting support, it's even visibly working in your earlier screenshots.

Yes, you'll have to check the language server logs.

Also note that there are some issues if your compiler has different default flags than the clang version that your clangd is based on.

jansol avatar Apr 02 '24 10:04 jansol

please let me know if zed has c++ syntax support or no

It does have C++ syntax highlighting support, it's even visibly working in your earlier screenshots.

Yes, you'll have to check the language server logs.

Also note that there are some issues if your compiler has different default flags than the clang version that your clangd is based on.

help me how to fix this

xbz-24 avatar Apr 02 '24 10:04 xbz-24

using cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 to generate compile_commands.json, and everything works well for me.

gaxxx avatar Apr 22 '24 06:04 gaxxx

Closing this issue since several ways of fixing the problem were presented.

juanbono avatar Apr 25 '24 01:04 juanbono

maybe I can indicate c++20 standard for compile_commands but what about spdlog?

my project is running fine but I am getting clangd warnings that spdlog is not included?

how to indicate that in zed, like std=c++20

yazaldefilimone avatar May 11 '24 11:05 yazaldefilimone