Skip to content

Commit

Permalink
Build library sources directly
Browse files Browse the repository at this point in the history
  • Loading branch information
HildarTheDorf committed Nov 13, 2024
1 parent 042ef3a commit a742434
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,30 @@ 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
wayland/Display.cpp wayland/Keyboard.cpp wayland/Pointer.cpp wayland/Seat.cpp wayland/Window.cpp
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)

0 comments on commit a742434

Please sign in to comment.