# Copyright 2014 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/ozone.gni") import("//build/config/ui.gni") import("//tools/generate_library_loader/generate_library_loader.gni") assert(ozone_platform_x11) declare_args() { regenerate_x11_protos = false } config("x11_private_config") { visibility = [ ":*" ] defines = [ "IS_X11_IMPL" ] } config("build_xprotos_config") { cflags = [ "-Wno-shadow", # Generated proto files pull all fields from a struct into scope # even if they aren't used. Rather than adding logic in the # generator to determine which fields are used and keeping only # those, simply ignore unused variable warnings. "-Wno-unused-variable", ] } generate_library_loader("xlib_loader") { name = "XlibLoader" output_h = "xlib_loader.h" output_cc = "xlib_loader.cc" header = "\"ui/gfx/x/xlib.h\"" functions = [ "XInitThreads", "XOpenDisplay", "XCloseDisplay", "XFlush", "XSynchronize", "XSetErrorHandler", "XFree", "XPending", ] } generate_library_loader("xlib_xcb_loader") { name = "XlibXcbLoader" output_h = "xlib_xcb_loader.h" output_cc = "xlib_xcb_loader.cc" header = "\"ui/gfx/x/xlib_xcb.h\"" functions = [ "XGetXCBConnection" ] } protos = [ "bigreq", "dri3", "glx", "randr", "render", "screensaver", "shape", "shm", "sync", "xfixes", "xinput", "xkb", "xproto", "xtest", # Unused extensions: # "composite", # "damage", # "dpms", # "dri2", # "ge", # "present", # "record", # "res", # "xc_misc", # "xevie", # "xf86dri", # "xf86vidmode", # "xinerama", # "xprint", # "xselinux", # "xv", # "xvmc", ] proto_generated_files = [ "read_error.cc", "extension_manager.h", "extension_manager.cc", ] foreach(proto, protos) { proto_generated_files += [ "${proto}.h", "${proto}.cc", ] } if (regenerate_x11_protos) { xcbproto_path = "//third_party/xcbproto/src" action("gen_xprotos") { visibility = [ ":build_xprotos" ] script = "gen_xproto.py" sources = [] foreach(proto, protos) { sources += [ "$xcbproto_path/src/${proto}.xml" ] } outputs = [] foreach(proto_generated_file, proto_generated_files) { outputs += [ "$target_gen_dir/$proto_generated_file" ] } args = rebase_path([ xcbproto_path, target_gen_dir, ], root_build_dir) + protos } } else { copy("gen_xprotos") { sources = [] foreach(proto_generated_file, proto_generated_files) { sources += [ "generated_protos/$proto_generated_file" ] } outputs = [ "$target_gen_dir/{{source_file_part}}" ] } } source_set("build_xprotos") { visibility = [ ":x" ] deps = [ ":gen_xprotos", "//base", ] sources = get_target_outputs(":gen_xprotos") configs += [ ":build_xprotos_config", ":x11_private_config", ] } component("x") { output_name = "gfx_x11" sources = [ "atom_cache.cc", "atom_cache.h", "connection.cc", "connection.h", "error.cc", "error.h", "event.cc", "event.h", "event_observer.h", "future.cc", "future.h", "geometry_cache.cc", "geometry_cache.h", "keyboard_state.cc", "keyboard_state.h", "property_cache.cc", "property_cache.h", "randr_output_manager.cc", "randr_output_manager.h", "ref_counted_fd.cc", "ref_counted_fd.h", "visual_manager.cc", "visual_manager.h", "visual_picker_glx.cc", "visual_picker_glx.h", "window_cache.cc", "window_cache.h", "window_event_manager.cc", "window_event_manager.h", "wm_sync.cc", "wm_sync.h", "x11_crtc_resizer.cc", "x11_crtc_resizer.h", "x11_path.cc", "x11_path.h", "xlib_support.cc", "xlib_support.h", "xproto_internal.cc", "xproto_internal.h", "xproto_types.cc", "xproto_types.h", ] deps = [ ":xlib_loader", ":xlib_xcb_loader", "//base", "//base:i18n", "//skia", "//ui/events/platform", "//ui/gfx:gfx_switches", "//ui/gfx/geometry", ] public_deps = [ ":build_xprotos", "//ui/gfx/x/keysyms", ] configs += [ ":x11_private_config" ] libs = [ "xcb" ] } source_set("unit_test") { testonly = true sources = [ "connection_unittest.cc", "geometry_cache_unittest.cc", "property_cache_unittest.cc", "randr_output_manager_unittest.cc", "window_cache_unittest.cc", "wm_sync_unittest.cc", "x11_crtc_resizer_unittest.cc", ] deps = [ "//base", "//testing/gtest", "//ui/gfx/geometry", "//ui/gfx/x", ] }