-
Notifications
You must be signed in to change notification settings - Fork 2
/
BUILD.gn
229 lines (201 loc) · 5.91 KB
/
BUILD.gn
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/pkg_config.gni")
import("shim_gen.gni")
import("wayland_protocol.gni")
group("all") {
deps = [ ":sommelier" ]
if (use.fuzzer) {
deps += [ ":sommelier_wayland_fuzzer" ]
}
if (use.test) {
deps += [ ":sommelier_test" ]
}
}
# Set this to the Xwayland path.
if (!defined(xwayland_path)) {
xwayland_path = "\"/opt/google/cros-containers/bin/Xwayland\""
}
# Set this to the GL driver path to use for Xwayland.
if (!defined(xwayland_gl_driver_path)) {
xwayland_gl_driver_path = "\"/opt/google/cros-containers/lib\""
}
# Set this to the frame color to use for Xwayland clients.
if (!defined(frame_color)) {
frame_color = "\"#f2f2f2\""
}
# Set this to the dark frame color to use for Xwayland clients.
if (!defined(dark_frame_color)) {
dark_frame_color = "\"#323639\""
}
wayland_protocols = [
"protocol/aura-shell.xml",
"protocol/drm.xml",
"protocol/fractional-scale-v1.xml",
"protocol/gaming-input-unstable-v2.xml",
"protocol/gtk-shell.xml",
"protocol/idle-inhibit-unstable-v1.xml",
"protocol/keyboard-extension-unstable-v1.xml",
"protocol/linux-dmabuf-unstable-v1.xml",
"protocol/linux-explicit-synchronization-unstable-v1.xml",
"protocol/pointer-constraints-unstable-v1.xml",
"protocol/relative-pointer-unstable-v1.xml",
"protocol/stylus-unstable-v2.xml",
"protocol/tablet-unstable-v2.xml",
"protocol/text-input-crostini-unstable-v1.xml",
"protocol/text-input-extension-unstable-v1.xml",
"protocol/text-input-unstable-v1.xml",
"protocol/text-input-x11-unstable-v1.xml",
"protocol/viewporter.xml",
"protocol/xdg-output-unstable-v1.xml",
"protocol/xdg-shell.xml",
]
wayland_protocol_library("sommelier-protocol") {
out_dir = "include"
sources = wayland_protocols
}
gen_shim("sommelier-shims") {
out_dir = "include"
sources = wayland_protocols
}
gaming_defines = [ "GAMEPAD_SUPPORT" ]
gaming_deps = [ ":libgaming" ]
tracing_defines = [ "PERFETTO_TRACING" ]
tracing_pkg_deps = [ "perfetto" ]
tracing_libs = [ "pthread" ]
sommelier_defines = [
"_GNU_SOURCE",
"WL_HIDE_DEPRECATED",
"XWAYLAND_PATH=${xwayland_path}",
"XWAYLAND_GL_DRIVER_PATH=${xwayland_gl_driver_path}",
"FRAME_COLOR=${frame_color}",
"DARK_FRAME_COLOR=${dark_frame_color}",
] + gaming_defines + tracing_defines
testing_defines = []
if (use.test) {
testing_defines += [ "WITH_TESTS" ]
}
static_library("libgaming") {
sources = [
"libevdev/libevdev-shim.cc",
"sommelier-gaming.cc",
]
defines = gaming_defines
pkg_deps = [
"libevdev",
"pixman-1",
]
deps = [ ":sommelier-protocol" ]
}
static_library("libsommelier") {
sources = [
"compositor/sommelier-compositor.cc",
"compositor/sommelier-dmabuf-sync.cc",
"compositor/sommelier-drm.cc",
"compositor/sommelier-formats.cc",
"compositor/sommelier-linux-dmabuf.cc",
"compositor/sommelier-mmap.cc",
"compositor/sommelier-shm.cc",
"sommelier-ctx.cc",
"sommelier-data-device-manager.cc",
"sommelier-display.cc",
"sommelier-fractional-scale.cc",
"sommelier-global.cc",
"sommelier-gtk-shell.cc",
"sommelier-idle-inhibit-manager.cc",
"sommelier-inpututils.cc",
"sommelier-logging.cc",
"sommelier-output.cc",
"sommelier-pointer-constraints.cc",
"sommelier-relative-pointer-manager.cc",
"sommelier-scope-timer.cc",
"sommelier-seat.cc",
"sommelier-shell.cc",
"sommelier-stylus-tablet.cc",
"sommelier-subcompositor.cc",
"sommelier-text-input.cc",
"sommelier-timing.cc",
"sommelier-tracing.cc",
"sommelier-transform.cc",
"sommelier-util.cc",
"sommelier-viewporter.cc",
"sommelier-window.cc",
"sommelier-xdg-shell.cc",
"sommelier-xshape.cc",
"sommelier.cc",
"virtualization/virtgpu_channel.cc",
"virtualization/virtwl_channel.cc",
"xcb/xcb-shim.cc",
]
include_dirs = []
defines = sommelier_defines + testing_defines
pkg_deps = [
"gbm",
"libdrm",
"libevdev",
"pixman-1",
"wayland-client",
"wayland-server",
"xcb",
"xcb-composite",
"xcb-shape",
"xcb-xfixes",
"xkbcommon",
] + tracing_pkg_deps
libs = [ "m" ] + tracing_libs
deps = [
":sommelier-protocol",
":sommelier-shims",
] + gaming_deps
}
executable("sommelier") {
sources = [ "sommelier-main.cc" ]
defines = sommelier_defines
deps = [ ":libsommelier" ]
}
if (use.test) {
executable("sommelier_test") {
sources = [
"compositor/sommelier-linux-dmabuf-test.cc",
"sommelier-gaming-test.cc",
"sommelier-output-test.cc",
"sommelier-test-main.cc",
"sommelier-test.cc",
"sommelier-transform-test.cc",
"sommelier-window-test.cc",
"sommelier-x11event-test.cc",
"sommelier-xdg-shell-test.cc",
"testing/mock-wayland-channel.cc",
"testing/sommelier-test-util.cc",
"xcb/fake-xcb-shim.cc",
]
include_dirs = [ "testing" ]
defines = sommelier_defines + testing_defines
pkg_deps = [
"libevdev",
"pixman-1",
] + tracing_pkg_deps
# gnlint: disable=GnLintCommonTesting
libs = [
"gmock",
"gtest",
"pixman-1",
]
deps = [
":libsommelier",
":sommelier-protocol",
":sommelier-shims",
] + gaming_deps
}
}
if (use.fuzzer) {
executable("sommelier_wayland_fuzzer") {
sources = [ "sommelier-wayland-fuzzer.cc" ]
pkg_deps = [ "pixman-1" ]
libs = [ "pixman-1" ]
configs += [ "//common-mk/common_fuzzer" ]
defines = sommelier_defines
deps = [ ":libsommelier" ]
}
}