2020-03-01 12:17:15 +00:00
|
|
|
# Copyright 2019-2020, Collabora, Ltd.
|
2019-03-18 05:52:32 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
|
|
|
spirv_shaders(SHADER_HEADERS
|
|
|
|
shaders/distortion.vert
|
2019-10-07 23:12:06 +00:00
|
|
|
shaders/mesh.frag
|
|
|
|
shaders/mesh.vert
|
2019-03-18 05:52:32 +00:00
|
|
|
shaders/none.frag
|
|
|
|
shaders/panotools.frag
|
|
|
|
shaders/vive.frag
|
|
|
|
)
|
|
|
|
|
2020-03-02 11:57:19 +00:00
|
|
|
set(CLIENT_SOURCE_FILES
|
2019-03-18 05:52:32 +00:00
|
|
|
client/comp_vk_client.c
|
|
|
|
client/comp_vk_client.h
|
2020-03-01 12:17:15 +00:00
|
|
|
client/comp_vk_glue.c
|
2020-03-02 11:57:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(MAIN_SOURCE_FILES
|
2019-03-18 05:52:32 +00:00
|
|
|
main/comp_compositor.c
|
|
|
|
main/comp_compositor.h
|
|
|
|
main/comp_distortion.c
|
|
|
|
main/comp_distortion.h
|
2019-04-06 11:57:34 +00:00
|
|
|
main/comp_documentation.h
|
2019-03-18 05:52:32 +00:00
|
|
|
main/comp_renderer.c
|
|
|
|
main/comp_renderer.h
|
|
|
|
main/comp_settings.c
|
|
|
|
main/comp_settings.h
|
|
|
|
main/comp_swapchain.c
|
2020-02-29 20:47:11 +00:00
|
|
|
main/comp_vk_swapchain.c
|
|
|
|
main/comp_vk_swapchain.h
|
2019-03-18 05:52:32 +00:00
|
|
|
main/comp_window.h
|
|
|
|
)
|
|
|
|
|
2020-03-02 11:57:19 +00:00
|
|
|
include_directories(PRIVATE
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../auxiliary
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(SYSTEM PRIVATE
|
|
|
|
${VULKAN_INCLUDE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
|
|
|
)
|
|
|
|
|
|
|
|
if (${VULKAN_ENABLE_VALIDATION})
|
|
|
|
add_definitions(-DXRT_ENABLE_VK_VALIDATION)
|
2019-12-03 22:33:16 +00:00
|
|
|
endif()
|
2020-03-02 11:57:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
# Client library
|
|
|
|
#
|
|
|
|
|
2019-12-03 22:33:16 +00:00
|
|
|
if(BUILD_WITH_OPENGL)
|
2020-03-02 11:57:19 +00:00
|
|
|
list(APPEND CLIENT_SOURCE_FILES
|
2019-12-03 22:33:16 +00:00
|
|
|
client/comp_gl_client.c
|
|
|
|
client/comp_gl_client.h
|
2020-03-01 12:17:15 +00:00
|
|
|
client/comp_gl_glue.c
|
|
|
|
client/comp_gles_glue.c # TODO separate config for GLES
|
2019-12-03 22:33:16 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(BUILD_WITH_OPENGL AND BUILD_WITH_XLIB)
|
2020-03-02 11:57:19 +00:00
|
|
|
list(APPEND CLIENT_SOURCE_FILES
|
2019-12-03 22:33:16 +00:00
|
|
|
client/comp_gl_xlib_client.c
|
2020-03-01 12:17:15 +00:00
|
|
|
client/comp_gl_xlib_client.h
|
|
|
|
client/comp_gl_xlib_glue.c
|
2019-12-03 22:33:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
if(BUILD_WITH_OPENGL AND BUILD_WITH_EGL)
|
2020-03-02 11:57:19 +00:00
|
|
|
list(APPEND CLIENT_SOURCE_FILES
|
2020-03-01 12:17:15 +00:00
|
|
|
client/comp_egl_glue.c
|
|
|
|
)
|
2019-03-18 05:52:32 +00:00
|
|
|
endif()
|
|
|
|
|
2020-03-02 11:57:19 +00:00
|
|
|
# Use OBJECT to not create a archive, since it just gets in the way.
|
|
|
|
add_library(comp_client OBJECT ${CLIENT_SOURCE_FILES})
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Main library
|
|
|
|
#
|
|
|
|
|
|
|
|
if(BUILD_WITH_XCB)
|
|
|
|
list(APPEND MAIN_SOURCE_FILES
|
|
|
|
main/comp_window_xcb.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(BUILD_WITH_XCB AND BUILD_WITH_XLIB)
|
|
|
|
list(APPEND MAIN_SOURCE_FILES
|
|
|
|
main/comp_window_direct_mode.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-09-20 10:13:43 +00:00
|
|
|
# generate wayland protocols
|
2019-12-03 22:33:16 +00:00
|
|
|
if(BUILD_WITH_WAYLAND)
|
2019-09-20 10:13:43 +00:00
|
|
|
pkg_get_variable(WL_PROTOS_PKG_DIR wayland-protocols pkgdatadir)
|
|
|
|
pkg_get_variable(WL_SCANNER wayland-scanner wayland_scanner)
|
|
|
|
|
|
|
|
set(WL_PROTOS_DIR "${CMAKE_CURRENT_BINARY_DIR}/wayland-protocols/")
|
|
|
|
file(MAKE_DIRECTORY "${WL_PROTOS_DIR}")
|
|
|
|
|
|
|
|
set(WL_PROTOS_XML "${WL_PROTOS_PKG_DIR}/stable/xdg-shell/xdg-shell.xml")
|
|
|
|
set(WL_PROTOS_C "${WL_PROTOS_DIR}/xdg-shell.c")
|
|
|
|
set(WL_PROTOS_H "${WL_PROTOS_DIR}/xdg-shell-client-protocol.h")
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
COMMAND
|
|
|
|
${WL_SCANNER} private-code "${WL_PROTOS_XML}" "${WL_PROTOS_C}"
|
|
|
|
OUTPUT "${WL_PROTOS_C}" VERBATIM)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
COMMAND
|
|
|
|
${WL_SCANNER} client-header "${WL_PROTOS_XML}" "${WL_PROTOS_H}"
|
|
|
|
OUTPUT "${WL_PROTOS_H}" VERBATIM)
|
|
|
|
|
|
|
|
set(WL_PROTOS_SRC ${WL_PROTOS_C} ${WL_PROTOS_H})
|
2020-03-02 11:57:19 +00:00
|
|
|
list(APPEND MAIN_SOURCE_FILES
|
|
|
|
main/comp_window_wayland.c
|
|
|
|
)
|
2019-03-26 10:07:11 +00:00
|
|
|
endif()
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
# Use OBJECT to not create a archive, since it just gets in the way.
|
2020-03-02 11:57:19 +00:00
|
|
|
add_library(comp_main OBJECT ${SHADER_HEADERS} ${MAIN_SOURCE_FILES} ${WL_PROTOS_SRC})
|
|
|
|
target_include_directories(comp_main SYSTEM PRIVATE
|
2019-12-03 22:33:16 +00:00
|
|
|
# Shaders - marked SYSTEM so we get no warnings
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2019-03-18 05:52:32 +00:00
|
|
|
)
|
|
|
|
|
2019-12-03 22:33:16 +00:00
|
|
|
if(BUILD_WITH_WAYLAND)
|
2020-03-02 11:57:19 +00:00
|
|
|
target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR})
|
2019-12-03 22:33:16 +00:00
|
|
|
endif()
|
|
|
|
if(BUILD_WITH_XCB)
|
2020-03-02 11:57:19 +00:00
|
|
|
target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS})
|
2019-12-03 22:33:16 +00:00
|
|
|
endif()
|
|
|
|
if(BUILD_WITH_EGL)
|
2020-03-02 11:57:19 +00:00
|
|
|
target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS})
|
2019-12-03 22:33:16 +00:00
|
|
|
endif()
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
add_subdirectory(shaders)
|