# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/linux/pkg_config.gni") import("//third_party/wayland/features.gni") import("//tools/generate_stubs/rules.gni") if (!use_system_libwayland) { config("wayland_config") { include_dirs = [ "include", "include/src", "include/protocol", "src/cursor", "src/egl", "src/src", ] # TODO(thomasanderson): Remove this once # https://patchwork.freedesktop.org/patch/242086/ lands. cflags = [ "-Wno-macro-redefined" ] } source_set("wayland_util") { sources = [ "src/src/wayland-private.h", "src/src/wayland-util.c", "src/src/wayland-util.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ ":wayland_config" ] } static_library("wayland_private") { sources = [ "src/src/connection.c", "src/src/wayland-os.c", "src/src/wayland-os.h", ] deps = [ ":wayland_util" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", "//build/config/linux/libffi", ":wayland_config", ] } static_library("wayland_protocol") { sources = [ "protocol/wayland-protocol.c" ] deps = [ ":wayland_util" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ ":wayland_config" ] } static_library("wayland_server") { sources = [ "include/protocol/wayland-server-protocol.h", "src/src/event-loop.c", "src/src/wayland-server.c", "src/src/wayland-shm.c", ] include_dirs = [ "include/" ] deps = [ ":wayland_private", ":wayland_protocol", ":wayland_util", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", "//build/config/linux/libffi", ] public_configs = [ ":wayland_config" ] } static_library("wayland_client") { sources = [ "include/protocol/wayland-client-protocol.h", "src/src/wayland-client.c", ] deps = [ ":wayland_private", ":wayland_protocol", ":wayland_util", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", "//build/config/linux/libffi", ] public_configs = [ ":wayland_config" ] } static_library("wayland_egl") { sources = [ "src/egl/wayland-egl-backend.h", "src/egl/wayland-egl-core.h", "src/egl/wayland-egl.c", "src/egl/wayland-egl.h", ] deps = [ ":wayland_util" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ ":wayland_config" ] } static_library("wayland_cursor") { sources = [ "src/cursor/cursor-data.h", "src/cursor/os-compatibility.c", "src/cursor/os-compatibility.h", "src/cursor/wayland-cursor.c", "src/cursor/wayland-cursor.h", "src/cursor/xcursor.c", "src/cursor/xcursor.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ ":wayland_config" ] } } if (!use_system_wayland_scanner) { config("wayland_scanner_config") { cflags = [ "-Wno-int-conversion", "-Wno-implicit-function-declaration", ] include_dirs = [ "include/" ] } executable("wayland_scanner") { sources = [ "src/src/scanner.c" ] deps = [ ":wayland_util", "//third_party/expat:expat", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", ":wayland_scanner_config", ] } } if (use_system_libwayland) { pkg_config("wayland_client_config") { packages = [ "wayland-client" ] } pkg_config("wayland_cursor_config") { packages = [ "wayland-cursor" ] } pkg_config("wayland_server_config") { packages = [ "wayland-server" ] } pkg_config("wayland_egl_config") { packages = [ "wayland-egl" ] } group("wayland_client") { public_configs = [ ":wayland_client_config" ] } group("wayland_cursor") { public_configs = [ ":wayland_cursor_config" ] } group("wayland_server") { public_configs = [ ":wayland_server_config" ] } group("wayland_util") { public_configs = [ ":wayland_client_config" ] } group("wayland_egl") { public_configs = [ ":wayland_egl_config" ] } generate_stubs("wayland_wrappers") { visibility = [ ":wayland_stubs" ] extra_header = "stubs/libwayland.fragment" sigs = [ "stubs/libwayland-client.sigs", "stubs/libwayland-cursor.sigs", "stubs/libwayland-egl.sigs", ] output_name = "libwayland_stubs" deps = [ "//base" ] } # This is a source_set, not a component, because we don't want to leak # our own wayland symbols in component builds, which can interfere with # the system libEGL's usage of wayland. source_set("wayland_stubs") { public_deps = [ ":wayland_wrappers" ] sources = [ # Provide data symbols which generate_stubs.py cannot wrap -- only # functions are wrappable. wayland-protocol.c contains only data and # no code. "protocol/wayland-protocol.c", # Provide implementations of C variadic functions, which # generate_stubs.py cannot generate forwarding-functions for. "stubs/libwayland_variadic_support.cc", ] # This is a hack to hide the symbols annoted with # attribute((visibility("default"))) in wayland-protocol.c since libwayland # currently doesn't provide a way to override this behavior. This can be # removed once https://gitlab.freedesktop.org/wayland/wayland/-/issues/179 # is fixed and we can switch to overriding WL_EXPORT directly. defines = [ "visibility(x)=visibility(\"hidden\")" ] } }