BUILDCONFIG.gn 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. # Copyright (c) 2013 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. # =============================================================================
  5. # WHAT IS THIS FILE?
  6. # =============================================================================
  7. #
  8. # This is the master GN build configuration. This file is loaded after the
  9. # build args (args.gn) for the build directory and after the toplevel ".gn"
  10. # file (which points to this file as the build configuration).
  11. #
  12. # This file will be executed and the resulting context will be used to execute
  13. # every other file in the build. So variables declared here (that don't start
  14. # with an underscore) will be implicitly global.
  15. # =============================================================================
  16. # PLATFORM SELECTION
  17. # =============================================================================
  18. #
  19. # There are two main things to set: "os" and "cpu". The "toolchain" is the name
  20. # of the GN thing that encodes combinations of these things.
  21. #
  22. # Users typically only set the variables "target_os" and "target_cpu" in "gn
  23. # args", the rest are set up by our build and internal to GN.
  24. #
  25. # There are three different types of each of these things: The "host"
  26. # represents the computer doing the compile and never changes. The "target"
  27. # represents the main thing we're trying to build. The "current" represents
  28. # which configuration is currently being defined, which can be either the
  29. # host, the target, or something completely different (like nacl). GN will
  30. # run the same build file multiple times for the different required
  31. # configuration in the same build.
  32. #
  33. # This gives the following variables:
  34. # - host_os, host_cpu, host_toolchain
  35. # - target_os, target_cpu, default_toolchain
  36. # - current_os, current_cpu, current_toolchain.
  37. #
  38. # Note the default_toolchain isn't symmetrical (you would expect
  39. # target_toolchain). This is because the "default" toolchain is a GN built-in
  40. # concept, and "target" is something our build sets up that's symmetrical with
  41. # its GYP counterpart. Potentially the built-in default_toolchain variable
  42. # could be renamed in the future.
  43. #
  44. # When writing build files, to do something only for the host:
  45. # if (current_toolchain == host_toolchain) { ...
  46. if (target_os == "") {
  47. target_os = host_os
  48. }
  49. if (target_cpu == "") {
  50. if (target_os == "android") {
  51. # If we're building for Android, we should assume that we want to
  52. # build for ARM by default, not the host_cpu (which is likely x64).
  53. # This allows us to not have to specify both target_os and target_cpu
  54. # on the command line.
  55. target_cpu = "arm"
  56. } else {
  57. target_cpu = host_cpu
  58. }
  59. }
  60. if (current_cpu == "") {
  61. current_cpu = target_cpu
  62. }
  63. if (current_os == "") {
  64. current_os = target_os
  65. }
  66. # =============================================================================
  67. # BUILD FLAGS
  68. # =============================================================================
  69. #
  70. # This block lists input arguments to the build, along with their default
  71. # values.
  72. #
  73. # If a value is specified on the command line, it will overwrite the defaults
  74. # given in a declare_args block, otherwise the default will be used.
  75. #
  76. # YOU SHOULD ALMOST NEVER NEED TO ADD FLAGS TO THIS FILE. GN allows any file in
  77. # the build to declare build flags. If you need a flag for a single component,
  78. # you can just declare it in the corresponding BUILD.gn file.
  79. #
  80. # - If your feature is a single target, say //components/foo, you can put
  81. # a declare_args() block in //components/foo/BUILD.gn and use it there.
  82. # Nobody else in the build needs to see the flag.
  83. #
  84. # - Defines based on build variables should be implemented via the generated
  85. # build flag header system. See //build/buildflag_header.gni. You can put
  86. # the buildflag_header target in the same file as the build flag itself. You
  87. # should almost never set "defines" directly.
  88. #
  89. # - If your flag toggles a target on and off or toggles between different
  90. # versions of similar things, write a "group" target that forwards to the
  91. # right target (or no target) depending on the value of the build flag. This
  92. # group can be in the same BUILD.gn file as the build flag, and targets can
  93. # depend unconditionally on the group rather than duplicating flag checks
  94. # across many targets.
  95. #
  96. # - If a semi-random set of build files REALLY needs to know about a define and
  97. # the above pattern for isolating the build logic in a forwarding group
  98. # doesn't work, you can put the argument in a .gni file. This should be put
  99. # in the lowest level of the build that knows about this feature (which should
  100. # almost always be outside of the //build directory!).
  101. #
  102. # Other flag advice:
  103. #
  104. # - Use boolean values when possible. If you need a default value that expands
  105. # to some complex thing in the default case (like the location of the
  106. # compiler which would be computed by a script), use a default value of -1 or
  107. # the empty string. Outside of the declare_args block, conditionally expand
  108. # the default value as necessary.
  109. #
  110. # - Use a name like "use_foo" or "is_foo" (whatever is more appropriate for
  111. # your feature) rather than just "foo".
  112. #
  113. # - Write good comments directly above the declaration with no blank line.
  114. # These comments will appear as documentation in "gn args --list".
  115. #
  116. # - Don't call exec_script inside declare_args. This will execute the script
  117. # even if the value is overridden, which is wasteful. See first bullet.
  118. declare_args() {
  119. # Set to enable the official build level of optimization. This has nothing
  120. # to do with branding, but enables an additional level of optimization above
  121. # release (!is_debug). This might be better expressed as a tri-state
  122. # (debug, release, official) but for historical reasons there are two
  123. # separate flags.
  124. #
  125. # IMPORTANT NOTE: (!is_debug) is *not* sufficient to get satisfying
  126. # performance. In particular, DCHECK()s are still enabled for release builds,
  127. # which can halve overall performance, and do increase memory usage. Always
  128. # set "is_official_build" to true for any build intended to ship to end-users.
  129. is_official_build = false
  130. # Set to true when compiling with the Clang compiler.
  131. is_clang = current_os != "linux" ||
  132. (current_cpu != "s390x" && current_cpu != "s390" &&
  133. current_cpu != "ppc64" && current_cpu != "ppc" &&
  134. current_cpu != "mips" && current_cpu != "mips64" &&
  135. current_cpu != "riscv64")
  136. # Allows the path to a custom target toolchain to be injected as a single
  137. # argument, and set as the default toolchain.
  138. custom_toolchain = ""
  139. # This should not normally be set as a build argument. It's here so that
  140. # every toolchain can pass through the "global" value via toolchain_args().
  141. host_toolchain = ""
  142. # DON'T ADD MORE FLAGS HERE. Read the comment above.
  143. }
  144. declare_args() {
  145. # Debug build. Enabling official builds automatically sets is_debug to false.
  146. is_debug = !is_official_build
  147. }
  148. declare_args() {
  149. # Component build. Setting to true compiles targets declared as "components"
  150. # as shared libraries loaded dynamically. This speeds up development time.
  151. # When false, components will be linked statically.
  152. #
  153. # For more information see
  154. # https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md
  155. is_component_build = is_debug && current_os != "ios"
  156. }
  157. assert(!(is_debug && is_official_build), "Can't do official debug builds")
  158. assert(!(current_os == "ios" && is_component_build),
  159. "Can't use component build on iOS")
  160. # ==============================================================================
  161. # TOOLCHAIN SETUP
  162. # ==============================================================================
  163. #
  164. # Here we set the default toolchain, as well as the variable host_toolchain
  165. # which will identify the toolchain corresponding to the local system when
  166. # doing cross-compiles. When not cross-compiling, this will be the same as the
  167. # default toolchain.
  168. #
  169. # We do this before anything else to make sure we complain about any
  170. # unsupported os/cpu combinations as early as possible.
  171. if (host_toolchain == "") {
  172. # This should only happen in the top-level context.
  173. # In a specific toolchain context, the toolchain_args()
  174. # block should have propagated a value down.
  175. # TODO(dpranke): Add some sort of assert here that verifies that
  176. # no toolchain omitted host_toolchain from its toolchain_args().
  177. if (host_os == "linux") {
  178. if (target_os != "linux") {
  179. host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
  180. } else if (is_clang) {
  181. host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
  182. } else {
  183. host_toolchain = "//build/toolchain/linux:$host_cpu"
  184. }
  185. } else if (host_os == "mac") {
  186. host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
  187. } else if (host_os == "win") {
  188. # On Windows always use the target CPU for host builds for x86/x64. On the
  189. # configurations we support this will always work and it saves build steps.
  190. # Windows ARM64 targets require an x64 host for cross build.
  191. if (target_cpu == "x86" || target_cpu == "x64") {
  192. if (is_clang) {
  193. host_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
  194. } else {
  195. host_toolchain = "//build/toolchain/win:$target_cpu"
  196. }
  197. } else if (is_clang) {
  198. host_toolchain = "//build/toolchain/win:win_clang_$host_cpu"
  199. } else {
  200. host_toolchain = "//build/toolchain/win:$host_cpu"
  201. }
  202. } else if (host_os == "aix") {
  203. host_toolchain = "//build/toolchain/aix:$host_cpu"
  204. } else if (host_os == "zos") {
  205. host_toolchain = "//build/toolchain/zos:$host_cpu"
  206. } else {
  207. assert(false, "Unsupported host_os: $host_os")
  208. }
  209. }
  210. _default_toolchain = ""
  211. if (target_os == "android") {
  212. assert(host_os == "linux" || host_os == "mac",
  213. "Android builds are only supported on Linux and Mac hosts.")
  214. _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
  215. } else if (target_os == "chromeos" || target_os == "linux") {
  216. # See comments in build/toolchain/cros/BUILD.gn about board compiles.
  217. if (is_clang) {
  218. _default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
  219. } else {
  220. _default_toolchain = "//build/toolchain/linux:$target_cpu"
  221. }
  222. } else if (target_os == "fuchsia") {
  223. _default_toolchain = "//build/toolchain/fuchsia:$target_cpu"
  224. } else if (target_os == "ios") {
  225. _default_toolchain = "//build/toolchain/ios:ios_clang_$target_cpu"
  226. } else if (target_os == "mac") {
  227. assert(host_os == "mac" || host_os == "linux",
  228. "Mac cross-compiles are unsupported.")
  229. _default_toolchain = "//build/toolchain/mac:clang_$target_cpu"
  230. } else if (target_os == "win") {
  231. # On Windows, we use the same toolchain for host and target by default.
  232. # Beware, win cross builds have some caveats, see docs/win_cross.md
  233. if (is_clang) {
  234. _default_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
  235. } else {
  236. _default_toolchain = "//build/toolchain/win:$target_cpu"
  237. }
  238. } else if (target_os == "winuwp") {
  239. # Only target WinUWP on for a Windows store application and only
  240. # x86, x64 and arm are supported target CPUs.
  241. assert(target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
  242. target_cpu == "arm64")
  243. _default_toolchain = "//build/toolchain/win:uwp_$target_cpu"
  244. } else if (target_os == "aix") {
  245. _default_toolchain = "//build/toolchain/aix:$target_cpu"
  246. } else if (target_os == "zos") {
  247. _default_toolchain = "//build/toolchain/zos:$target_cpu"
  248. } else {
  249. assert(false, "Unsupported target_os: $target_os")
  250. }
  251. # If a custom toolchain has been set in the args, set it as default. Otherwise,
  252. # set the default toolchain for the platform (if any).
  253. if (custom_toolchain != "") {
  254. set_default_toolchain(custom_toolchain)
  255. } else if (_default_toolchain != "") {
  256. set_default_toolchain(_default_toolchain)
  257. }
  258. # =============================================================================
  259. # OS DEFINITIONS
  260. # =============================================================================
  261. #
  262. # We set these various is_FOO booleans for convenience in writing OS-based
  263. # conditions.
  264. #
  265. # - is_android, is_chromeos, is_ios, and is_win should be obvious.
  266. # - is_mac is set only for desktop Mac. It is not set on iOS.
  267. # - is_posix is true for mac and any Unix-like system (basically everything
  268. # except Fuchsia and Windows).
  269. # - is_linux is true for desktop Linux, but not for ChromeOS nor Android (which
  270. # is generally too different despite being based on the Linux kernel).
  271. #
  272. # Do not add more is_* variants here for random lesser-used Unix systems like
  273. # aix or one of the BSDs. If you need to check these, just check the
  274. # current_os value directly.
  275. is_android = current_os == "android"
  276. is_chromeos = current_os == "chromeos"
  277. is_fuchsia = current_os == "fuchsia"
  278. is_ios = current_os == "ios"
  279. is_linux = current_os == "linux"
  280. is_mac = current_os == "mac"
  281. is_nacl = current_os == "nacl"
  282. is_win = current_os == "win" || current_os == "winuwp"
  283. is_apple = is_ios || is_mac
  284. is_posix = !is_win && !is_fuchsia
  285. # =============================================================================
  286. # TARGET DEFAULTS
  287. # =============================================================================
  288. #
  289. # Set up the default configuration for every build target of the given type.
  290. # The values configured here will be automatically set on the scope of the
  291. # corresponding target. Target definitions can add or remove to the settings
  292. # here as needed.
  293. #
  294. # WHAT GOES HERE?
  295. #
  296. # Other than the main compiler and linker configs, the only reason for a config
  297. # to be in this list is if some targets need to explicitly override that config
  298. # by removing it. This is how targets opt-out of flags. If you don't have that
  299. # requirement and just need to add a config everywhere, reference it as a
  300. # sub-config of an existing one, most commonly the main "compiler" one.
  301. # Holds all configs used for running the compiler.
  302. default_compiler_configs = [
  303. "//build/config:feature_flags",
  304. "//build/config/compiler:afdo",
  305. "//build/config/compiler:afdo_optimize_size",
  306. "//build/config/compiler:cet_shadow_stack",
  307. "//build/config/compiler:chromium_code",
  308. "//build/config/compiler:compiler",
  309. "//build/config/compiler:compiler_arm_fpu",
  310. "//build/config/compiler:compiler_arm_thumb",
  311. "//build/config/compiler:default_include_dirs",
  312. "//build/config/compiler:default_init_stack_vars",
  313. "//build/config/compiler:default_optimization",
  314. "//build/config/compiler:default_stack_frames",
  315. "//build/config/compiler:default_symbols",
  316. "//build/config/compiler:export_dynamic",
  317. "//build/config/compiler:no_exceptions",
  318. "//build/config/compiler:no_rtti",
  319. "//build/config/compiler:no_unresolved_symbols",
  320. "//build/config/compiler:runtime_library",
  321. "//build/config/compiler:thin_archive",
  322. "//build/config/compiler:thinlto_optimize_default",
  323. "//build/config/compiler/pgo:default_pgo_flags",
  324. "//build/config/coverage:default_coverage",
  325. "//build/config/sanitizers:default_sanitizer_flags",
  326. ]
  327. if (is_win) {
  328. default_compiler_configs += [
  329. "//build/config/win:default_cfg_compiler",
  330. "//build/config/win:default_crt",
  331. "//build/config/win:lean_and_mean",
  332. "//build/config/win:nominmax",
  333. "//build/config/win:unicode",
  334. "//build/config/win:winver",
  335. ]
  336. }
  337. if (is_posix) {
  338. if (current_os != "aix") {
  339. default_compiler_configs +=
  340. [ "//build/config/gcc:symbol_visibility_hidden" ]
  341. }
  342. }
  343. if (is_fuchsia) {
  344. default_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
  345. }
  346. if (is_android) {
  347. default_compiler_configs +=
  348. [ "//build/config/android:default_orderfile_instrumentation" ]
  349. }
  350. if (is_clang && !is_nacl) {
  351. default_compiler_configs += [
  352. "//build/config/clang:find_bad_constructs",
  353. "//build/config/clang:extra_warnings",
  354. ]
  355. }
  356. # Debug/release-related defines.
  357. if (is_debug) {
  358. default_compiler_configs += [ "//build/config:debug" ]
  359. } else {
  360. default_compiler_configs += [ "//build/config:release" ]
  361. }
  362. # Static libraries and source sets use only the compiler ones.
  363. set_defaults("static_library") {
  364. configs = default_compiler_configs
  365. }
  366. set_defaults("source_set") {
  367. configs = default_compiler_configs
  368. }
  369. set_defaults("rust_library") {
  370. configs = default_compiler_configs
  371. }
  372. set_defaults("rust_proc_macro") {
  373. configs = default_compiler_configs
  374. }
  375. # Compute the set of configs common to all linked targets (shared libraries,
  376. # loadable modules, executables) to avoid duplication below.
  377. if (is_win) {
  378. # Many targets remove these configs, so they are not contained within
  379. # //build/config:executable_config for easy removal.
  380. _linker_configs = [
  381. "//build/config/win:default_incremental_linking",
  382. # Default to console-mode apps. Most of our targets are tests and such
  383. # that shouldn't use the windows subsystem.
  384. "//build/config/win:console",
  385. ]
  386. } else if (is_mac) {
  387. _linker_configs = [ "//build/config/mac:strip_all" ]
  388. } else {
  389. _linker_configs = []
  390. }
  391. # Executable defaults.
  392. default_executable_configs = default_compiler_configs + [
  393. "//build/config:default_libs",
  394. "//build/config:executable_config",
  395. ] + _linker_configs
  396. if (is_win) {
  397. # Turn on linker CFI for executables, and position it so it can be removed
  398. # if needed.
  399. default_executable_configs += [ "//build/config/win:cfi_linker" ]
  400. }
  401. set_defaults("executable") {
  402. configs = default_executable_configs
  403. }
  404. # Shared library and loadable module defaults (also for components in component
  405. # mode).
  406. default_shared_library_configs = default_compiler_configs + [
  407. "//build/config:default_libs",
  408. "//build/config:shared_library_config",
  409. ] + _linker_configs
  410. if (is_win) {
  411. # Turn on linker CFI for DLLs, and position it so it can be removed if needed.
  412. default_shared_library_configs += [ "//build/config/win:cfi_linker" ]
  413. }
  414. if (is_android) {
  415. # Strip native JNI exports from shared libraries by default. Binaries that
  416. # want this can remove this config.
  417. default_shared_library_configs +=
  418. [ "//build/config/android:hide_all_but_jni_onload" ]
  419. }
  420. set_defaults("shared_library") {
  421. configs = default_shared_library_configs
  422. }
  423. set_defaults("loadable_module") {
  424. configs = default_shared_library_configs
  425. # loadable_modules are generally used by other libs, not just via JNI.
  426. if (is_android) {
  427. configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  428. }
  429. }
  430. # A helper for forwarding testonly and visibility.
  431. # Forwarding "*" does not include variables from outer scopes (to avoid copying
  432. # all globals into each template invocation), so it will not pick up
  433. # file-scoped or outer-template-scoped variables. Normally this behavior is
  434. # desired, but "visibility" and "testonly" are commonly defined in outer scopes.
  435. # Explicitly forwarding them in forward_variables_from() works around this
  436. # nuance. See //build/docs/writing_gn_templates.md#using-forward_variables_from
  437. TESTONLY_AND_VISIBILITY = [
  438. "testonly",
  439. "visibility",
  440. ]
  441. # Sets default dependencies for executable and shared_library targets.
  442. #
  443. # Variables
  444. # no_default_deps: If true, no standard dependencies will be added.
  445. # Targets that set this usually also want to remove
  446. # "//build/config/compiler:runtime_library" from configs (to remove
  447. # its subconfig "//build/config/c++:runtime_library").
  448. foreach(_target_type,
  449. [
  450. "executable",
  451. "loadable_module",
  452. "shared_library",
  453. ]) {
  454. template(_target_type) {
  455. # Alias "target_name" because it is clobbered by forward_variables_from().
  456. _target_name = target_name
  457. target(_target_type, _target_name) {
  458. forward_variables_from(invoker,
  459. "*",
  460. TESTONLY_AND_VISIBILITY + [ "no_default_deps" ])
  461. forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
  462. if (!defined(deps)) {
  463. deps = []
  464. }
  465. if (!defined(invoker.no_default_deps) || !invoker.no_default_deps) {
  466. # This pulls in one of:
  467. # //build/config:executable_deps
  468. # //build/config:loadable_module_deps
  469. # //build/config:shared_library_deps
  470. # (This explicit list is so that grepping for these configs finds where
  471. # they are used.)
  472. deps += [ "//build/config:${_target_type}_deps" ]
  473. }
  474. # On Android, write shared library output file to metadata. We will use
  475. # this information to, for instance, collect all shared libraries that
  476. # should be packaged into an APK.
  477. if (!defined(invoker.metadata) && is_android &&
  478. (_target_type == "shared_library" ||
  479. _target_type == "loadable_module")) {
  480. _output_name = _target_name
  481. if (defined(invoker.output_name)) {
  482. _output_name = invoker.output_name
  483. }
  484. # Remove 'lib' prefix from output name if it exists.
  485. _magic_prefix = "$0x01$0x01"
  486. _output_name = string_replace("${_magic_prefix}${_output_name}",
  487. "${_magic_prefix}lib",
  488. _magic_prefix,
  489. 1)
  490. _output_name = string_replace(_output_name, _magic_prefix, "", 1)
  491. if (defined(output_extension)) {
  492. _shlib_extension = ".$output_extension"
  493. } else if (is_component_build && _target_type != "loadable_module") {
  494. _shlib_extension = ".cr.so"
  495. } else {
  496. _shlib_extension = ".so"
  497. }
  498. metadata = {
  499. shared_libraries =
  500. [ "$root_out_dir/lib${_output_name}${_shlib_extension}" ]
  501. }
  502. }
  503. }
  504. }
  505. }
  506. # ==============================================================================
  507. # COMPONENT SETUP
  508. # ==============================================================================
  509. # Defines a component, which equates to a shared_library when
  510. # is_component_build == true and a static_library otherwise.
  511. #
  512. # Use static libraries for the static build rather than source sets because
  513. # many of of our test binaries link many large dependencies but often don't
  514. # use large portions of them. The static libraries are much more efficient to
  515. # link in this situation since only the necessary object files are linked.
  516. #
  517. # The invoker can override the type of the target in the non-component-build
  518. # case by setting static_component_type to either "source_set" or
  519. # "static_library". If unset, the default will be used.
  520. template("component") {
  521. if (is_component_build) {
  522. _component_mode = "shared_library"
  523. } else if (defined(invoker.static_component_type)) {
  524. assert(invoker.static_component_type == "static_library" ||
  525. invoker.static_component_type == "source_set")
  526. _component_mode = invoker.static_component_type
  527. } else if (!defined(invoker.sources) || invoker.sources == []) {
  528. # When there are no sources defined, use a source set to avoid creating
  529. # an empty static library (which generally don't work).
  530. _component_mode = "source_set"
  531. } else {
  532. _component_mode = "static_library"
  533. }
  534. target(_component_mode, target_name) {
  535. forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
  536. forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
  537. }
  538. }
  539. # Component defaults
  540. # Set a variable since we also want to make this available
  541. # to mixed_component.gni
  542. if (is_component_build) {
  543. default_component_configs = default_shared_library_configs
  544. if (is_android) {
  545. default_component_configs -=
  546. [ "//build/config/android:hide_all_but_jni_onload" ]
  547. }
  548. } else {
  549. default_component_configs = default_compiler_configs
  550. }
  551. set_defaults("component") {
  552. configs = default_component_configs
  553. }