From a742434f1e4b2fb4438d77292ab8537261f88925 Mon Sep 17 00:00:00 2001 From: Karen Webb Date: Wed, 13 Nov 2024 23:25:46 +0000 Subject: [PATCH] Build library sources directly --- CMakeLists.txt | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4e279f..4a4b265 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,20 +47,17 @@ function(add_shader_target target) add_custom_target(${target} DEPENDS ${all_binaries}) endfunction() -add_library(ImGui STATIC - ${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui_demo.cpp ${imgui_SOURCE_DIR}/imgui_draw.cpp ${imgui_SOURCE_DIR}/imgui_tables.cpp ${imgui_SOURCE_DIR}/imgui_widgets.cpp +set(ImGuiSources ${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui_demo.cpp ${imgui_SOURCE_DIR}/imgui_draw.cpp ${imgui_SOURCE_DIR}/imgui_tables.cpp ${imgui_SOURCE_DIR}/imgui_widgets.cpp ${imgui_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp) -target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR}) -target_compile_definitions(ImGui PRIVATE VK_NO_PROTOTYPES) -add_library(WaylandLib) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml BASENAME xdg-shell) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/stable/viewporter/viewporter.xml BASENAME viewporter) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/staging/content-type/content-type-v1.xml BASENAME content-type) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/staging/cursor-shape/cursor-shape-v1.xml BASENAME cursor-shape) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/staging/fractional-scale/fractional-scale-v1.xml BASENAME fractional-scale) -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/unstable/tablet/tablet-unstable-v2.xml BASENAME tablet) # dependency of cursor-shape -ecm_add_wayland_client_protocol(WaylandLib PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml BASENAME xdg-decoration) +set(WaylandProtocolSources "") +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml BASENAME xdg-shell) +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/stable/viewporter/viewporter.xml BASENAME viewporter) +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/staging/content-type/content-type-v1.xml BASENAME content-type) +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/staging/cursor-shape/cursor-shape-v1.xml BASENAME cursor-shape) +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/staging/fractional-scale/fractional-scale-v1.xml BASENAME fractional-scale) +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/unstable/tablet/tablet-unstable-v2.xml BASENAME tablet) # dependency of cursor-shape +ecm_add_wayland_client_protocol(WaylandProtocolSources PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml BASENAME xdg-decoration) add_executable(wayland_example main.cpp MainWindow.cpp MappedFd.cpp vk_mem_alloc.cpp volk.c vulkan/Common.cpp vulkan/Renderer.cpp vulkan/RendererBase.cpp vulkan/Swapchain.cpp vulkan/SwapchainBase.cpp @@ -68,11 +65,12 @@ add_executable(wayland_example main.cpp MainWindow.cpp MappedFd.cpp vk_mem_alloc wayland/cursor/CursorBase.cpp wayland/cursor/CursorManagerBase.cpp wayland/cursor/shape/ShapeCursor.cpp wayland/cursor/shape/ShapeCursorManager.cpp wayland/cursor/theme/ThemeCursor.cpp wayland/cursor/theme/ThemeCursorManager.cpp + ${ImGuiSources} ${WaylandProtocolSources} ) set_target_properties(wayland_example PROPERTIES CXX_STANDARD 23) target_compile_definitions(wayland_example PRIVATE GLM_FORCE_LEFT_HANDED VK_NO_PROTOTYPES VK_USE_PLATFORM_WAYLAND_KHR) -target_include_directories(wayland_example PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(wayland_example ImGui WaylandLib PkgConfig::XKB Wayland::Client Wayland::Cursor) +target_include_directories(wayland_example PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${imgui_SOURCE_DIR}) +target_link_libraries(wayland_example PkgConfig::XKB Wayland::Client Wayland::Cursor) add_shader_target(all_shaders main.frag main.vert) add_dependencies(wayland_example all_shaders)