2021-01-15 09:30:03 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(displayserver_Wayland LANGUAGES C)
|
|
|
|
|
|
|
|
find_package(PkgConfig)
|
2021-07-24 01:47:54 +00:00
|
|
|
pkg_check_modules(DISPLAYSERVER_Wayland REQUIRED IMPORTED_TARGET
|
2021-01-15 09:30:03 +00:00
|
|
|
wayland-client
|
2021-07-29 21:34:17 +00:00
|
|
|
wayland-cursor
|
2021-01-15 09:30:03 +00:00
|
|
|
)
|
|
|
|
|
2021-07-24 01:47:54 +00:00
|
|
|
set(DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES "")
|
2021-03-06 10:47:40 +00:00
|
|
|
set(displayserver_Wayland_SHELL_SRC "")
|
|
|
|
|
|
|
|
if (ENABLE_LIBDECOR)
|
2021-07-24 01:47:54 +00:00
|
|
|
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED IMPORTED_TARGET
|
2021-07-23 04:30:02 +00:00
|
|
|
libdecor-0
|
2021-03-06 10:47:40 +00:00
|
|
|
)
|
2021-07-24 01:47:54 +00:00
|
|
|
list(APPEND DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES PkgConfig::DISPLAYSERVER_Wayland_LIBDECOR)
|
2021-03-06 10:47:40 +00:00
|
|
|
list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c)
|
2021-07-21 22:48:10 +00:00
|
|
|
add_compile_definitions(ENABLE_LIBDECOR)
|
2021-03-06 10:47:40 +00:00
|
|
|
else()
|
|
|
|
list(APPEND displayserver_Wayland_SHELL_SRC shell_xdg.c)
|
|
|
|
endif()
|
|
|
|
|
2021-01-15 09:30:03 +00:00
|
|
|
add_library(displayserver_Wayland STATIC
|
2021-02-20 06:23:48 +00:00
|
|
|
clipboard.c
|
|
|
|
cursor.c
|
|
|
|
gl.c
|
|
|
|
idle.c
|
|
|
|
input.c
|
2021-02-21 03:48:48 +00:00
|
|
|
output.c
|
2021-02-20 06:23:48 +00:00
|
|
|
poll.c
|
2021-05-14 02:51:45 +00:00
|
|
|
presentation.c
|
2021-02-20 06:23:48 +00:00
|
|
|
state.c
|
|
|
|
registry.c
|
2021-01-15 09:30:03 +00:00
|
|
|
wayland.c
|
2021-02-20 06:23:48 +00:00
|
|
|
window.c
|
2021-03-06 10:47:40 +00:00
|
|
|
${displayserver_Wayland_SHELL_SRC}
|
2021-01-15 09:30:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(displayserver_Wayland
|
2021-07-24 01:47:54 +00:00
|
|
|
PkgConfig::DISPLAYSERVER_Wayland
|
2021-01-15 09:30:03 +00:00
|
|
|
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES}
|
|
|
|
lg_common
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(displayserver_Wayland
|
|
|
|
PRIVATE
|
|
|
|
src
|
|
|
|
)
|
|
|
|
|
|
|
|
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
|
|
|
|
pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15)
|
|
|
|
pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
|
|
|
|
|
|
|
|
macro(wayland_generate protocol_file output_file)
|
|
|
|
add_custom_command(OUTPUT "${output_file}.h"
|
|
|
|
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h"
|
|
|
|
DEPENDS "${protocol_file}"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT "${output_file}.c"
|
|
|
|
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}.c"
|
|
|
|
DEPENDS "${protocol_file}"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
target_sources(displayserver_Wayland PRIVATE "${output_file}.h" "${output_file}.c")
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wayland")
|
|
|
|
include_directories("${CMAKE_BINARY_DIR}/wayland")
|
2021-01-26 23:59:10 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-shell-client-protocol")
|
2021-05-14 02:51:45 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/stable/presentation-time/presentation-time.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-presentation-time-client-protocol")
|
2021-08-01 01:56:47 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-viewporter-client-protocol")
|
2021-01-27 04:53:02 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-decoration-unstable-v1-client-protocol")
|
2021-01-15 09:30:03 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-relative-pointer-unstable-v1-client-protocol")
|
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-pointer-constraints-unstable-v1-client-protocol")
|
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-keyboard-shortcuts-inhibit-unstable-v1-client-protocol")
|
2021-01-18 06:11:22 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-idle-inhibit-unstable-v1-client-protocol")
|
2021-08-01 01:56:47 +00:00
|
|
|
wayland_generate(
|
|
|
|
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-output/xdg-output-unstable-v1.xml"
|
|
|
|
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-output-unstable-v1-client-protocol")
|