BUILD.gn 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Copyright 2021 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. import("//build/config/mac/mac_sdk.gni")
  5. import("//build/toolchain/apple/toolchain.gni")
  6. import("//build_overrides/build.gni")
  7. # Specialisation of the apple_toolchain template to declare the toolchain
  8. # and its tools to build target for macOS platform.
  9. template("mac_toolchain") {
  10. assert(defined(invoker.toolchain_args),
  11. "Toolchains must declare toolchain_args")
  12. apple_toolchain(target_name) {
  13. forward_variables_from(invoker, "*", [ "toolchain_args" ])
  14. bin_path = mac_bin_path
  15. toolchain_args = {
  16. forward_variables_from(invoker.toolchain_args, "*")
  17. current_os = "mac"
  18. if (target_os == "ios") {
  19. # Use LLD for the host part of a chrome/ios build.
  20. use_lld = true
  21. # Override `is_component_build` for the host toolchain.
  22. # See https://crbug.com/gn/286 for details why this is
  23. # required.
  24. is_component_build = is_debug
  25. # Defined in //base, would trigger a warning if the build doesn't depend
  26. # on it.
  27. if (build_with_chromium) {
  28. # cronet disable this because it targets 32-bit,
  29. # enable it unconditionally for the host toolchain.
  30. use_allocator_shim = true
  31. }
  32. # TODO(crbug.com/753445): the use_sanitizer_coverage arg is currently
  33. # not supported by the Chromium mac_clang_x64 toolchain on iOS
  34. # distribution.
  35. use_sanitizer_coverage = false
  36. }
  37. }
  38. }
  39. }
  40. mac_toolchain("clang_arm") {
  41. toolchain_args = {
  42. current_cpu = "arm"
  43. }
  44. }
  45. mac_toolchain("clang_arm64") {
  46. toolchain_args = {
  47. current_cpu = "arm64"
  48. }
  49. }
  50. mac_toolchain("clang_x64") {
  51. toolchain_args = {
  52. current_cpu = "x64"
  53. }
  54. }
  55. mac_toolchain("clang_x86") {
  56. toolchain_args = {
  57. current_cpu = "x86"
  58. }
  59. }
  60. mac_toolchain("clang_x86_v8_arm") {
  61. toolchain_args = {
  62. current_cpu = "x86"
  63. if (defined(v8_current_cpu)) {
  64. v8_current_cpu = "arm"
  65. }
  66. }
  67. }
  68. mac_toolchain("clang_x86_v8_mipsel") {
  69. toolchain_args = {
  70. current_cpu = "x86"
  71. if (defined(v8_current_cpu)) {
  72. v8_current_cpu = "mipsel"
  73. }
  74. }
  75. }
  76. mac_toolchain("clang_x64_v8_arm64") {
  77. toolchain_args = {
  78. current_cpu = "x64"
  79. if (defined(v8_current_cpu)) {
  80. v8_current_cpu = "arm64"
  81. }
  82. }
  83. }
  84. mac_toolchain("clang_x64_v8_mips64el") {
  85. toolchain_args = {
  86. current_cpu = "x64"
  87. if (defined(v8_current_cpu)) {
  88. v8_current_cpu = "mips64el"
  89. }
  90. }
  91. }
  92. mac_toolchain("clang_arm64_v8_x64") {
  93. toolchain_args = {
  94. current_cpu = "arm64"
  95. if (defined(v8_current_cpu)) {
  96. v8_current_cpu = "x64"
  97. }
  98. }
  99. }