-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
101 lines (77 loc) · 2.67 KB
/
CMakeLists.txt
File metadata and controls
101 lines (77 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.21)
project(minimote-server C)
set(CMAKE_C_STANDARD 23)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
file(GLOB_RECURSE sources "src/*.c" "src/*.h")
list(FILTER sources EXCLUDE REGEX ".*main.c$")
add_executable(minimote-server ${sources} "src/main.c")
target_include_directories(minimote-server PRIVATE src)
# wayland
find_package(WAYLAND_CLIENT)
if (WAYLAND_CLIENT_FOUND)
message(STATUS "wayland-client has been found")
message(STATUS "WAYLAND_CLIENT_INCLUDE_DIR=${WAYLAND_CLIENT_INCLUDE_DIR}")
message(STATUS "WAYLAND_CLIENT_LIBRARY=${WAYLAND_CLIENT_LIBRARY}")
else()
message(STATUS "wayland-client not found")
endif()
# x11
find_package(X11)
if(X11_FOUND)
message(STATUS "X11 has been found")
message(STATUS "X11_INCLUDE_DIR=${X11_INCLUDE_DIR}")
message(STATUS "X11_LIBRARIES=${X11_LIBRARIES}")
else()
message(STATUS "x11 not found")
endif()
# xkbcommon
find_package(XKBCOMMON REQUIRED)
if (XKBCOMMON_FOUND)
message(STATUS "xkbcommon has been found")
message(STATUS "XKBCOMMON_INCLUDE_DIRS=${XKBCOMMON_INCLUDE_DIRS}")
message(STATUS "XKBCOMMON_LIBRARIES=${XKBCOMMON_LIBRARIES}")
else()
message(FATAL_ERROR "xkbcommon not found")
endif()
# xkbcommon-x11
find_package(XKBCOMMON_X11)
if (XKBCOMMON_X11_FOUND)
message(STATUS "xkbcommon has been found")
message(STATUS "XKBCOMMON_X11_INCLUDE_DIRS=${XKBCOMMON_X11_INCLUDE_DIRS}")
message(STATUS "XKBCOMMON_X11_LIBRARIES=${XKBCOMMON_X11_LIBRARIES}")
else()
message(STATUS "xkbcommon-x11 not found")
endif()
# xcb
find_package(XCB)
if (XCB_FOUND)
message(STATUS "xcb has been found")
message(STATUS "XCB_INCLUDE_DIRS=${XCB_INCLUDE_DIRS}")
message(STATUS "XCB_LIBRARIES=${XCB_LIBRARIES}")
else()
message(STATUS "xcb not found")
endif()
target_link_libraries(minimote-server
${XKBCOMMON_LIBRARIES}
)
if (WAYLAND_CLIENT_FOUND)
message(STATUS "Enabling Wayland support")
add_compile_definitions(WAYLAND)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIRS})
target_link_libraries(minimote-server
${WAYLAND_CLIENT_LIBRARIES}
)
endif()
if(X11_FOUND AND XKBCOMMON_X11_FOUND AND XCB_FOUND)
message(STATUS "Enabling X11 support")
add_compile_definitions(X11)
include_directories(${XKBCOMMON_INCLUDE_DIRS})
include_directories(${XKBCOMMON_INCLUDE_DIRS})
include_directories(${XCB_INCLUDE_DIRS})
target_link_libraries(minimote-server
${XKBCOMMON_LIBRARIES} ${XKBCOMMON_X11_LIBRARIES} ${XCB_LIBRARIES}
)
endif()
if (NOT WAYLAND_CLIENT_FOUND AND NOT (X11_FOUND AND XKBCOMMON_X11_FOUND AND XCB_FOUND))
message(FATAL_ERROR "Failed to find valid a display server: either x11 or wayland")
endif()