Fix for Geolocation webTCT failures
[platform/framework/web/chromium-efl.git] / third_party / weston / BUILD.gn
1 # Copyright 2020 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/config/compiler/compiler.gni")
6 import("//build/config/linux/pkg_config.gni")
7 import("//build/config/python.gni")
8 import("//build/config/ui.gni")
9 import("//build/toolchain/toolchain.gni")
10 import("//third_party/wayland/wayland_protocol.gni")
11
12 wayland_protocol("text_cursor_position_protocol") {
13   sources = [ "src/protocol/text-cursor-position.xml" ]
14 }
15
16 wayland_protocol("weston_content_protection_protocol") {
17   sources = [ "src/protocol/weston-content-protection.xml" ]
18 }
19
20 wayland_protocol("weston_debug_protocol") {
21   sources = [ "src/protocol/weston-debug.xml" ]
22 }
23
24 wayland_protocol("weston_desktop_shell_protocol") {
25   sources = [ "src/protocol/weston-desktop-shell.xml" ]
26 }
27
28 wayland_protocol("weston_direct_display_protocol") {
29   sources = [ "src/protocol/weston-direct-display.xml" ]
30 }
31
32 wayland_protocol("weston_output_capture_protocol") {
33   sources = [ "src/protocol/weston-output-capture.xml" ]
34 }
35
36 wayland_protocol("weston_touch_calibration_protocol") {
37   sources = [ "src/protocol/weston-touch-calibration.xml" ]
38 }
39
40 config("weston_config") {
41   out_dir = rebase_path(root_out_dir, root_build_dir)
42   defines = [
43     "BINDIR = \"$out_dir\"",
44     "DATADIR = \"$out_dir\"",
45     "LIBEXECDIR = \"$out_dir\"",
46     "LIBWESTON_MODULEDIR =  \"$out_dir\"",
47     "MODULEDIR = \"$out_dir\"",
48   ]
49
50   include_dirs = [
51     "src",
52     "src/include",
53     "config",
54     "version",
55     "include",
56   ]
57
58   cflags = [
59     "-Wno-extra-semi",
60     "-Wno-implicit-function-declaration",
61     "-Wno-int-conversion",
62     "-Wno-return-type",
63     "-Wno-shift-negative-value",
64     "-Wno-string-conversion",
65     "-Wno-non-literal-null-conversion",
66
67     # clang complains about a variable in `gl_renderer_fill_buffer_info()` that
68     # might be unitialized after a switch-case, however that case is unreachable
69     # (and will `assert(0)` if hit anyways).
70     "-Wno-sometimes-uninitialized",
71   ]
72
73   ldflags = [ "-Wl,-rpath=\$ORIGIN" ]
74
75   configs = [ "//third_party/wayland:wayland_config" ]
76 }
77
78 pkg_config("pixman") {
79   packages = [ "pixman-1" ]
80 }
81
82 pkg_config("cairo") {
83   packages = [ "cairo" ]
84 }
85
86 pkg_config("libinput") {
87   packages = [ "libinput" ]
88 }
89
90 pkg_config("libevdev") {
91   packages = [ "libevdev" ]
92 }
93
94 pkg_config("libsystemd") {
95   packages = [ "libsystemd" ]
96 }
97
98 pkg_config("wayland_cursor") {
99   packages = [ "wayland-cursor" ]
100 }
101
102 pkg_config("wayland_egl") {
103   packages = [ "wayland-egl" ]
104 }
105
106 pkg_config("xkbcommon") {
107   packages = [ "xkbcommon" ]
108 }
109
110 static_library("shared") {
111   sources = [
112     "src/shared/config-parser.c",
113     "src/shared/file-util.c",
114     "src/shared/hash.c",
115     "src/shared/option-parser.c",
116     "src/shared/os-compatibility.c",
117     "src/shared/os-compatibility.h",
118     "src/shared/process-util.c",
119     "src/shared/signal.c",
120   ]
121
122   deps = [ "//third_party/wayland:wayland_client" ]
123
124   configs -= [ "//build/config/compiler:chromium_code" ]
125   configs += [
126     "//build/config/compiler:no_chromium_code",
127     ":weston_config",
128   ]
129
130   public_configs = [ ":pixman" ]
131 }
132
133 static_library("cairo_shared") {
134   sources = [
135     "src/shared/cairo-util.c",
136     "src/shared/frame.c",
137     "src/shared/image-loader.c",
138   ]
139
140   deps = [
141     ":shared",
142     "//third_party/fontconfig",
143     "//third_party/libpng",
144   ]
145
146   configs -= [ "//build/config/compiler:chromium_code" ]
147   configs += [
148     "//build/config/compiler:no_chromium_code",
149     ":weston_config",
150   ]
151
152   if (use_glib) {
153     configs += [ "//build/config/linux:glib" ]
154   }
155
156   public_configs = [
157     "//build/config/linux/pangocairo",
158     ":cairo",
159     ":pixman",
160   ]
161 }
162
163 static_library("libweston") {
164   sources = [
165     "src/libweston/animation.c",
166     "src/libweston/auth.c",
167     "src/libweston/bindings.c",
168     "src/libweston/clipboard.c",
169     "src/libweston/color-noop.c",
170     "src/libweston/color.c",
171     "src/libweston/compositor.c",
172     "src/libweston/content-protection.c",
173     "src/libweston/data-device.c",
174     "src/libweston/desktop/client.c",
175     "src/libweston/desktop/libweston-desktop.c",
176     "src/libweston/desktop/seat.c",
177     "src/libweston/desktop/surface.c",
178     "src/libweston/desktop/xdg-shell-v6.c",
179     "src/libweston/desktop/xdg-shell.c",
180     "src/libweston/desktop/xwayland.c",
181     "src/libweston/drm-formats.c",
182     "src/libweston/input.c",
183     "src/libweston/linux-dmabuf.c",
184     "src/libweston/linux-explicit-synchronization.c",
185     "src/libweston/linux-sync-file.c",
186     "src/libweston/log.c",
187     "src/libweston/noop-renderer.c",
188     "src/libweston/output-capture.c",
189     "src/libweston/pixel-formats.c",
190     "src/libweston/pixman-renderer.c",
191     "src/libweston/plugin-registry.c",
192     "src/libweston/screenshooter.c",
193     "src/libweston/shell-utils/shell-utils.c",
194     "src/libweston/timeline.c",
195     "src/libweston/touch-calibration.c",
196     "src/libweston/weston-direct-display.c",
197     "src/libweston/weston-log-file.c",
198     "src/libweston/weston-log-flight-rec.c",
199     "src/libweston/weston-log-wayland.c",
200     "src/libweston/weston-log.c",
201     "src/shared/matrix.c",
202   ]
203
204   include_dirs = [
205     "src/shared",
206     "src/libweston",
207   ]
208
209   deps = [
210     ":shared",
211     ":text_cursor_position_protocol",
212     ":weston_content_protection_protocol",
213     ":weston_debug_protocol",
214     ":weston_direct_display_protocol",
215     ":weston_output_capture_protocol",
216     ":weston_touch_calibration_protocol",
217     "//third_party/libdrm",
218     "//third_party/wayland:wayland_client",
219     "//third_party/wayland:wayland_server",
220     "//third_party/wayland:wayland_util",
221     "//third_party/wayland-protocols:input_method_protocol",
222     "//third_party/wayland-protocols:input_timestamps_protocol",
223     "//third_party/wayland-protocols:linux_dmabuf_protocol",
224     "//third_party/wayland-protocols:linux_explicit_synchronization_protocol",
225     "//third_party/wayland-protocols:pointer_constraints_protocol",
226     "//third_party/wayland-protocols:presentation_time_protocol",
227     "//third_party/wayland-protocols:relative_pointer_protocol",
228     "//third_party/wayland-protocols:single_pixel_buffer",
229     "//third_party/wayland-protocols:tablet_protocol",
230     "//third_party/wayland-protocols:tearing_control_protocol",
231     "//third_party/wayland-protocols:text_input_protocol",
232     "//third_party/wayland-protocols:viewporter_protocol",
233     "//third_party/wayland-protocols:xdg_output_protocol",
234     "//third_party/wayland-protocols:xdg_shell_protocol",
235   ]
236
237   configs -= [ "//build/config/compiler:chromium_code" ]
238   configs += [
239     "//build/config/compiler:no_chromium_code",
240     ":weston_config",
241     ":xkbcommon",
242   ]
243
244   public_configs = [ ":pixman" ]
245 }
246
247 action("vertex_glsl") {
248   script = "src/tools/xxd.py"
249
250   file_prefix = "src/libweston/renderer-gl/vertex"
251
252   input_file = file_prefix + ".glsl"
253   inputs = [ input_file ]
254
255   output_file = "$target_gen_dir/" + file_prefix + "-shader.h"
256   outputs = [ output_file ]
257
258   args = [
259     "-n",
260     "vertex_shader",
261     rebase_path(input_file, root_build_dir),
262     rebase_path(output_file, root_build_dir),
263   ]
264 }
265
266 action("fragment_glsl") {
267   script = "src/tools/xxd.py"
268
269   file_prefix = "src/libweston/renderer-gl/fragment"
270
271   input_file = file_prefix + ".glsl"
272   inputs = [ input_file ]
273
274   output_file = "$target_gen_dir/" + file_prefix + "-shader.h"
275   outputs = [ output_file ]
276
277   args = [
278     "-n",
279     "fragment_shader",
280     rebase_path(input_file, root_build_dir),
281     rebase_path(output_file, root_build_dir),
282   ]
283 }
284
285 shared_library("gl_renderer") {
286   output_prefix_override = true
287   output_name = "gl-renderer"
288
289   visibility = [ ":weston" ]
290
291   # gl_renderer currently requires files under src/libweston and src/shared to
292   # include at runtime, if we remove these files some of the components(functions)
293   # are undefined and lead to failure in build due to undefined symbols/functions
294   include_dirs = [
295     "$target_gen_dir/src/libweston/renderer-gl",
296     "src/libweston",
297     "src/shared",
298   ]
299
300   sources = [
301     "src/libweston/renderer-gl/egl-glue.c",
302     "src/libweston/renderer-gl/gl-renderer.c",
303     "src/libweston/renderer-gl/gl-shader-config-color-transformation.c",
304     "src/libweston/renderer-gl/gl-shaders.c",
305     "src/libweston/vertex-clipping.c",
306   ]
307
308   libs = [
309     "EGL",
310     "GLESv2",
311   ]
312
313   deps = [
314     ":fragment_glsl",
315     ":libweston",
316     ":vertex_glsl",
317     "//third_party/libdrm",
318     "//third_party/wayland:wayland_server",
319     "//third_party/wayland-protocols:linux_dmabuf_protocol",
320   ]
321
322   configs -= [ "//build/config/compiler:chromium_code" ]
323   configs += [
324     "//build/config/compiler:no_chromium_code",
325     ":weston_config",
326     ":xkbcommon",
327   ]
328 }
329
330 static_library("gl_borders") {
331   sources = [ "src/libweston/gl-borders.c" ]
332
333   include_dirs = [
334     "src/shared",
335     "src/libweston",
336   ]
337
338   deps = [
339     ":cairo_shared",
340     ":libweston",
341   ]
342
343   configs -= [ "//build/config/compiler:chromium_code" ]
344   configs += [
345     "//build/config/compiler:no_chromium_code",
346     ":weston_config",
347   ]
348 }
349
350 shared_library("wayland_backend") {
351   output_prefix_override = true
352   output_name = "wayland-backend"
353
354   visibility = [ ":weston" ]
355
356   defines = [ "BUILD_WAYLAND_COMPOSITOR = 1" ]
357
358   include_dirs = [
359     "src/shared",
360     "src/libweston",
361   ]
362
363   sources = [ "src/libweston/backend-wayland/wayland.c" ]
364
365   deps = [
366     ":cairo_shared",
367     ":gl_borders",
368     ":libweston",
369     ":shared",
370     "//build/config/linux/libdrm",
371     "//third_party/wayland:wayland_client",
372     "//third_party/wayland-protocols:fullscreen_shell_protocol",
373     "//third_party/wayland-protocols:presentation_time_protocol",
374     "//third_party/wayland-protocols:xdg_shell_protocol",
375   ]
376
377   configs -= [ "//build/config/compiler:chromium_code" ]
378   configs += [
379     ":wayland_cursor",
380     ":wayland_egl",
381     "//build/config/compiler:no_chromium_code",
382     ":weston_config",
383     ":xkbcommon",
384   ]
385 }
386
387 shared_library("headless_backend") {
388   output_prefix_override = true
389   output_name = "headless-backend"
390
391   visibility = [ ":weston" ]
392
393   defines = [ "BUILD_HEADLESS_COMPOSITOR=1" ]
394
395   include_dirs = [
396     "src/shared",
397     "src/libweston",
398   ]
399
400   sources = [ "src/libweston/backend-headless/headless.c" ]
401
402   deps = [
403     ":cairo_shared",
404     ":gl_borders",
405     ":libweston",
406     "//build/config/linux/libdrm",
407     "//third_party/wayland-protocols:presentation_time_protocol",
408   ]
409
410   configs -= [ "//build/config/compiler:chromium_code" ]
411   configs += [
412     "//build/config/compiler:no_chromium_code",
413     ":weston_config",
414   ]
415 }
416
417 shared_library("compositor") {
418   output_name = "weston_compositor"
419
420   sources = [
421     "src/compositor/config-helpers.c",
422     "src/compositor/executable.c",
423     "src/compositor/main.c",
424     "src/compositor/text-backend.c",
425     "src/compositor/weston-screenshooter.c",
426   ]
427
428   deps = [
429     ":libweston",
430     ":shared",
431     "//third_party/wayland:wayland_server",
432     "//third_party/wayland-protocols:input_method_protocol",
433     "//third_party/wayland-protocols:text_input_protocol",
434   ]
435
436   configs -= [ "//build/config/compiler:chromium_code" ]
437   configs += [
438     "//build/config/compiler:no_chromium_code",
439     ":libevdev",
440     ":libinput",
441     ":weston_config",
442   ]
443 }
444
445 static_library("toytoolkit") {
446   sources = [
447     "src/clients/window.c",
448     "src/shared/matrix.c",
449   ]
450
451   deps = [
452     ":cairo_shared",
453     ":shared",
454     ":text_cursor_position_protocol",
455     "//third_party/wayland:wayland_client",
456     "//third_party/wayland-protocols:pointer_constraints_protocol",
457     "//third_party/wayland-protocols:relative_pointer_protocol",
458     "//third_party/wayland-protocols:tablet_protocol",
459     "//third_party/wayland-protocols:viewporter_protocol",
460     "//third_party/wayland-protocols:xdg_shell_protocol",
461   ]
462
463   configs -= [ "//build/config/compiler:chromium_code" ]
464   configs += [
465     ":wayland_cursor",
466     "//build/config/compiler:no_chromium_code",
467     ":weston_config",
468     ":xkbcommon",
469   ]
470 }
471
472 shared_library("ui_controls") {
473   output_prefix_override = true
474   output_name = "ui-controls"
475
476   sources = [ "src/tests/ui-controls.c" ]
477
478   deps = [
479     ":compositor",
480     ":libweston",
481     "//third_party/wayland-protocols:ui_controls_protocol",
482   ]
483
484   configs -= [ "//build/config/compiler:chromium_code" ]
485   configs += [
486     "//build/config/compiler:no_chromium_code",
487     ":weston_config",
488   ]
489
490   include_dirs = [
491     "src/libweston",
492     "src/compositor",
493   ]
494 }
495
496 shared_library("weston_systemd_notify") {
497   output_prefix_override = true
498   output_name = "systemd-notify"
499
500   sources = [ "src/compositor/systemd-notify.c" ]
501
502   deps = [
503     ":compositor",
504     "//third_party/wayland:wayland_server",
505   ]
506
507   configs -= [ "//build/config/compiler:chromium_code" ]
508   configs += [
509     "//build/config/compiler:no_chromium_code",
510     ":weston_config",
511   ]
512
513   include_dirs = [ "src/compositor" ]
514
515   public_configs = [
516     ":libsystemd",
517     ":pixman",
518     ":xkbcommon",
519   ]
520 }
521
522 executable("weston_keyboard") {
523   output_name = "weston-keyboard"
524
525   visibility = [ ":weston" ]
526
527   sources = [ "src/clients/keyboard.c" ]
528
529   deps = [
530     ":cairo_shared",
531     ":toytoolkit",
532     "//third_party/wayland:wayland_client",
533     "//third_party/wayland-protocols:input_method_protocol",
534     "//third_party/wayland-protocols:text_input_protocol",
535   ]
536
537   configs -= [ "//build/config/compiler:chromium_code" ]
538   configs += [
539     "//build/config/compiler:no_chromium_code",
540     ":weston_config",
541   ]
542 }
543
544 executable("weston_screenshooter") {
545   output_name = "weston-screenshooter"
546
547   visibility = [ ":weston" ]
548
549   include_dirs = [ "src/libweston" ]
550
551   sources = [ "src/clients/screenshot.c" ]
552
553   deps = [
554     ":cairo_shared",
555     ":libweston",
556     ":shared",
557     ":toytoolkit",
558     ":weston_output_capture_protocol",
559     "//third_party/wayland:wayland_client",
560   ]
561
562   configs -= [ "//build/config/compiler:chromium_code" ]
563   configs += [
564     "//build/config/compiler:no_chromium_code",
565     ":weston_config",
566   ]
567 }
568
569 executable("weston_desktop_shell") {
570   output_name = "weston-desktop-shell"
571
572   visibility = [ ":weston" ]
573
574   sources = [ "src/clients/desktop-shell.c" ]
575
576   deps = [
577     ":cairo_shared",
578     ":toytoolkit",
579     ":weston_desktop_shell_protocol",
580     "//third_party/wayland:wayland_client",
581     "//third_party/wayland-protocols:tablet_protocol",
582   ]
583
584   configs -= [ "//build/config/compiler:chromium_code" ]
585   configs += [
586     "//build/config/compiler:no_chromium_code",
587     ":weston_config",
588   ]
589 }
590
591 shared_library("desktop_shell") {
592   output_prefix_override = true
593   output_name = "desktop-shell"
594
595   visibility = [ ":weston" ]
596
597   sources = [
598     "src/desktop-shell/input-panel.c",
599     "src/desktop-shell/shell.c",
600   ]
601
602   deps = [
603     ":cairo_shared",
604     ":compositor",
605     ":libweston",
606     ":shared",
607     ":weston_desktop_shell_protocol",
608     "//third_party/wayland:wayland_server",
609     "//third_party/wayland-protocols:input_method_protocol",
610   ]
611
612   configs -= [ "//build/config/compiler:chromium_code" ]
613   configs += [
614     "//build/config/compiler:no_chromium_code",
615     ":weston_config",
616   ]
617 }
618
619 executable("weston") {
620   deps = [
621     ":compositor",
622     ":libweston",
623     ":shared",
624   ]
625
626   data_deps = [
627     ":desktop_shell",
628     ":gl_renderer",
629     ":headless_backend",
630     ":ui_controls",
631     ":wayland_backend",
632     ":weston_desktop_shell",
633     ":weston_keyboard",
634     ":weston_screenshooter",
635     ":weston_systemd_notify",
636   ]
637
638   configs += [ ":weston_config" ]
639 }