ozone.gni 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Copyright 2020 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/chromecast_build.gni")
  5. import("//build/config/chromeos/ui_mode.gni")
  6. import("//build/toolchain/toolchain.gni")
  7. declare_args() {
  8. # Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
  9. # that does not require X11.
  10. use_ozone = is_chromeos || is_fuchsia || is_linux
  11. }
  12. declare_args() {
  13. # Ozone extra platforms file path. Can be overridden to build out of
  14. # tree ozone platforms.
  15. ozone_extra_path = "//build/config/ozone_extra.gni"
  16. # Select platforms automatically. Turn this off for manual control.
  17. ozone_auto_platforms = use_ozone
  18. # TODO(petermcneeley): Backwards compatiblity support for VM images.
  19. # Remove when deprecated. (https://crbug.com/1122009)
  20. ozone_platform_gbm = -1
  21. # Enable explicit apitrace (https://apitrace.github.io) loading.
  22. # This requires apitrace library with additional bindings.
  23. # See ChromeOS package for details:
  24. # https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2659419
  25. # Chrome will not start without an apitrace.so library.
  26. # Trace will be saved to /tmp/gltrace.dat file by default. You can
  27. # override it at run time with TRACE_FILE=<path> environment variable.
  28. enable_opengl_apitrace = false
  29. }
  30. declare_args() {
  31. # The platform that will used at runtime by default. This can be overridden
  32. # with the command line flag --ozone-platform=<platform>.
  33. ozone_platform = ""
  34. # Compile the 'cast' platform.
  35. ozone_platform_cast = false
  36. # Compile the 'drm' platform.
  37. ozone_platform_drm = false
  38. # Compile the 'headless' platform.
  39. ozone_platform_headless = false
  40. # Compile the 'scenic' platform.
  41. ozone_platform_scenic = false
  42. # Compile the 'flatland' platform.
  43. ozone_platform_flatland = false
  44. # Compile the 'x11' platform.
  45. ozone_platform_x11 = false
  46. # Compile the 'wayland' platform.
  47. ozone_platform_wayland = false
  48. if (ozone_auto_platforms) {
  49. # Use headless as the default platform unless modified below.
  50. ozone_platform = "headless"
  51. ozone_platform_headless = true
  52. if (is_cast_audio_only) {
  53. # Just use headless for audio-only Cast platforms.
  54. } else if (is_castos) {
  55. # Enable the Cast ozone platform on all video CastOS builds.
  56. ozone_platform_cast = true
  57. # For visual desktop Chromecast builds, override the default "headless"
  58. # platform with --ozone-platform=x11.
  59. # NOTE: The CQ is one such case.
  60. if (target_os == "linux" &&
  61. (target_cpu == "x86" || target_cpu == "x64")) {
  62. ozone_platform_x11 = true
  63. } else {
  64. ozone_platform = "cast"
  65. }
  66. } else if (is_chromeos_ash) {
  67. ozone_platform = "x11"
  68. ozone_platform_drm = true
  69. ozone_platform_x11 = true
  70. } else if (is_chromeos_lacros) {
  71. ozone_platform = "wayland"
  72. ozone_platform_wayland = true
  73. } else if (is_linux) {
  74. ozone_platform = "x11"
  75. ozone_platform_wayland = true
  76. ozone_platform_x11 = true
  77. } else if (is_fuchsia) {
  78. ozone_platform = "scenic"
  79. ozone_platform_scenic = true
  80. ozone_platform_flatland = true
  81. }
  82. }
  83. # TODO(petermcneeley): Backwards compatiblity support for VM images.
  84. # Remove when deprecated. (https://crbug.com/1122009)
  85. if (ozone_platform_gbm != -1) {
  86. ozone_platform_drm = ozone_platform_gbm
  87. }
  88. }
  89. import(ozone_extra_path)
  90. _ozone_extra_directory = get_path_info(ozone_extra_path, "dir")
  91. # Extra paths to add to targets visibility list.
  92. ozone_external_platform_visibility = [ "$_ozone_extra_directory/*" ]
  93. if (is_a_target_toolchain) {
  94. assert(use_ozone || !(ozone_platform_cast || ozone_platform_drm ||
  95. ozone_platform_flatland ||
  96. ozone_platform_headless || ozone_platform_x11 ||
  97. ozone_platform_wayland || ozone_platform_scenic),
  98. "Must set use_ozone to select ozone platforms")
  99. }
  100. # TODO(petermcneeley): Backwards compatiblity support for VM images.
  101. # Remove when deprecated. (https://crbug.com/1122009)
  102. assert(ozone_platform_gbm == -1 || ozone_platform_drm == ozone_platform_gbm)
  103. ozone_platform_gbm = ozone_platform_drm
  104. if (ozone_platform == "gbm") {
  105. ozone_platform = "drm"
  106. }