c/util: Break out swapchain and sync into own library

This commit is contained in:
Jakob Bornecrantz 2021-11-03 17:06:46 +00:00
parent 78936d2b4e
commit 029031cfd3
7 changed files with 33 additions and 14 deletions

View file

@ -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

View file

@ -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" {

View file

@ -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 = []

View file

@ -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 <stdio.h>
#include <stdlib.h>

View file

@ -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 <stdio.h>
#include <stdlib.h>