diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt index 42e1a88ff..ce3bc0562 100644 --- a/src/xrt/compositor/CMakeLists.txt +++ b/src/xrt/compositor/CMakeLists.txt @@ -17,6 +17,13 @@ spirv_shaders(SHADER_HEADERS set(CLIENT_SOURCE_FILES) +set(UTIL_SOURCE_FILES + util/comp_swapchain.h + util/comp_swapchain.c + util/comp_sync.h + util/comp_sync.c + ) + set(MAIN_SOURCE_FILES main/comp_compositor.c main/comp_compositor.h @@ -25,8 +32,6 @@ set(MAIN_SOURCE_FILES main/comp_renderer.h main/comp_settings.c main/comp_settings.h - main/comp_swapchain.c - main/comp_sync.c main/comp_target.h main/comp_target_swapchain.c main/comp_target_swapchain.h @@ -113,6 +118,17 @@ if(XRT_HAVE_OPENGL AND XRT_HAVE_XLIB) endif() +## +# Util library +# + +if(XRT_HAVE_VULKAN) + add_library(comp_util STATIC ${UTIL_SOURCE_FILES}) + target_link_libraries(comp_util PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk) + target_include_directories(comp_util PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + + ## # Main library # @@ -208,7 +224,7 @@ if(XRT_FEATURE_COMPOSITOR_MAIN) endif() add_library(comp_main STATIC ${SHADER_HEADERS} ${MAIN_SOURCE_FILES}) - target_link_libraries(comp_main PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk) + target_link_libraries(comp_main PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk comp_util) target_include_directories(comp_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(comp_main SYSTEM PRIVATE # Shaders - marked SYSTEM so we get no warnings diff --git a/src/xrt/compositor/main/comp_compositor.h b/src/xrt/compositor/main/comp_compositor.h index 2fa9eb039..fe248c4ed 100644 --- a/src/xrt/compositor/main/comp_compositor.h +++ b/src/xrt/compositor/main/comp_compositor.h @@ -19,15 +19,16 @@ #include "vk/vk_image_allocator.h" -#include "main/comp_sync.h" -#include "main/comp_settings.h" -#include "main/comp_swapchain.h" -#include "main/comp_window.h" -#include "main/comp_renderer.h" -#include "main/comp_target.h" +#include "util/comp_sync.h" +#include "util/comp_swapchain.h" #include "render/comp_render.h" +#include "main/comp_target.h" +#include "main/comp_window.h" +#include "main/comp_settings.h" +#include "main/comp_renderer.h" + #ifdef __cplusplus extern "C" { diff --git a/src/xrt/compositor/meson.build b/src/xrt/compositor/meson.build index cf6198520..95e9b8e1d 100644 --- a/src/xrt/compositor/meson.build +++ b/src/xrt/compositor/meson.build @@ -20,8 +20,6 @@ compositor_srcs = [ 'main/comp_renderer.h', 'main/comp_settings.c', 'main/comp_settings.h', - 'main/comp_swapchain.c', - 'main/comp_sync.c', 'main/comp_target.h', 'main/comp_target_swapchain.c', 'main/comp_target_swapchain.h', @@ -39,6 +37,10 @@ compositor_srcs = [ 'render/comp_resources.c', 'render/comp_shaders.c', 'render/comp_util.c', + 'util/comp_swapchain.h', + 'util/comp_swapchain.c', + 'util/comp_sync.h', + 'util/comp_sync.c', ] compile_args = [] diff --git a/src/xrt/compositor/main/comp_swapchain.c b/src/xrt/compositor/util/comp_swapchain.c similarity index 99% rename from src/xrt/compositor/main/comp_swapchain.c rename to src/xrt/compositor/util/comp_swapchain.c index 8e977a472..8f8cbdf64 100644 --- a/src/xrt/compositor/main/comp_swapchain.c +++ b/src/xrt/compositor/util/comp_swapchain.c @@ -13,7 +13,7 @@ #include "util/u_misc.h" #include "util/u_handles.h" -#include "main/comp_swapchain.h" +#include "util/comp_swapchain.h" #include #include diff --git a/src/xrt/compositor/main/comp_swapchain.h b/src/xrt/compositor/util/comp_swapchain.h similarity index 100% rename from src/xrt/compositor/main/comp_swapchain.h rename to src/xrt/compositor/util/comp_swapchain.h diff --git a/src/xrt/compositor/main/comp_sync.c b/src/xrt/compositor/util/comp_sync.c similarity index 98% rename from src/xrt/compositor/main/comp_sync.c rename to src/xrt/compositor/util/comp_sync.c index 1f40d82c5..d6876a6d7 100644 --- a/src/xrt/compositor/main/comp_sync.c +++ b/src/xrt/compositor/util/comp_sync.c @@ -9,12 +9,12 @@ #include "xrt/xrt_config_os.h" -#include "main/comp_sync.h" - #include "util/u_misc.h" #include "util/u_handles.h" #include "util/u_trace_marker.h" +#include "util/comp_sync.h" + #include #include diff --git a/src/xrt/compositor/main/comp_sync.h b/src/xrt/compositor/util/comp_sync.h similarity index 100% rename from src/xrt/compositor/main/comp_sync.h rename to src/xrt/compositor/util/comp_sync.h