| # 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/ui.gni") |
| import("//testing/test.gni") |
| import("//tools/grit/grit_rule.gni") |
| |
| if (is_mac) { |
| import("//build/apple/tweak_info_plist.gni") |
| import("//build/config/mac/rules.gni") |
| } |
| |
| component("views_examples_lib") { |
| testonly = true |
| |
| sources = [ |
| "actions_example.cc", |
| "actions_example.h", |
| "animated_image_view_example.cc", |
| "animated_image_view_example.h", |
| "animation_example.cc", |
| "animation_example.h", |
| "ax_example.cc", |
| "ax_example.h", |
| "badge_example.cc", |
| "badge_example.h", |
| "box_layout_example.cc", |
| "box_layout_example.h", |
| "bubble_example.cc", |
| "bubble_example.h", |
| "button_example.cc", |
| "button_example.h", |
| "button_sticker_sheet.cc", |
| "button_sticker_sheet.h", |
| "checkbox_example.cc", |
| "checkbox_example.h", |
| "colored_dialog_example.cc", |
| "colored_dialog_example.h", |
| "colors_example.cc", |
| "colors_example.h", |
| "combobox_example.cc", |
| "combobox_example.h", |
| "create_examples.cc", |
| "create_examples.h", |
| "designer_example.cc", |
| "designer_example.h", |
| "dialog_example.cc", |
| "dialog_example.h", |
| "example_base.cc", |
| "example_base.h", |
| "example_combobox_model.cc", |
| "example_combobox_model.h", |
| "examples_action_id.h", |
| "examples_color_id.h", |
| "examples_color_mixer.cc", |
| "examples_color_mixer.h", |
| "examples_window.cc", |
| "examples_window.h", |
| "fade_animation.cc", |
| "fade_animation.h", |
| "flex_layout_example.cc", |
| "flex_layout_example.h", |
| "ink_drop_example.cc", |
| "ink_drop_example.h", |
| "label_example.cc", |
| "label_example.h", |
| "layout_example_base.cc", |
| "layout_example_base.h", |
| "link_example.cc", |
| "link_example.h", |
| "login_bubble_dialog_example.cc", |
| "login_bubble_dialog_example.h", |
| "menu_example.cc", |
| "menu_example.h", |
| "message_box_example.cc", |
| "message_box_example.h", |
| "multiline_example.cc", |
| "multiline_example.h", |
| "notification_example.cc", |
| "notification_example.h", |
| "progress_bar_example.cc", |
| "progress_bar_example.h", |
| "radio_button_example.cc", |
| "radio_button_example.h", |
| "scroll_view_example.cc", |
| "scroll_view_example.h", |
| "slider_example.cc", |
| "slider_example.h", |
| "square_ink_drop_example.cc", |
| "square_ink_drop_example.h", |
| "tabbed_pane_example.cc", |
| "tabbed_pane_example.h", |
| "table_example.cc", |
| "table_example.h", |
| "text_example.cc", |
| "text_example.h", |
| "textarea_example.cc", |
| "textarea_example.h", |
| "textfield_example.cc", |
| "textfield_example.h", |
| "throbber_example.cc", |
| "throbber_example.h", |
| "toggle_button_example.cc", |
| "toggle_button_example.h", |
| "tree_view_example.cc", |
| "tree_view_example.h", |
| "typography_example.cc", |
| "typography_example.h", |
| "vector_example.cc", |
| "vector_example.h", |
| "views_examples_export.h", |
| "widget_example.cc", |
| "widget_example.h", |
| ] |
| |
| defines = [ |
| "GFX_VECTOR_ICONS_UNSAFE", |
| "VIEWS_EXAMPLES_IMPLEMENTATION", |
| ] |
| |
| deps = [ |
| ":views_examples_resources_grd", |
| ":views_examples_resources_pak", |
| "//base", |
| "//cc/paint", |
| "//skia", |
| "//third_party/icu", |
| "//ui/actions", |
| "//ui/base", |
| "//ui/color", |
| "//ui/events", |
| "//ui/gfx", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| "//ui/lottie", |
| "//ui/menus", |
| "//ui/message_center", |
| "//ui/native_theme", |
| "//ui/resources", |
| "//ui/resources:ui_test_pak", |
| "//ui/strings:ui_strings", |
| "//ui/views", |
| ] |
| |
| public_deps = [ |
| "//ui/base/mojom", |
| "//ui/base/mojom:ui_base_types", |
| ] |
| |
| if (is_win) { |
| deps += [ "//third_party/wtl" ] |
| } |
| |
| if (use_aura) { |
| deps += [ "//ui/aura" ] |
| } |
| } |
| |
| source_set("views_examples_proc") { |
| testonly = true |
| |
| sources = [ |
| "examples_exit_code.h", |
| "examples_main_proc.cc", |
| "examples_main_proc.h", |
| ] |
| |
| deps = [ |
| ":views_examples_lib", |
| "//base", |
| "//base/test:test_support", |
| "//cc/paint", |
| "//components/viz/host", |
| "//components/viz/service", |
| "//mojo/core/embedder", |
| "//skia", |
| "//ui/accessibility:test_support", |
| "//ui/base", |
| "//ui/color:mixers", |
| "//ui/compositor", |
| "//ui/compositor:test_support", |
| "//ui/gfx", |
| "//ui/views", |
| "//ui/views:test_support", |
| ] |
| |
| if (is_win || is_mac || is_linux) { |
| sources += [ |
| "examples_skia_gold_pixel_diff.cc", |
| "examples_skia_gold_pixel_diff.h", |
| ] |
| deps += [ |
| "//ui/base:pixel_diff_test_support", |
| "//ui/native_theme", |
| "//ui/snapshot", |
| ] |
| } |
| |
| if (is_win) { |
| deps += [ "//build/win:default_exe_manifest" ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "examples_main_proc_mac_parts.h", |
| "examples_main_proc_mac_parts.mm", |
| ] |
| } |
| |
| if (use_aura) { |
| deps += [ |
| "//ui/aura", |
| "//ui/wm", |
| ] |
| } |
| if (is_chromeos) { |
| sources += [ |
| "examples_views_delegate_chromeos.cc", |
| "examples_views_delegate_chromeos.h", |
| ] |
| deps += [ "//ui/wm:test_support" ] |
| } |
| } |
| |
| source_set("views_examples_main_header") { |
| testonly = true |
| sources = [ "examples_main.h" ] |
| deps = [ "//base" ] |
| } |
| |
| source_set("views_examples_main") { |
| testonly = true |
| sources = [ "examples_main.cc" ] |
| deps = [ |
| ":views_examples_main_header", |
| ":views_examples_proc", |
| "//base", |
| "//base/test:test_support", |
| ] |
| |
| if (is_mac) { |
| deps += [ ":views_examples_main_mac_support" ] |
| } |
| } |
| |
| if (is_mac) { |
| source_set("views_examples_main_mac_support") { |
| testonly = true |
| sources = [ |
| "examples_main_mac_support.h", |
| "examples_main_mac_support.mm", |
| ] |
| deps = [ "//base" ] |
| } |
| |
| # Update views_examples_mac_support.mm if the below changes. |
| views_examples_app_name = "Views Examples" |
| views_examples_version = "1.0.0.0" |
| views_examples_framework_name = "$views_examples_app_name Framework" |
| |
| tweak_info_plist("views_examples_plist") { |
| testonly = true |
| info_plist = "views_examples.plist" |
| args = [ |
| "--scm=1", |
| "--version", |
| views_examples_version, |
| ] |
| } |
| |
| mac_app_bundle("views_examples") { |
| testonly = true |
| output_name = views_examples_app_name |
| info_plist_target = ":views_examples_plist" |
| |
| sources = [ "examples_main_mac.cc" ] |
| |
| deps = [ |
| ":views_examples_framework_bundle_data", |
| ":views_examples_main_header", |
| ":views_examples_resources_bundle_data", |
| ] |
| |
| if (is_component_build) { |
| ldflags = [ "-Wl,-rpath,@executable_path/../Frameworks" ] |
| } |
| } |
| |
| bundle_data("views_examples_resources_bundle_data") { |
| testonly = true |
| sources = [ "app.icns" ] |
| outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] |
| } |
| |
| bundle_data("views_examples_framework_bundle_data") { |
| testonly = true |
| sources = [ "$root_out_dir/$views_examples_framework_name.framework" ] |
| outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ] |
| if (is_component_build) { |
| # In a component build, the framework is directly linked to the |
| # executable because dlopen() and loading all the dependent dylibs |
| # is time-consuming, see https://crbug.com/1197495. |
| public_deps = [ ":views_examples_framework+link" ] |
| } else { |
| public_deps = [ ":views_examples_framework" ] |
| } |
| } |
| |
| tweak_info_plist("views_examples_framework_plist") { |
| testonly = true |
| info_plist = "views_examples_framework.plist" |
| args = [ |
| "--breakpad=0", |
| "--keystone=0", |
| "--scm=1", |
| "--version", |
| views_examples_version, |
| "--branding", |
| views_examples_app_name, |
| ] |
| } |
| |
| mac_framework_bundle("views_examples_framework") { |
| testonly = true |
| |
| output_name = "$views_examples_framework_name" |
| |
| framework_version = views_examples_version |
| |
| framework_contents = [ |
| "Libraries", |
| "Resources", |
| ] |
| |
| deps = [ |
| ":views_examples_angle_binaries", |
| ":views_examples_main", |
| "//third_party/icu:icudata", |
| ] |
| |
| bundle_deps = [ ":views_examples_framework_resources" ] |
| |
| if (is_component_build) { |
| # Needed so that the views_examples Mac Main can find the framework. |
| ldflags = |
| [ "-Wl,-install_name,@rpath/$output_name.framework/$output_name" ] |
| |
| # Set up the rpath for the framework so that it can find dylibs in the |
| # root output directory. The framework is at |
| # Views Examples.app/Contents/Frameworks/Views Examples Framework.framework/Versions/[views_examples_version]/Views Examples Framework |
| # so use loader_path to go back to the root output directory. |
| ldflags += [ "-Wl,-rpath,@loader_path/../../../../../.." ] |
| } else { |
| # Specify a sensible install_name for static builds. The library is |
| # dlopen()ed so this is not used to resolve the module. |
| ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name.framework" ] |
| deps += [ "//base/test:test_trace_processor_bundle_data" ] |
| } |
| |
| info_plist_target = ":views_examples_framework_plist" |
| } |
| |
| bundle_data("views_examples_framework_resources") { |
| testonly = true |
| |
| sources = [ |
| "$root_out_dir/icudtl.dat", |
| "$root_out_dir/ui_test.pak", |
| "$root_out_dir/views_examples_resources.pak", |
| ] |
| public_deps = [ |
| ":views_examples_resources_pak", |
| "//ui/resources:ui_test_pak", |
| ] |
| deps = [ "//third_party/icu:icudata" ] |
| |
| outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] |
| } |
| |
| # Add the ANGLE .dylibs in the Libraries directory of the Framework. |
| bundle_data("views_examples_angle_binaries") { |
| sources = [ |
| "$root_out_dir/egl_intermediates/libEGL.dylib", |
| "$root_out_dir/egl_intermediates/libGLESv2.dylib", |
| ] |
| outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] |
| public_deps = [ "//ui/gl:angle_library_copy" ] |
| } |
| } else { |
| executable("views_examples") { |
| testonly = true |
| |
| deps = [ |
| ":views_examples_main", |
| "//build/win:default_exe_manifest", |
| ] |
| } |
| } |
| |
| component("views_examples_with_content_lib") { |
| testonly = true |
| sources = [ |
| "examples_window_with_content.cc", |
| "examples_window_with_content.h", |
| "views_examples_with_content_export.h", |
| "webview_example.cc", |
| "webview_example.h", |
| ] |
| |
| defines = [ "VIEWS_EXAMPLES_WITH_CONTENT_IMPLEMENTATION" ] |
| |
| deps = [ |
| ":views_examples_resources_grd", |
| ":views_examples_resources_pak", |
| "//base", |
| "//content", |
| "//skia", |
| "//ui/events", |
| "//ui/views", |
| "//ui/views/controls/webview", |
| "//url", |
| ] |
| public_deps = [ ":views_examples_lib" ] |
| } |
| |
| executable("views_examples_with_content") { |
| testonly = true |
| |
| sources = [ "examples_with_content_main.cc" ] |
| |
| defines = [ "VIEWS_EXAMPLES_WITH_CONTENT_IMPLEMENTATION" ] |
| |
| deps = [ |
| ":copy_content_resources", |
| ":views_examples_with_content_lib", |
| "//base", |
| "//build/win:default_exe_manifest", |
| "//content", |
| "//content:sandbox_helper_win", |
| "//sandbox", |
| "//ui/color:mixers", |
| "//ui/views_content_client", |
| ] |
| |
| if (is_win) { |
| configs += [ "//build/config/win:windowed" ] |
| configs -= [ "//build/config/win:console" ] |
| } |
| |
| if (is_mac) { |
| deps += [ "//sandbox/mac:seatbelt" ] |
| } |
| } |
| |
| copy("copy_content_resources") { |
| deps = [ "//content:content_resources" ] |
| sources = [ "$root_gen_dir/content/content_resources.pak" ] |
| outputs = [ "$root_out_dir/content_resources.pak" ] |
| } |
| |
| grit("views_examples_resources_grd") { |
| testonly = true |
| source = "views_examples_resources.grd" |
| outputs = [ |
| "grit/views_examples_resources.h", |
| "views_examples_resources.pak", |
| ] |
| } |
| |
| copy("views_examples_resources_pak") { |
| testonly = true |
| sources = [ "$target_gen_dir/views_examples_resources.pak" ] |
| outputs = [ "$root_out_dir/views_examples_resources.pak" ] |
| public_deps = [ ":views_examples_resources_grd" ] |
| } |
| |
| test("views_examples_unittests") { |
| use_xvfb = use_xvfb_in_this_config |
| |
| sources = [ |
| "examples_unittest.cc", |
| "examples_unittest_main.cc", |
| ] |
| |
| deps = [ |
| ":views_examples_lib", |
| ":views_examples_proc", |
| "//base", |
| "//base/test:test_support", |
| "//components/viz/host", |
| "//components/viz/service", |
| "//mojo/core/embedder", |
| "//ui/base", |
| "//ui/base/ime/init", |
| "//ui/compositor", |
| "//ui/compositor:test_support", |
| "//ui/gfx", |
| "//ui/gl", |
| "//ui/gl/init", |
| "//ui/resources:ui_test_pak", |
| "//ui/snapshot", |
| "//ui/views", |
| "//ui/views:test_support", |
| ] |
| |
| if (use_aura) { |
| deps += [ |
| "//ui/aura", |
| "//ui/wm", |
| ] |
| } |
| |
| if (is_fuchsia) { |
| additional_manifest_fragments = [ |
| "//build/config/fuchsia/test/fonts.shard.test-cml", |
| "//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml", |
| ] |
| } |
| |
| data_deps = [ |
| ":views_examples_resources_pak", |
| "//testing/buildbot/filters:views_examples_unittests_filters", |
| "//ui/resources:ui_test_pak_data", |
| ] |
| |
| data = [ "$root_out_dir/views_examples_resources.pak" ] |
| } |