blob: ce943e1e327fd20df23fbdaa0057ef9ede3b10e7 [file] [log] [blame]
# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_linux || is_chromeos)
generated_static_table_fourcc_file =
"$target_gen_dir/src/generated_static_table_fourcc.h"
fourcc_file = "src/include/drm/drm_fourcc.h"
action("make_generated_static_table_fourcc") {
script = "src/gen_table_fourcc.py"
args = [
rebase_path(fourcc_file, root_build_dir),
rebase_path(generated_static_table_fourcc_file),
]
outputs = [ generated_static_table_fourcc_file ]
inputs = [ fourcc_file ]
}
config("libdrm_config") {
# TODO(thomasanderson): Remove this hack once
# https://patchwork.kernel.org/patch/10545295/ lands.
defines = [ "typeof(x)=__typeof__(x)" ]
include_dirs = [
"src",
"src/include",
"src/include/drm",
]
# libdrm uses macros defined by <sys/types.h> which are being moved to
# <sys/sysmacros.h>. GLIBC headers give a pragma warning in this case.
# Suppress this warning for now. This may be removed once
# https://patchwork.kernel.org/patch/9628231/ lands.
cflags = [ "-Wno-#pragma-messages" ]
# glibc version >= 2.25 explicitly include <sys/sysmacros.h>
cflags += [ "-DMAJOR_IN_SYSMACROS=1" ]
if (is_clang) {
cflags += [
"-Wno-enum-conversion",
# TODO(crbug.com/932060) fix unused result from asprintf in modetest.c.
"-Wno-unused-result",
# modetest.c has an improper conversion in a printf statement.
"-Wno-format",
]
}
}
static_library("libdrm") {
sources = [
"src/xf86drm.c",
"src/xf86drmHash.c",
"src/xf86drmMode.c",
"src/xf86drmRandom.c",
]
deps = [ ":make_generated_static_table_fourcc" ]
include_dirs = [
get_path_info(generated_static_table_fourcc_file, "dir"),
"src",
"src/include",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
cflags = [
# xf86drm.c uses readdir_r, which has been deprecated as of
# glibc-2.24. This causes a build error when using the Debian
# Stretch sysroot.
"-Wno-deprecated-declarations",
]
public_configs = [ ":libdrm_config" ]
}
executable("modetest") {
sources = [
"src/tests/modetest/buffers.c",
"src/tests/modetest/buffers.h",
"src/tests/modetest/cursor.c",
"src/tests/modetest/cursor.h",
"src/tests/modetest/modetest.c",
"src/tests/util/common.h",
"src/tests/util/format.c",
"src/tests/util/format.h",
"src/tests/util/kms.c",
"src/tests/util/kms.h",
"src/tests/util/pattern.c",
"src/tests/util/pattern.h",
]
include_dirs = [
"src/tests",
"src/tests/modetest",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":libdrm_config" ]
deps = [ ":libdrm" ]
}