From 0ea08dd110582028391dc41006c7969b7956e412 Mon Sep 17 00:00:00 2001 From: IAmNotHanni Date: Thu, 16 Oct 2025 17:51:17 +0200 Subject: [PATCH 1/4] [*] Move wrapper code for descriptors into subfolder --- include/inexor/vulkan-renderer/imgui.hpp | 4 ++-- include/inexor/vulkan-renderer/renderer.hpp | 2 +- .../wrapper/{ => descriptors}/descriptor.hpp | 6 ++++-- .../wrapper/{ => descriptors}/descriptor_builder.hpp | 9 ++++++--- src/CMakeLists.txt | 5 +++-- src/vulkan-renderer/application.cpp | 4 ++-- src/vulkan-renderer/imgui.cpp | 6 +++--- .../wrapper/{ => descriptors}/descriptor.cpp | 6 +++--- .../wrapper/{ => descriptors}/descriptor_builder.cpp | 8 ++++---- 9 files changed, 28 insertions(+), 22 deletions(-) rename include/inexor/vulkan-renderer/wrapper/{ => descriptors}/descriptor.hpp (93%) rename include/inexor/vulkan-renderer/wrapper/{ => descriptors}/descriptor_builder.hpp (96%) rename src/vulkan-renderer/wrapper/{ => descriptors}/descriptor.cpp (95%) rename src/vulkan-renderer/wrapper/{ => descriptors}/descriptor_builder.cpp (87%) diff --git a/include/inexor/vulkan-renderer/imgui.hpp b/include/inexor/vulkan-renderer/imgui.hpp index 0ec531814..5fb6da75c 100644 --- a/include/inexor/vulkan-renderer/imgui.hpp +++ b/include/inexor/vulkan-renderer/imgui.hpp @@ -1,7 +1,7 @@ #pragma once #include "inexor/vulkan-renderer/render_graph.hpp" -#include "inexor/vulkan-renderer/wrapper/descriptor.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp" #include "inexor/vulkan-renderer/wrapper/gpu_texture.hpp" #include "inexor/vulkan-renderer/wrapper/shader.hpp" @@ -32,7 +32,7 @@ class ImGUIOverlay { std::unique_ptr m_imgui_texture; std::unique_ptr m_vertex_shader; std::unique_ptr m_fragment_shader; - std::unique_ptr m_descriptor; + std::unique_ptr m_descriptor; std::vector m_index_data; std::vector m_vertex_data; diff --git a/include/inexor/vulkan-renderer/renderer.hpp b/include/inexor/vulkan-renderer/renderer.hpp index 3067e4d66..63d9e0193 100644 --- a/include/inexor/vulkan-renderer/renderer.hpp +++ b/include/inexor/vulkan-renderer/renderer.hpp @@ -48,7 +48,7 @@ class VulkanRenderer { std::vector m_shaders; std::vector m_textures; std::vector m_uniform_buffers; - std::vector m_descriptors; + std::vector m_descriptors; std::vector m_octree_vertices; std::vector m_octree_indices; diff --git a/include/inexor/vulkan-renderer/wrapper/descriptor.hpp b/include/inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp similarity index 93% rename from include/inexor/vulkan-renderer/wrapper/descriptor.hpp rename to include/inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp index 2dff130c9..3bbc45d02 100644 --- a/include/inexor/vulkan-renderer/wrapper/descriptor.hpp +++ b/include/inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp @@ -6,9 +6,11 @@ #include namespace inexor::vulkan_renderer::wrapper { - // Forward declaration class Device; +} // namespace inexor::vulkan_renderer::wrapper + +namespace inexor::vulkan_renderer::wrapper::descriptors { /// @brief RAII wrapper class for resource descriptors. class ResourceDescriptor { @@ -49,4 +51,4 @@ class ResourceDescriptor { } }; -} // namespace inexor::vulkan_renderer::wrapper +} // namespace inexor::vulkan_renderer::wrapper::descriptors diff --git a/include/inexor/vulkan-renderer/wrapper/descriptor_builder.hpp b/include/inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp similarity index 96% rename from include/inexor/vulkan-renderer/wrapper/descriptor_builder.hpp rename to include/inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp index c0b53f034..ac886dfbb 100644 --- a/include/inexor/vulkan-renderer/wrapper/descriptor_builder.hpp +++ b/include/inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp @@ -10,9 +10,12 @@ #include namespace inexor::vulkan_renderer::wrapper { - -// Forward declarations +// Forward declaration class Device; +} // namespace inexor::vulkan_renderer::wrapper + +namespace inexor::vulkan_renderer::wrapper::descriptors { + class ResourceDescriptor; class DescriptorBuilder { @@ -96,4 +99,4 @@ DescriptorBuilder &DescriptorBuilder::add_uniform_buffer(const VkBuffer uniform_ return *this; } -} // namespace inexor::vulkan_renderer::wrapper +} // namespace inexor::vulkan_renderer::wrapper::descriptors diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 127c80949..d5d884abf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,6 @@ set(INEXOR_SOURCE_FILES vulkan-renderer/tools/representation.cpp vulkan-renderer/wrapper/cpu_texture.cpp - vulkan-renderer/wrapper/descriptor.cpp - vulkan-renderer/wrapper/descriptor_builder.cpp vulkan-renderer/wrapper/device.cpp vulkan-renderer/wrapper/framebuffer.cpp vulkan-renderer/wrapper/gpu_memory_buffer.cpp @@ -38,6 +36,9 @@ set(INEXOR_SOURCE_FILES vulkan-renderer/wrapper/commands/command_buffer.cpp vulkan-renderer/wrapper/commands/command_pool.cpp + vulkan-renderer/wrapper/descriptors/descriptor.cpp + vulkan-renderer/wrapper/descriptors/descriptor_builder.cpp + vulkan-renderer/wrapper/window/window.cpp vulkan-renderer/wrapper/window/surface.cpp diff --git a/src/vulkan-renderer/application.cpp b/src/vulkan-renderer/application.cpp index 157f681f3..fb2fc6437 100644 --- a/src/vulkan-renderer/application.cpp +++ b/src/vulkan-renderer/application.cpp @@ -9,7 +9,7 @@ #include "inexor/vulkan-renderer/tools/enumerate.hpp" #include "inexor/vulkan-renderer/world/collision.hpp" #include "inexor/vulkan-renderer/wrapper/cpu_texture.hpp" -#include "inexor/vulkan-renderer/wrapper/descriptor_builder.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp" #include "inexor/vulkan-renderer/wrapper/instance.hpp" #include @@ -451,7 +451,7 @@ Application::Application(int argc, char **argv) { // Create an instance of the resource descriptor builder. // This allows us to make resource descriptors with the help of a builder pattern. - wrapper::DescriptorBuilder descriptor_builder(*m_device); + wrapper::descriptors::DescriptorBuilder descriptor_builder(*m_device); // Make use of the builder to create a resource descriptor for the uniform buffer. m_descriptors.emplace_back( diff --git a/src/vulkan-renderer/imgui.cpp b/src/vulkan-renderer/imgui.cpp index 01d786397..4981c1784 100644 --- a/src/vulkan-renderer/imgui.cpp +++ b/src/vulkan-renderer/imgui.cpp @@ -1,7 +1,7 @@ #include "inexor/vulkan-renderer/imgui.hpp" #include "inexor/vulkan-renderer/wrapper/cpu_texture.hpp" -#include "inexor/vulkan-renderer/wrapper/descriptor_builder.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp" #include "inexor/vulkan-renderer/wrapper/make_info.hpp" #include @@ -78,10 +78,10 @@ ImGUIOverlay::ImGUIOverlay(const wrapper::Device &device, const wrapper::Swapcha // Create an instance of the resource descriptor builder. // This allows us to make resource descriptors with the help of a builder pattern. - wrapper::DescriptorBuilder descriptor_builder(m_device); + wrapper::descriptors::DescriptorBuilder descriptor_builder(m_device); // Make use of the builder to create a resource descriptor for the combined image sampler. - m_descriptor = std::make_unique( + m_descriptor = std::make_unique( descriptor_builder.add_combined_image_sampler(m_imgui_texture->sampler(), m_imgui_texture->image_view(), 0) .build("ImGUI")); diff --git a/src/vulkan-renderer/wrapper/descriptor.cpp b/src/vulkan-renderer/wrapper/descriptors/descriptor.cpp similarity index 95% rename from src/vulkan-renderer/wrapper/descriptor.cpp rename to src/vulkan-renderer/wrapper/descriptors/descriptor.cpp index 4bbcd0349..4fc50b834 100644 --- a/src/vulkan-renderer/wrapper/descriptor.cpp +++ b/src/vulkan-renderer/wrapper/descriptors/descriptor.cpp @@ -1,4 +1,4 @@ -#include "inexor/vulkan-renderer/wrapper/descriptor.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp" #include "inexor/vulkan-renderer/exception.hpp" #include "inexor/vulkan-renderer/wrapper/device.hpp" @@ -7,7 +7,7 @@ #include #include -namespace inexor::vulkan_renderer::wrapper { +namespace inexor::vulkan_renderer::wrapper::descriptors { ResourceDescriptor::ResourceDescriptor(ResourceDescriptor &&other) noexcept : m_device(other.m_device) { m_name = std::move(other.m_name); @@ -91,4 +91,4 @@ ResourceDescriptor::~ResourceDescriptor() { vkDestroyDescriptorPool(m_device.device(), m_descriptor_pool, nullptr); } -} // namespace inexor::vulkan_renderer::wrapper +} // namespace inexor::vulkan_renderer::wrapper::descriptors diff --git a/src/vulkan-renderer/wrapper/descriptor_builder.cpp b/src/vulkan-renderer/wrapper/descriptors/descriptor_builder.cpp similarity index 87% rename from src/vulkan-renderer/wrapper/descriptor_builder.cpp rename to src/vulkan-renderer/wrapper/descriptors/descriptor_builder.cpp index 819306047..3ccd0ccf1 100644 --- a/src/vulkan-renderer/wrapper/descriptor_builder.cpp +++ b/src/vulkan-renderer/wrapper/descriptors/descriptor_builder.cpp @@ -1,11 +1,11 @@ -#include "inexor/vulkan-renderer/wrapper/descriptor_builder.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor_builder.hpp" -#include "inexor/vulkan-renderer/wrapper/descriptor.hpp" +#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor.hpp" #include "inexor/vulkan-renderer/wrapper/device.hpp" #include -namespace inexor::vulkan_renderer::wrapper { +namespace inexor::vulkan_renderer::wrapper::descriptors { DescriptorBuilder::DescriptorBuilder(const Device &device) : m_device(device) { assert(m_device.device()); @@ -58,4 +58,4 @@ DescriptorBuilder &DescriptorBuilder::add_combined_image_sampler(const VkSampler return *this; } -} // namespace inexor::vulkan_renderer::wrapper +} // namespace inexor::vulkan_renderer::wrapper::descriptors From ba15e98b49600dabf758b255c3422408e68f70c2 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Sat, 18 Oct 2025 22:36:36 +0200 Subject: [PATCH 2/4] [*] Move camera code to tools folder --- include/inexor/vulkan-renderer/renderer.hpp | 4 ++-- include/inexor/vulkan-renderer/{ => tools}/camera.hpp | 4 ++-- src/CMakeLists.txt | 2 +- src/vulkan-renderer/application.cpp | 4 +++- src/vulkan-renderer/renderer.cpp | 3 ++- src/vulkan-renderer/{ => tools}/camera.cpp | 6 +++--- 6 files changed, 13 insertions(+), 10 deletions(-) rename include/inexor/vulkan-renderer/{ => tools}/camera.hpp (98%) rename src/vulkan-renderer/{ => tools}/camera.cpp (96%) diff --git a/include/inexor/vulkan-renderer/renderer.hpp b/include/inexor/vulkan-renderer/renderer.hpp index 63d9e0193..43ba59c90 100644 --- a/include/inexor/vulkan-renderer/renderer.hpp +++ b/include/inexor/vulkan-renderer/renderer.hpp @@ -1,10 +1,10 @@ #pragma once -#include "inexor/vulkan-renderer/camera.hpp" #include "inexor/vulkan-renderer/fps_counter.hpp" #include "inexor/vulkan-renderer/imgui.hpp" #include "inexor/vulkan-renderer/octree_gpu_vertex.hpp" #include "inexor/vulkan-renderer/time_step.hpp" +#include "inexor/vulkan-renderer/tools/camera.hpp" #include "inexor/vulkan-renderer/wrapper/instance.hpp" #include "inexor/vulkan-renderer/wrapper/uniform_buffer.hpp" #include "inexor/vulkan-renderer/wrapper/window/surface.hpp" @@ -35,7 +35,7 @@ class VulkanRenderer { bool m_vsync_enabled{false}; - std::unique_ptr m_camera; + std::unique_ptr m_camera; std::unique_ptr m_window; std::unique_ptr m_instance; diff --git a/include/inexor/vulkan-renderer/camera.hpp b/include/inexor/vulkan-renderer/tools/camera.hpp similarity index 98% rename from include/inexor/vulkan-renderer/camera.hpp rename to include/inexor/vulkan-renderer/tools/camera.hpp index b3bd93f12..2eb6c0195 100644 --- a/include/inexor/vulkan-renderer/camera.hpp +++ b/include/inexor/vulkan-renderer/tools/camera.hpp @@ -7,7 +7,7 @@ #include #include -namespace inexor::vulkan_renderer { +namespace inexor::vulkan_renderer::tools { namespace directions { /// The default value of the camera's front vector. @@ -225,4 +225,4 @@ class Camera { return m_perspective_matrix; } }; -} // namespace inexor::vulkan_renderer +} // namespace inexor::vulkan_renderer::tools diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5d884abf..1d3b3e870 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,5 @@ set(INEXOR_SOURCE_FILES vulkan-renderer/application.cpp - vulkan-renderer/camera.cpp vulkan-renderer/exception.cpp vulkan-renderer/fps_counter.cpp vulkan-renderer/imgui.cpp @@ -15,6 +14,7 @@ set(INEXOR_SOURCE_FILES vulkan-renderer/io/byte_stream.cpp vulkan-renderer/io/nxoc_parser.cpp + vulkan-renderer/tools/camera.cpp vulkan-renderer/tools/cla_parser.cpp vulkan-renderer/tools/device_info.cpp vulkan-renderer/tools/enumerate.cpp diff --git a/src/vulkan-renderer/application.cpp b/src/vulkan-renderer/application.cpp index fb2fc6437..d52b7fd72 100644 --- a/src/vulkan-renderer/application.cpp +++ b/src/vulkan-renderer/application.cpp @@ -1,10 +1,10 @@ #include "inexor/vulkan-renderer/application.hpp" -#include "inexor/vulkan-renderer/camera.hpp" #include "inexor/vulkan-renderer/exception.hpp" #include "inexor/vulkan-renderer/meta.hpp" #include "inexor/vulkan-renderer/octree_gpu_vertex.hpp" #include "inexor/vulkan-renderer/standard_ubo.hpp" +#include "inexor/vulkan-renderer/tools/camera.hpp" #include "inexor/vulkan-renderer/tools/cla_parser.hpp" #include "inexor/vulkan-renderer/tools/enumerate.hpp" #include "inexor/vulkan-renderer/world/collision.hpp" @@ -526,6 +526,8 @@ void Application::process_input() { auto deadzone_lambda = [](const float state) { return (glm::abs(state) < 0.2f) ? 0.0f : state; }; + using namespace tools; + if (m_camera->type() == CameraType::LOOK_AT && m_input->kbm_data().is_mouse_button_pressed(GLFW_MOUSE_BUTTON_LEFT)) { m_camera->rotate(static_cast(cursor_pos_delta[0]), -static_cast(cursor_pos_delta[1])); diff --git a/src/vulkan-renderer/renderer.cpp b/src/vulkan-renderer/renderer.cpp index 90fab7ca7..96adf37b6 100644 --- a/src/vulkan-renderer/renderer.cpp +++ b/src/vulkan-renderer/renderer.cpp @@ -78,7 +78,8 @@ void VulkanRenderer::recreate_swapchain() { m_render_graph = std::make_unique(*m_device, *m_swapchain); setup_render_graph(); - m_camera = std::make_unique(glm::vec3(6.0f, 10.0f, 2.0f), 180.0f, 0.0f, + m_camera = + std::make_unique(glm::vec3(6.0f, 10.0f, 2.0f), 180.0f, 0.0f, static_cast(m_window->width()), static_cast(m_window->height())); m_camera->set_movement_speed(5.0f); diff --git a/src/vulkan-renderer/camera.cpp b/src/vulkan-renderer/tools/camera.cpp similarity index 96% rename from src/vulkan-renderer/camera.cpp rename to src/vulkan-renderer/tools/camera.cpp index 30fc37a65..92cc88066 100644 --- a/src/vulkan-renderer/camera.cpp +++ b/src/vulkan-renderer/tools/camera.cpp @@ -1,6 +1,6 @@ -#include "inexor/vulkan-renderer/camera.hpp" +#include "inexor/vulkan-renderer/tools/camera.hpp" -namespace inexor::vulkan_renderer { +namespace inexor::vulkan_renderer::tools { Camera::Camera(const glm::vec3 &position, const float yaw, const float pitch, const float window_width, const float window_height) @@ -144,4 +144,4 @@ void Camera::update(const float delta_time) { } } -} // namespace inexor::vulkan_renderer +} // namespace inexor::vulkan_renderer::tools From 343e6bba751ae5346e75be229bc803d5885a171a Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Sat, 18 Oct 2025 23:17:01 +0200 Subject: [PATCH 3/4] [meta] Move metadata file into a subfolder --- benchmarks/engine_benchmark_main.cpp | 4 ++-- include/inexor/vulkan-renderer/{ => meta}/meta.hpp.in | 2 +- src/CMakeLists.txt | 4 ++-- src/vulkan-renderer/application.cpp | 9 ++++++--- tests/unit_tests_main.cpp | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) rename include/inexor/vulkan-renderer/{ => meta}/meta.hpp.in (96%) diff --git a/benchmarks/engine_benchmark_main.cpp b/benchmarks/engine_benchmark_main.cpp index d9f26598f..c59de46f0 100644 --- a/benchmarks/engine_benchmark_main.cpp +++ b/benchmarks/engine_benchmark_main.cpp @@ -1,11 +1,11 @@ #include -#include "inexor/vulkan-renderer/meta.hpp" +#include "inexor/vulkan-renderer/meta/meta.hpp" #include int main(int argc, char **argv) { - using namespace inexor::vulkan_renderer; + using namespace inexor::vulkan_renderer::meta; // Print engine and application metadata. std::cout << ENGINE_NAME << ", version " << ENGINE_VERSION_STR << std::endl; diff --git a/include/inexor/vulkan-renderer/meta.hpp.in b/include/inexor/vulkan-renderer/meta/meta.hpp.in similarity index 96% rename from include/inexor/vulkan-renderer/meta.hpp.in rename to include/inexor/vulkan-renderer/meta/meta.hpp.in index af267baff..381bbe3f4 100644 --- a/include/inexor/vulkan-renderer/meta.hpp.in +++ b/include/inexor/vulkan-renderer/meta/meta.hpp.in @@ -2,7 +2,7 @@ #include -namespace inexor::vulkan_renderer { +namespace inexor::vulkan_renderer::meta { /// The following data will be replaced by CMake setup. constexpr const char *APP_NAME{"${INEXOR_APP_NAME}"}; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1d3b3e870..0f851a3c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -101,8 +101,8 @@ endif() # Replace variables in header file with CMake values configure_file( - ${PROJECT_SOURCE_DIR}/include/inexor/vulkan-renderer/meta.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/include/inexor/vulkan-renderer/meta.hpp + ${PROJECT_SOURCE_DIR}/include/inexor/vulkan-renderer/meta/meta.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/include/inexor/vulkan-renderer/meta/meta.hpp ) target_include_directories( diff --git a/src/vulkan-renderer/application.cpp b/src/vulkan-renderer/application.cpp index d52b7fd72..84b629ef1 100644 --- a/src/vulkan-renderer/application.cpp +++ b/src/vulkan-renderer/application.cpp @@ -1,7 +1,7 @@ #include "inexor/vulkan-renderer/application.hpp" #include "inexor/vulkan-renderer/exception.hpp" -#include "inexor/vulkan-renderer/meta.hpp" +#include "inexor/vulkan-renderer/meta/meta.hpp" #include "inexor/vulkan-renderer/octree_gpu_vertex.hpp" #include "inexor/vulkan-renderer/standard_ubo.hpp" #include "inexor/vulkan-renderer/tools/camera.hpp" @@ -286,7 +286,7 @@ void Application::initialize_spdlog() { auto console_sink = std::make_shared(); // A copy of the console output will automatically be saved to a logfile - auto file_sink = std::make_shared(std::string(APP_NAME) + ".log", true); + auto file_sink = std::make_shared(std::string(meta::APP_NAME) + ".log", true); auto logger = std::make_shared("main", spdlog::sinks_init_list{console_sink, file_sink}, spdlog::thread_pool(), spdlog::async_overflow_policy::block); @@ -303,6 +303,8 @@ void Application::initialize_spdlog() { Application::Application(int argc, char **argv) { initialize_spdlog(); + using namespace vulkan_renderer::meta; + spdlog::trace("Application version: {}.{}.{}", APP_VERSION[0], APP_VERSION[1], APP_VERSION[2]); spdlog::trace("Engine version: {}.{}.{}", ENGINE_VERSION[0], ENGINE_VERSION[1], ENGINE_VERSION[2]); @@ -492,7 +494,8 @@ void Application::update_imgui_overlay() { ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0); ImGui::SetNextWindowPos(ImVec2(10, 10)); ImGui::SetNextWindowSize(ImVec2(330, 0)); - ImGui::Begin("Inexor Vulkan-renderer", nullptr, + using namespace vulkan_renderer::meta; + ImGui::Begin(APP_NAME, nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove); ImGui::Text("%s", m_device->gpu_name().c_str()); ImGui::Text("Engine version %d.%d.%d (Git sha %s)", ENGINE_VERSION[0], ENGINE_VERSION[1], ENGINE_VERSION[2], diff --git a/tests/unit_tests_main.cpp b/tests/unit_tests_main.cpp index 33c9579dd..6f7d0c478 100644 --- a/tests/unit_tests_main.cpp +++ b/tests/unit_tests_main.cpp @@ -1,11 +1,11 @@ #include -#include "inexor/vulkan-renderer/meta.hpp" +#include "inexor/vulkan-renderer/meta/meta.hpp" #include int main(int argc, char **argv) { - using namespace inexor::vulkan_renderer; + using namespace inexor::vulkan_renderer::meta; // Print engine and application metadata. std::cout << ENGINE_NAME << ", version " << ENGINE_VERSION_STR << std::endl; From 51b698aa379834b641157a33d6c0cd06bb7b3536 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Sun, 19 Oct 2025 00:01:21 +0200 Subject: [PATCH 4/4] [cmake] Show dependencies in Visual Studio in a separate folder filter --- benchmarks/CMakeLists.txt | 19 +++++++++++++++++++ src/CMakeLists.txt | 29 +++++++++++++++++++++++++++++ tests/CMakeLists.txt | 16 ++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index e66f09922..6cc7f66df 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -34,3 +34,22 @@ target_link_libraries( PUBLIC benchmark::benchmark ) + +if(MSVC) + # Group dependencies in Visual Studio + set(THIRD_PARTY_TARGETS + benchmark + benchmark_main + # Note that benchmark requires gtest + gmock + gmock_main + gtest + gtest_main + ) + # Move all dependencies into a subfolder + set_target_properties(${THIRD_PARTY_TARGETS} + PROPERTIES + EXCLUDE_FROM_ALL TRUE + FOLDER "Dependencies" + ) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f851a3c6..f2f94bd90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -145,3 +145,32 @@ target_link_libraries(inexor-vulkan-renderer volk::volk Vulkan::Headers VulkanMemoryAllocator) + +if(MSVC) + # Group dependencies in Visual Studio + set(THIRD_PARTY_TARGETS + glfw + fmt + glm + imgui + spdlog + volk + VulkanMemoryAllocator + tinygltf + toml11 + # Also those extra ones + loader_example + uninstall + update_mappings + Continuous + Experimental + Nightly + NightlyMemoryCheck + ) + # Move all dependencies into a subfolder + set_target_properties(${THIRD_PARTY_TARGETS} + PROPERTIES + EXCLUDE_FROM_ALL TRUE + FOLDER "Dependencies" + ) +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 674fa339b..26b7ebfc7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,3 +36,19 @@ target_link_libraries( PUBLIC GTest::gtest ) + +if(MSVC) + # Group dependencies in Visual Studio + set(THIRD_PARTY_TARGETS + gmock + gmock_main + gtest + gtest_main + ) + # Move all dependencies into a subfolder + set_target_properties(${THIRD_PARTY_TARGETS} + PROPERTIES + EXCLUDE_FROM_ALL TRUE + FOLDER "Dependencies" + ) +endif()