1# Copyright 2016 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. 4assert(is_linux || is_chromeos) 5 6generated_static_table_fourcc_file = 7 "$target_gen_dir/src/generated_static_table_fourcc.h" 8fourcc_file = "src/include/drm/drm_fourcc.h" 9 10action("make_generated_static_table_fourcc") { 11 script = "src/gen_table_fourcc.py" 12 args = [ 13 rebase_path(fourcc_file, root_build_dir), 14 rebase_path(generated_static_table_fourcc_file), 15 ] 16 outputs = [ generated_static_table_fourcc_file ] 17 inputs = [ fourcc_file ] 18} 19 20config("libdrm_config") { 21 # TODO(thomasanderson): Remove this hack once 22 # https://patchwork.kernel.org/patch/10545295/ lands. 23 defines = [ "typeof(x)=__typeof__(x)" ] 24 25 include_dirs = [ 26 "src", 27 "src/include", 28 "src/include/drm", 29 ] 30 31 # libdrm uses macros defined by <sys/types.h> which are being moved to 32 # <sys/sysmacros.h>. GLIBC headers give a pragma warning in this case. 33 # Suppress this warning for now. This may be removed once 34 # https://patchwork.kernel.org/patch/9628231/ lands. 35 cflags = [ "-Wno-#pragma-messages" ] 36 37 # glibc version >= 2.25 explicitly include <sys/sysmacros.h> 38 cflags += [ "-DMAJOR_IN_SYSMACROS=1" ] 39 40 # TODO(b/357680612): unused function 'swap32'. 41 cflags += [ "-Wno-unused-function" ] 42 43 if (is_clang) { 44 cflags += [ 45 "-Wno-enum-conversion", 46 47 # TODO(crbug.com/932060) fix unused result from asprintf in modetest.c. 48 "-Wno-unused-result", 49 50 # modetest.c has an improper conversion in a printf statement. 51 "-Wno-format", 52 ] 53 } 54} 55 56static_library("libdrm") { 57 sources = [ 58 "src/include/drm/drm.h", 59 "src/include/drm/drm_fourcc.h", 60 "src/include/drm/drm_mode.h", 61 "src/libdrm_macros.h", 62 "src/util_math.h", 63 "src/xf86drm.c", 64 "src/xf86drm.h", 65 "src/xf86drmHash.c", 66 "src/xf86drmHash.h", 67 "src/xf86drmMode.c", 68 "src/xf86drmMode.h", 69 "src/xf86drmRandom.c", 70 "src/xf86drmRandom.h", 71 ] 72 73 deps = [ ":make_generated_static_table_fourcc" ] 74 75 include_dirs = [ 76 get_path_info(generated_static_table_fourcc_file, "dir"), 77 "src", 78 "src/include", 79 ] 80 configs -= [ "//build/config/compiler:chromium_code" ] 81 configs += [ "//build/config/compiler:no_chromium_code" ] 82 cflags = [ 83 # xf86drm.c uses readdir_r, which has been deprecated as of 84 # glibc-2.24. This causes a build error when using the Debian 85 # Stretch sysroot. 86 "-Wno-deprecated-declarations", 87 ] 88 89 public_configs = [ ":libdrm_config" ] 90} 91 92executable("modetest") { 93 sources = [ 94 "src/tests/modetest/buffers.c", 95 "src/tests/modetest/buffers.h", 96 "src/tests/modetest/cursor.c", 97 "src/tests/modetest/cursor.h", 98 "src/tests/modetest/modetest.c", 99 "src/tests/util/common.h", 100 "src/tests/util/format.c", 101 "src/tests/util/format.h", 102 "src/tests/util/kms.c", 103 "src/tests/util/kms.h", 104 "src/tests/util/pattern.c", 105 "src/tests/util/pattern.h", 106 ] 107 108 include_dirs = [ 109 "src/tests", 110 "src/tests/modetest", 111 ] 112 113 configs -= [ "//build/config/compiler:chromium_code" ] 114 configs += [ "//build/config/compiler:no_chromium_code" ] 115 configs += [ ":libdrm_config" ] 116 117 deps = [ ":libdrm" ] 118} 119