123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- # Copyright 2020 The Chromium Authors. All rights reserved.
- # Use of this source code is governed by a BSD-style license that can be
- # found in the LICENSE file.
- import("//build/config/chrome_build.gni")
- import("//build/config/chromeos/ui_mode.gni")
- import("//build/config/devtools.gni")
- import("//build/config/ui.gni")
- shared_intermediate_dir = rebase_path(root_gen_dir, root_build_dir)
- devtools_grd_path = "$shared_intermediate_dir/$devtools_grd_location"
- devtools_grd_path_no_ext = get_path_info(devtools_grd_path, "dir") + "/" +
- get_path_info(devtools_grd_path, "name")
- # Prefer using this (and excluding specific platforms) when a resource applies
- # to (most) desktop platforms.
- assert(toolkit_views ==
- (is_chromeos || is_fuchsia || is_linux || is_mac || is_win))
- # Variables that are passed to grit with the -D flag.
- _grit_defines = [
- "DEVTOOLS_GRD_PATH=" + devtools_grd_path_no_ext,
- "SHARED_INTERMEDIATE_DIR=" + shared_intermediate_dir,
- "_google_chrome=${is_chrome_branded}",
- "chromeos_ash=${is_chromeos_ash}",
- "chromeos_lacros=${is_chromeos_lacros}",
- # This is related to Chrome OS.
- "reven=${is_reven}",
- "toolkit_views=${toolkit_views}",
- "use_aura=${use_aura}",
- "use_ozone=${use_ozone}",
- # Mac and iOS want Title Case strings.
- "use_titlecase=${is_apple}",
- ]
- # Must match `enable_hidpi` in ui/base/ui_features.gni.
- if (!is_android) {
- _grit_defines += [ "scale_factors=2x" ]
- }
- # Environment variables to be used by grit and its subproceses.
- _grit_environment_vars = [
- "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
- "root_src_dir=" + rebase_path("//", root_build_dir),
- ]
- if (is_chrome_branded) {
- _grit_environment_vars += [ "CHROMIUM_BUILD=google_chrome" ]
- } else {
- _grit_environment_vars += [ "CHROMIUM_BUILD=chromium" ]
- }
- if (is_android) {
- _grit_environment_vars += [ "ANDROID_JAVA_TAGGED_ONLY=true" ]
- }
- # Convert |_grit_defines| and |_grit_environment_vars| to command line flags.
- grit_args = []
- foreach(i, _grit_defines) {
- grit_args += [
- "-D",
- i,
- ]
- }
- foreach(i, _grit_environment_vars) {
- grit_args += [
- "-E",
- i,
- ]
- }
- # When cross-compiling, explicitly pass the target system to grit.
- # There's an exception for Chrome OS, as the toolchain can be the same
- # as linux, but the target platform still must be set.
- if (current_toolchain != host_toolchain || is_chromeos) {
- _target_platform = ""
- if (is_android) {
- _target_platform = "android"
- }
- if (is_fuchsia) {
- _target_platform = "fuchsia"
- }
- if (is_ios) {
- _target_platform = "ios"
- }
- if (is_linux) {
- _target_platform = "linux"
- }
- if (is_chromeos) {
- _target_platform = "chromeos"
- }
- if (is_mac) {
- _target_platform = "darwin"
- }
- if (is_win) {
- _target_platform = "win32"
- }
- if (_target_platform != "") {
- grit_args += [
- "-t",
- _target_platform,
- ]
- }
- }
|