• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 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.
4
5import("//build/buildflag_header.gni")
6import("//build/config/cast.gni")
7import("//build/config/chrome_build.gni")
8import("//build/config/chromeos/args.gni")
9import("//build/config/features.gni")
10import("//build/util/process_version.gni")
11import("//build_overrides/build.gni")
12
13if (is_ios) {
14  import("//build/config/ios/ios_sdk.gni")
15}
16
17source_set("buildflag_header_h") {
18  sources = [ "buildflag.h" ]
19}
20
21buildflag_header("branding_buildflags") {
22  header = "branding_buildflags.h"
23
24  if (is_chrome_branded) {
25    flags = [
26      "CHROMIUM_BRANDING=false",
27      "GOOGLE_CHROME_BRANDING=true",
28    ]
29  } else {
30    flags = [
31      "CHROMIUM_BRANDING=true",
32      "GOOGLE_CHROME_BRANDING=false",
33    ]
34  }
35
36  if (is_chrome_for_testing) {
37    assert(!is_chrome_branded,
38           "`is_chrome_for_testing` is incompatible with `is_chrome_branded`")
39
40    flags += [ "CHROME_FOR_TESTING=true" ]
41  } else {
42    flags += [ "CHROME_FOR_TESTING=false" ]
43  }
44
45  # Note: `GOOGLE_CHROME_FOR_TESTING_BRANDING` and `CHROMIUM_BRANDING` are not
46  # mutually exclusive.
47  if (is_chrome_for_testing_branded) {
48    assert(is_chrome_for_testing,
49           "`is_chrome_for_testing_branded` requires `is_chrome_for_testing`")
50
51    flags += [ "GOOGLE_CHROME_FOR_TESTING_BRANDING=true" ]
52  } else {
53    flags += [ "GOOGLE_CHROME_FOR_TESTING_BRANDING=false" ]
54  }
55}
56
57buildflag_header("blink_buildflags") {
58  header = "blink_buildflags.h"
59  flags = [ "USE_BLINK=$use_blink" ]
60}
61
62buildflag_header("chromecast_buildflags") {
63  header = "chromecast_buildflags.h"
64
65  flags = [
66    "IS_CASTOS=$is_castos",
67    "IS_CAST_ANDROID=$is_cast_android",
68    "ENABLE_CAST_RECEIVER=$enable_cast_receiver",
69  ]
70}
71
72buildflag_header("chromeos_buildflags") {
73  header = "chromeos_buildflags.h"
74
75  flags = [
76    "IS_CHROMEOS_DEVICE=$is_chromeos_device",
77
78    # TODO(b:354842935): Remove once all the occurrence of IS_CHROMEOS_ASH is
79    # removed from cc files.
80    "IS_CHROMEOS_ASH=$is_chromeos",
81    "IS_CHROMEOS_WITH_HW_DETAILS=$is_chromeos_with_hw_details",
82    "IS_REVEN=$is_reven",
83  ]
84}
85
86buildflag_header("robolectric_buildflags") {
87  header = "robolectric_buildflags.h"
88  flags = [ "IS_ROBOLECTRIC=$is_robolectric" ]
89}
90
91buildflag_header("ios_buildflags") {
92  header = "ios_buildflags.h"
93  _is_ios_app_extension = is_ios && ios_is_app_extension
94  flags = [ "IS_IOS_APP_EXTENSION=$_is_ios_app_extension" ]
95}
96
97#
98# NOTE: IS_DESKTOP_ANDROID should be used sparingly.
99#
100# General Recommendation:
101#   Avoid using this build time flag whenever possible. Rely on runtime
102#   detection of features such as:
103#     - Large screen availability
104#     - Input modalities (e.g., touch, keyboard, mouse)
105#     - Relevant Android system flags.
106#
107# DO:
108#   - Use this flag ONLY for features with substantial binary size impact,
109#     such as DevTools or Extensions, which contain significant code and
110#     resource sizes.
111#
112# DON'T:
113#   - Use this flag to enable feature flags or experiments.
114#   - Use this flag in code shared with Android WebView.
115#     Restrict its usage to the //chrome code directory whenever possible.
116#
117# If you're unsure please reach out to is-android-desktop-help@google.com
118#
119buildflag_header("android_buildflags") {
120  header = "android_buildflags.h"
121  flags = [ "IS_DESKTOP_ANDROID=$is_desktop_android" ]
122}
123
124if (build_with_chromium) {
125  group("gold_common_pytype") {
126    testonly = true
127
128    data = [ "//build/skia_gold_common/" ]
129
130    data_deps = [ "//testing:pytype_dependencies" ]
131  }
132}
133
134if (is_chromeos) {
135  process_version("version_metadata") {
136    sources = [ "//chrome/VERSION" ]
137
138    template_file = "metadata.json.in"
139    output = "$root_out_dir/metadata.json"
140    process_only = true
141  }
142}
143