blob: 6cc5bcec1bd757717b941303b8ed6418e4510fb5 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//third_party/wayland/wayland.gni")
group("wayland") {
public_deps = [
":client",
":server",
]
}
group("client") {
public_deps = [ ":wayland-client" ]
}
group("server") {
public_deps = [ ":wayland-server" ]
}
group("client_headers") {
public_configs = [
":client_config",
":common_config",
]
deps = [
":headers_client",
":headers_common",
":protocol_client",
":protocol_client_core",
]
}
group("server_headers") {
public_configs = [
":server_config",
":common_config",
]
deps = [
":headers_common",
":headers_server",
":protocol_server",
":protocol_server_core",
]
}
executable("scanner") {
output_name = "wayland-scanner"
deps = [ ":scanner_static" ]
}
config("common_config") {
visibility = [ ":*" ]
include_dirs = [ "${target_gen_dir}/common" ]
}
config("client_config") {
visibility = [ ":*" ]
include_dirs = [ "${target_gen_dir}/client" ]
}
config("server_config") {
visibility = [ ":*" ]
include_dirs = [ "${target_gen_dir}/server" ]
}
config("private_config") {
visibility = [ ":*" ]
configs = [
":client_config",
":server_config",
":common_config",
]
include_dirs = [
".",
"./src",
"./protocol",
]
defines = [ "_POSIX_C_SOURCE=200809L" ]
cflags = [ "-pthread" ]
if (is_clang) {
cflags += [
# TODO(36439): Clang introduced a new warning that is raised when we
# attempt to check the size of an array through sizeof() division. If the
# type of the sizeof() in the divisor is not the same as that of the array
# element, a warning is raised.
"-Wno-unknown-warning-option",
"-Wno-sizeof-array-div",
"-Wno-conversion",
"-Wno-implicit-fallthrough",
]
}
}
source_set("scanner_static") {
visibility = [ ":*" ]
deps = [ "//third_party/expat" ]
if (is_linux) {
deps += [ "//third_party/libxml2" ]
defines = [ "HAVE_LIBXML=1" ]
}
sources = [
"protocol/wayland.dtd.c",
"src/scanner.c",
"src/wayland-util.c",
]
configs += [ ":private_config" ]
}
shared_library("wayland-client") {
visibility = [ ":*" ]
output_extension = "so.0"
sources = [ "src/wayland-client.c" ]
deps = [ ":common_static" ]
public_deps = [ ":client_headers" ]
configs += [ ":private_config" ]
}
shared_library("wayland-server") {
visibility = [ ":*" ]
output_extension = "so.0"
sources = [ "src/wayland-server.c" ]
deps = [ ":common_static" ]
public_deps = [ ":server_headers" ]
configs += [ ":private_config" ]
}
source_set("common_static") {
visibility = [ ":*" ]
sources = [
"src/connection.c",
"src/event-loop.c",
"src/wayland-os.c",
"src/wayland-util.c",
]
deps = [
":protocol_code",
"//third_party/libffi",
]
public_deps = [
":client_headers",
":server_headers",
]
configs += [ ":private_config" ]
}
wayland_protocol_code("protocol_code") {
visibility = [ ":*" ]
protocol = "protocol/wayland.xml"
output = "${target_gen_dir}/wayland-protocol.c"
for_export = true
}
wayland_protocol_header("protocol_client") {
visibility = [ ":*" ]
protocol = "protocol/wayland.xml"
variant = "client"
core = false
output = "${target_gen_dir}/client/wayland-client-protocol.h"
}
wayland_protocol_header("protocol_client_core") {
visibility = [ ":*" ]
protocol = "protocol/wayland.xml"
variant = "client"
core = true
output = "${target_gen_dir}/client/wayland-client-protocol-core.h"
}
wayland_protocol_header("protocol_server") {
visibility = [ ":*" ]
protocol = "protocol/wayland.xml"
variant = "server"
core = false
output = "${target_gen_dir}/server/wayland-server-protocol.h"
}
wayland_protocol_header("protocol_server_core") {
visibility = [ ":*" ]
protocol = "protocol/wayland.xml"
variant = "server"
core = true
output = "${target_gen_dir}/server/wayland-server-protocol-core.h"
}
copy("headers_common") {
visibility = [ ":*" ]
sources = [
"src/wayland-util.h",
"src/wayland-version.h",
]
outputs = [ "${target_gen_dir}/common/{{source_file_part}}" ]
}
copy("headers_client") {
visibility = [ ":*" ]
sources = [
"src/wayland-client-core.h",
"src/wayland-client.h",
]
outputs = [ "${target_gen_dir}/client/{{source_file_part}}" ]
}
copy("headers_server") {
visibility = [ ":*" ]
sources = [
"src/wayland-server-core.h",
"src/wayland-server.h",
]
outputs = [ "${target_gen_dir}/server/{{source_file_part}}" ]
}