BUILD.gn 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. # Copyright 2014 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/chrome_build.gni")
  5. import("//build/config/chromecast_build.gni")
  6. import("//build/config/chromeos/ui_mode.gni")
  7. import("//build/config/ui.gni")
  8. import("//gpu/vulkan/features.gni")
  9. import("//skia/features.gni")
  10. import("//ui/gl/features.gni")
  11. if (is_android) {
  12. import("//build/config/android/rules.gni")
  13. }
  14. group("config") {
  15. if (is_component_build) {
  16. public_deps = [ "//gpu" ]
  17. } else {
  18. public_deps = [ ":config_sources" ]
  19. }
  20. }
  21. process_json_outputs = [
  22. "$target_gen_dir/gpu_driver_bug_list_arrays_and_structs_autogen.h",
  23. "$target_gen_dir/gpu_driver_bug_list_autogen.cc",
  24. "$target_gen_dir/gpu_driver_bug_list_autogen.h",
  25. "$target_gen_dir/gpu_driver_bug_list_exceptions_autogen.h",
  26. "$target_gen_dir/software_rendering_list_arrays_and_structs_autogen.h",
  27. "$target_gen_dir/software_rendering_list_autogen.cc",
  28. "$target_gen_dir/software_rendering_list_autogen.h",
  29. "$target_gen_dir/software_rendering_list_exceptions_autogen.h",
  30. ]
  31. action("process_json") {
  32. script = "process_json.py"
  33. inputs = [
  34. "gpu_driver_bug_list.json",
  35. "gpu_driver_bug_workaround_type.h",
  36. "gpu_feature_type.h",
  37. "software_rendering_list.json",
  38. ]
  39. outputs = process_json_outputs
  40. args = [
  41. "--output-dir",
  42. rebase_path("$target_gen_dir", root_build_dir),
  43. "--skip-testing-data",
  44. "--os-filter",
  45. ]
  46. if (is_win) {
  47. args += [ "win" ]
  48. } else if (is_mac) {
  49. args += [ "macosx" ]
  50. } else if (is_android) {
  51. args += [ "android" ]
  52. } else if (is_chromeos) {
  53. args += [ "chromeos" ]
  54. } else if (is_fuchsia) {
  55. args += [ "fuchsia" ]
  56. } else {
  57. args += [ "linux" ]
  58. }
  59. public_deps = [ ":workaround_list" ]
  60. }
  61. action("workaround_list") {
  62. script = "build_workaround_header.py"
  63. skia_workaround_list = "//third_party/skia/src/gpu/gpu_workaround_list.txt"
  64. inputs = [
  65. "gpu_workaround_list.txt",
  66. skia_workaround_list,
  67. ]
  68. outputs = [ "$target_gen_dir/gpu_driver_bug_workaround_autogen.h" ]
  69. args = [
  70. "--output-file",
  71. rebase_path(outputs[0], root_build_dir),
  72. ]
  73. foreach(file, inputs) {
  74. args += [ rebase_path(file, root_build_dir) ]
  75. }
  76. }
  77. if (enable_vulkan) {
  78. component("vulkan_info") {
  79. sources = [
  80. "vulkan_info.cc",
  81. "vulkan_info.h",
  82. ]
  83. configs += [ "//gpu:gpu_implementation" ]
  84. deps = [ "//gpu/ipc/common:vulkan_interface" ]
  85. public_deps = [
  86. "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
  87. "//ui/gfx",
  88. ]
  89. # surpass linke error 4217. It is because vulkan_info depends on
  90. # //gpu/ipc/common:vulkan_interface and //gpu/ipc/common:vulkan_interface"
  91. # depends on this target.
  92. # TODO(penghuang): Fix this link error
  93. if (is_win && is_component_build) {
  94. ldflags = [ "/IGNORE:4217" ]
  95. }
  96. }
  97. }
  98. source_set("config_sources") {
  99. # External code should depend on this via //gpu/config above rather than
  100. # depending on this directly or the component build will break.
  101. visibility = [ "//gpu/*" ]
  102. sources = [
  103. "device_perf_info.cc",
  104. "device_perf_info.h",
  105. "dx_diag_node.cc",
  106. "dx_diag_node.h",
  107. "gpu_blocklist.cc",
  108. "gpu_blocklist.h",
  109. "gpu_control_list.cc",
  110. "gpu_control_list.h",
  111. "gpu_crash_keys.cc",
  112. "gpu_crash_keys.h",
  113. "gpu_domain_guilt.h",
  114. "gpu_driver_bug_list.cc",
  115. "gpu_driver_bug_list.h",
  116. "gpu_driver_bug_workaround_type.h",
  117. "gpu_driver_bug_workarounds.cc",
  118. "gpu_driver_bug_workarounds.h",
  119. "gpu_feature_info.cc",
  120. "gpu_feature_info.h",
  121. "gpu_feature_type.h",
  122. "gpu_finch_features.cc",
  123. "gpu_finch_features.h",
  124. "gpu_info.cc",
  125. "gpu_info.h",
  126. "gpu_info_collector.cc",
  127. "gpu_info_collector.h",
  128. "gpu_mode.h",
  129. "gpu_preferences.cc",
  130. "gpu_preferences.h",
  131. "gpu_switches.cc",
  132. "gpu_switches.h",
  133. "gpu_switching.cc",
  134. "gpu_switching.h",
  135. "gpu_test_config.cc",
  136. "gpu_test_config.h",
  137. "gpu_test_expectations_parser.cc",
  138. "gpu_test_expectations_parser.h",
  139. "gpu_util.cc",
  140. "gpu_util.h",
  141. "skia_limits.cc",
  142. "skia_limits.h",
  143. ]
  144. if (is_fuchsia) {
  145. sources += [ "gpu_info_collector_fuchsia.cc" ]
  146. }
  147. sources += process_json_outputs
  148. configs += [ "//gpu:gpu_implementation" ]
  149. public_deps = [ "//components/crash/core/common:crash_key" ]
  150. if (enable_vulkan) {
  151. public_deps += [ ":vulkan_info" ]
  152. }
  153. deps = [
  154. ":process_json",
  155. "//base",
  156. "//build:branding_buildflags",
  157. "//build:chromecast_buildflags",
  158. "//build:chromeos_buildflags",
  159. "//gpu/command_buffer/common:common_sources",
  160. "//gpu/ipc/common:gpu_preferences_interface",
  161. "//gpu/vulkan:buildflags",
  162. "//media:media_buildflags",
  163. "//skia:buildflags",
  164. "//third_party/re2",
  165. "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
  166. "//ui/gfx",
  167. "//ui/gl",
  168. "//ui/gl:buildflags",
  169. "//ui/gl/init",
  170. ]
  171. if (use_dawn || skia_use_dawn) {
  172. public_deps += [ "//third_party/dawn/include/dawn:headers" ]
  173. deps += [
  174. "//third_party/dawn/src/dawn:cpp",
  175. "//third_party/dawn/src/dawn:proc",
  176. "//third_party/dawn/src/dawn/native",
  177. ]
  178. }
  179. # GpuPreferences is using its own mojo bindings which creates a
  180. # cycle between this target and gpu_preferences_interface.
  181. allow_circular_includes_from =
  182. [ "//gpu/ipc/common:gpu_preferences_interface" ]
  183. # Prefer mesa GL headers to system headers, which cause problems on Win.
  184. include_dirs = [ "//third_party/mesa_headers" ]
  185. if (is_android) {
  186. sources += [ "gpu_info_collector_android.cc" ]
  187. }
  188. if (is_win) {
  189. sources += [
  190. "gpu_dx_diagnostics_win.cc",
  191. "gpu_info_collector_win.cc",
  192. ]
  193. libs = [
  194. "dxgi.lib",
  195. "dxguid.lib",
  196. ]
  197. if (is_chrome_branded && is_official_build) {
  198. sources += [
  199. "//third_party/amd/AmdCfxPxExt.h",
  200. "//third_party/amd/amd_videocard_info_win.cc",
  201. ]
  202. }
  203. }
  204. if (is_mac) {
  205. sources += [ "gpu_info_collector_mac.mm" ]
  206. frameworks = [ "OpenGL.framework" ]
  207. }
  208. if (is_linux || is_chromeos) {
  209. sources += [ "gpu_info_collector_linux.cc" ]
  210. }
  211. if (is_linux || is_chromeos || is_mac || is_fuchsia) {
  212. deps += [ "//third_party/angle:angle_gpu_info_util" ]
  213. }
  214. if (use_ozone) {
  215. deps += [ "//ui/ozone" ]
  216. }
  217. }
  218. if (is_android) {
  219. java_cpp_strings("java_switches_srcjar") {
  220. # External code should depend on ":config_java" instead.
  221. visibility = [ ":*" ]
  222. sources = [ "gpu_switches.cc" ]
  223. template = "android/java/src/org/chromium/gpu/config/GpuSwitches.java.tmpl"
  224. }
  225. java_cpp_features("java_features_srcjar") {
  226. # External code should depend on ":config_java" instead.
  227. visibility = [ ":*" ]
  228. sources = [ "gpu_finch_features.cc" ]
  229. template = "android/java/src/org/chromium/gpu/config/GpuFeatures.java.tmpl"
  230. }
  231. android_library("config_java") {
  232. # Right now, this only includes the Java switches/features. But if we need
  233. # more Java files, they should be added here as necessary.
  234. srcjar_deps = [
  235. ":java_features_srcjar",
  236. ":java_switches_srcjar",
  237. ]
  238. }
  239. }