Correctly track texture cleared state for sharing
[chromium-blink-merge.git] / chrome / BUILD.gn
blob70e49a5986a6d16b497702fa602d8f122142e4b2
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.
5 import("//build/config/features.gni")
6 import("//build/config/locales.gni")
7 import("//build/config/ui.gni")
8 import("//chrome/chrome_repack_locales.gni")
9 import("//chrome/version.gni")
11 if (is_android) {
12   import("//build/config/android/rules.gni")
15 if (!is_android) {
16   # TODO(GYP) for Windows need to the the reorder-imports step which probably
17   # means adding another target and renaming this to chrome_initial like in GYP.
18   executable("chrome") {
19     # Because the sources list varies so significantly per-platform, generally
20     # each platform lists its own files rather than relying on filtering or
21     # removing unused files.
22     sources = [
23       "app/chrome_exe_resource.h",
24     ]
25     deps = []
26     datadeps = []
28     # TODO(GYP) mac_bundle_resources, xcode_settings
30     # TODO(GYP) order_profiling, order_text_section
32     if (is_win) {
33       sources += [
34         "$target_gen_dir/chrome_exe_version.rc",
35         "app/chrome_exe_main_win.cc",
36         "app/client_util.cc",
37         "app/client_util.h",
38         "app/signature_validator_win.cc",
39         "app/signature_validator_win.h",
40         "//content/app/startup_helper_win.cc",
41       ]
42       deps += [
43         ":chrome_version_resources",
44         ":image_pre_reader",
45         "//chrome/browser:chrome_process_finder",
46         "//chrome/chrome_watcher",
47         "//chrome/chrome_watcher:client",
48         "//components/browser_watcher:browser_watcher_client",
49         "//ui/gfx",
50       ]
51     } else if (use_aura) {
52       # Non-Windows aura entrypoint.
53       sources += [ "app/chrome_exe_main_aura.cc" ]
54     }
56     if (is_linux) {
57       # TODO(GYP) manpage action
59       sources += [
60         "app/chrome_dll_resource.h",
61         "app/chrome_main.cc",
62         "app/chrome_main_delegate.cc",
63         "app/chrome_main_delegate.h",
64       ]
66       deps += [
67         # On Linux, link the dependencies (libraries) that make up actual
68         # Chromium functionality directly into the executable.
69         ":browser_dependencies",
70         ":child_dependencies",
71         "//base/allocator",
73         # Needed to use the master_preferences functions
74         "//chrome/installer/util",
75         "//content/public/app:both",
76       ]
78       # Needed for chrome_main.cc initialization of libraries.
79       configs += [ "//build/config/linux:pangocairo" ]
81       # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
82       #   'ldflags': [
83       #      '-pie',
84       #   ],
85       #}],
87       if (use_x11) {
88         configs += [
89           "//build/config/linux:x11",
90           "//build/config/linux:xext",
91         ]
92       }
93     }
95     if (is_mac) {
96       sources += [ "app/chrome_exe_main_mac.cc" ]
97       # TODO(GYP) lots more stuff in the is_mac block.
98     } else {  # Non-Mac.
99       deps += [
100         ":packed_extra_resources",
101         ":packed_resources",
103         # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
104         # file decide what to do on a per-OS basis; on Mac, internal plugins
105         # go inside the framework, so this dependency is in chrome_dll.gypi.
106         #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries',  TODO(GYP)
108         # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
109         # file decide what to do on a per-OS basis; on Mac, internal plugins
110         # go inside the framework, so this dependency is in chrome_dll.gypi.
111         #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',  TODO(GYP)
112       ]
113       # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
114     }
116     if (!is_mac) {
117       # On Mac this is done in chrome_dll.gypi.
118       datadeps += [ "//pdf" ]
119       # TODO(GYP) pdf linux symbols
120     }
121   }
122 }  # !is_android
124 shared_library("main_dll") {
125   configs += [ "//build/config/compiler:wexit_time_destructors" ]
127   deps = [
128     ":browser_dependencies",
129     "//base/allocator",
130   ]
131   if (is_win) {
132     output_name = "chrome"
134     sources = [
135       "app/chrome_command_ids.h",
136       "app/chrome_dll.rc",
137       "app/chrome_dll_resource.h",
138       "app/chrome_main.cc",
139       "app/chrome_main_delegate.cc",
140       "app/chrome_main_delegate.h",
141       "app/close_handle_hook_win.cc",
142       "app/close_handle_hook_win.h",
143       "app/delay_load_hook_win.cc",
144       "app/delay_load_hook_win.h",
145       "//base/win/dllmain.cc",
146     ]
148     deps += [
149       # On Windows, link the dependencies (libraries) that make up actual
150       # Chromium functionality into this .dll.
151       ":chrome_version_resources",
152       "//chrome/app/theme:chrome_unscaled_resources",
153       "//chrome_elf",
154       "//content/app/resources",
155       "//crypto",
156       "//net:net_resources",
157       "//third_party/wtl",
158       "//ui/views",
159     ]
160     if (enable_configuration_policy) {
161       deps += [ "//components/policy" ]
162     }
163     if (cpu_arch == "x86") {
164       # Add a dependency to custom import library for user32 delay imports only
165       # in x86 builds.
166       #deps += [ 'chrome_user32_delay_imports' ]  TODO(GYP)
167     }
169     # TODO(GYP) incremental linking flags in debug builds
170     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
172     # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
174     # TODO(GYP) chrome_pgo_phase on Windows.
175   }
177   if (use_aura) {
178     deps += [ "//ui/compositor" ]
179   }
181   #TODO(GYP) add chrome_multiple_dll support
182   if (false) {  #chrome_multiple_dll) {
183     defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
184     deps += [ "//content/public/app:browser" ]
185   } else {
186     deps += [
187       ":child_dependencies",
188       "//content/public/app:both",
189     ]
190   }
192   if (cld_version == 0 || cld_version == 2) {
193     deps += [ "//third_party/cld_2" ]
194   }
196   if (is_mac) {
197     #['OS=="mac" and component!="shared_library"', {  TODO(GYP)
198     #  'includes': [ 'chrome_dll_bundle.gypi' ],
199     #}],
200     # TODO(GYP) Lots of other stuff in the OS=="mac" block.
201   }
204 # GYP version: chromium_browser_dependencies variable in chrome.gyp
205 group("browser_dependencies") {
206   deps = [
207     "//chrome/browser",
208     "//chrome/common",
209     "//sync",
210   ]
211   if (!is_ios) {
212     deps += [ "//ppapi:ppapi_host" ]
213   }
215   if (enable_basic_printing || enable_print_preview) {
216     deps += [ "//printing" ]
217     if (enable_print_preview) {
218       deps += [ "//chrome/service" ]
219     }
220   }
223 # GYP version: chromium_child_dependencies variable in chrome.gyp
224 group("child_dependencies") {
225   deps = [
226     "//chrome/common",
227     "//sync",
228   ]
229   if (!is_ios) {
230     deps += [
231       "//chrome/browser/devtools",
232       "//chrome/plugin",
233       "//chrome/renderer",
234       "//chrome/utility",
235       "//content/public/child",
236       "//third_party/WebKit/public:blink_devtools_frontend_resources",
237     ]
238   }
239   if (cld_version == 0 || cld_version == 2) {
240     deps += [ "//third_party/cld_2:cld2_platform_impl" ]
241   }
243   # TODO(gyp) if (enable_nacl) {
244   #  deps += [ "<(DEPTH)/components/nacl/renderer/plugin/plugin.gyp:nacl_trusted_plugin" ]
245   #}
246   if (enable_remoting) {
247     deps += [ "//remoting/client/plugin" ]
248   }
251 if (is_win) {
252   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
253   # Linux.
254   process_version("version_header") {
255     # TODO(brettW) this should have more reduced visibility, but chrome/browser
256     # currently depends on this.
257     #visibility = [ ":*" ]
258     source = "version.h.in"
260     # TODO(brettw) this should move to $target_gen_dir/version.h and
261     # source files including it should reference it via "chrome/version.h"
262     output = "$root_gen_dir/version.h"
263   }
265   process_version("chrome_exe_version") {
266     source = "//chrome/app/chrome_version.rc.version"
267     output = "$target_gen_dir/chrome_exe_version.rc"
268     extra_args = [
269       "-f",
270       rebase_path("app/chrome_exe.ver", root_build_dir),
271     ]
272   }
274   process_version("chrome_dll_version") {
275     source = "//chrome/app/chrome_version.rc.version"
276     output = "$target_gen_dir/chrome_dll_version.rc"
277     extra_args = [
278       "-f",
279       rebase_path("app/chrome_dll.ver", root_build_dir),
280     ]
281   }
283   process_version("nacl64_exe_version") {
284     source = "//chrome/app/chrome_version.rc.version"
285     output = "$target_gen_dir/nacl64_exe_version.rc"
286     extra_args = [
287       "-f",
288       rebase_path("app/nacl64_exe.ver", root_build_dir),
289     ]
290   }
292   process_version("other_version") {
293     source = "//chrome/app/chrome_version.rc.version"
294     output = "$target_gen_dir/other_version.rc"
295     extra_args = [
296       "-f",
297       rebase_path("app/other.ver", root_build_dir),
298     ]
299   }
301   group("chrome_version_resources") {
302     deps = [
303       ":chrome_exe_version",
304       ":chrome_dll_version",
305       ":nacl64_exe_version",
306       ":other_version",
307     ]
308   }
310   source_set("image_pre_reader") {
311     sources = [
312       "app/image_pre_reader_win.cc",
313       "app/image_pre_reader_win.h",
314     ]
315     deps = [
316       "//base",
317     ]
318   }
321 # GYP version: chrome/chrome_resources.gyp:chrome_resources
322 group("resources") {
323   deps = [
324     # Note: GYP lists some dependencies in addition to these actions. However,
325     # these are just dependencies for the actions themselves, which our actions
326     # list individually when needed.
327     "//chrome/browser:resources",
328     "//chrome/common:resources",
329     "//chrome/renderer:resources",
330   ]
332   if (enable_extensions) {
333     deps += [ "//chrome/common:extensions_api_resources" ]
334   }
337 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
338 group("extra_resources") {
339   deps = [
340     "//chrome/browser/resources:invalidations_resources",
341     "//chrome/browser/resources:memory_internals_resources",
342     "//chrome/browser/resources:net_internals_resources",
343     "//chrome/browser/resources:password_manager_internals_resources",
344     "//chrome/browser/resources:signin_internals_resources",
345     "//chrome/browser/resources:sync_internals_resources",
346     "//chrome/browser/resources:translate_internals_resources",
347   ]
348   if (!is_ios) {
349     deps += [
350       "//chrome/browser/resources:component_extension_resources",
351       "//chrome/browser/resources:options_resources",
352     ]
353   }
355   if (enable_chromevox_next) {
356     deps += [
357       #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',  TODO(GYP)
358     ]
359   } else {
360     deps += [
361       #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',  TODO(GYP)
362     ]
363   }
365   if (enable_extensions) {
366     deps += [
367       "//chrome/browser/resources:quota_internals_resources",
368       "//chrome/browser/resources:sync_file_system_internals_resources",
369     ]
370   }
373 group("packed_resources") {
374   deps = [
375     ":repack_locales_pack",
376     ":repack_pseudo_locales_pack",
377     ":repack_chrome_100_percent",
378   ]
380   # TODO(GYP) if (is_chrome_branded) {
381   # ... copy default_apps from default_apps_list
383   if (enable_hidpi) {
384     deps += [ ":repack_chrome_200_percent" ]
385   }
388 repack("packed_extra_resources") {
389   visibility = [ "./*" ]
390   sources = [
391     "$root_gen_dir/chrome/browser_resources.pak",
392     "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
393     "$root_gen_dir/chrome/common_resources.pak",
394     "$root_gen_dir/chrome/invalidations_resources.pak",
395     "$root_gen_dir/chrome/memory_internals_resources.pak",
396     "$root_gen_dir/chrome/net_internals_resources.pak",
397     "$root_gen_dir/chrome/password_manager_internals_resources.pak",
398     "$root_gen_dir/chrome/signin_internals_resources.pak",
399     "$root_gen_dir/chrome/sync_internals_resources.pak",
400     "$root_gen_dir/chrome/translate_internals_resources.pak",
401     "$root_gen_dir/components/components_resources.pak",
402     "$root_gen_dir/net/net_resources.pak",
403     "$root_gen_dir/ui/resources/webui_resources.pak",
404   ]
405   deps = [
406     "//chrome/browser:resources",
407     "//chrome/app/theme:chrome_unscaled_resources",
408     "//chrome/common:resources",
409     "//chrome/browser/resources:invalidations_resources",
410     "//chrome/browser/resources:memory_internals_resources",
411     "//chrome/browser/resources:net_internals_resources",
412     "//chrome/browser/resources:password_manager_internals_resources",
413     "//chrome/browser/resources:signin_internals_resources",
414     "//chrome/browser/resources:sync_internals_resources",
415     "//chrome/browser/resources:translate_internals_resources",
416     "//components/resources",
417     "//net:net_resources",
418     "//ui/resources",
419   ]
421   if (!is_ios && !is_android) {
422     # New paks should be added here by default.
423     sources += [
424       "$root_gen_dir/chrome/component_extension_resources.pak",
425       "$root_gen_dir/chrome/options_resources.pak",
426       "$root_gen_dir/chrome/quota_internals_resources.pak",
427       "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
428       "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
429       "$root_gen_dir/blink/devtools_resources.pak",
430     ]
431     deps += [
432       "//chrome/browser/devtools:webrtc_device_provider_resources",
433       "//chrome/browser/resources:component_extension_resources",
434       "//chrome/browser/resources:options_resources",
435       "//chrome/browser/resources:quota_internals_resources",
436       "//chrome/browser/resources:sync_file_system_internals_resources",
437       "//content/browser/devtools:devtools_resources",
438     ]
439   }
440   if (!is_ios) {
441     sources += [
442       "$root_gen_dir/blink/public/resources/blink_resources.pak",
443       "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
444       "$root_gen_dir/content/content_resources.pak",
445     ]
446   }
447   if (is_chromeos) {
448     sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
449     deps += [ "//ui/file_manager:resources" ]
450   }
451   if (enable_extensions) {
452     sources += [
453       "$root_gen_dir/chrome/extensions_api_resources.pak",
454       "$root_gen_dir/extensions/extensions_renderer_resources.pak",
455       "$root_gen_dir/extensions/extensions_resources.pak",
456     ]
457     deps += [ "//chrome/common:extensions_api_resources" ]
458   }
460   # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
461   # it them copies it. This skipes the copy step and writes it to the final
462   # location.
463   if (is_mac || is_ios) {
464     output = "$root_gen_dir/repack/resources.pak"
465   } else {
466     output = "$root_out_dir/resources.pak"
467   }
470 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
471 repack("browser_tests_pak") {
472   sources = [
473     "$root_gen_dir/chrome/options_test_resources.pak",
474   ]
475   output = "$root_out_dir/browser_tests.pak"
478 # Collects per-locale grit files from many sources into global per-locale files.
479 chrome_repack_locales("repack_locales_pack") {
480   visibility = [ ":*" ]
482   input_locales = locales
484   if (is_mac) {
485     output_locales = locales_as_mac_outputs
486   } else {
487     output_locales = locales
488   }
491 chrome_repack_locales("repack_pseudo_locales_pack") {
492   visibility = [ ":*" ]
494   input_locales = [ "fake-bidi" ]
496   if (is_mac) {
497     output_locales = [ "fake_bidi" ]  # Mac uses underscores.
498   } else {
499     output_locales = [ "fake-bidi" ]
500   }
503 # Generates a rule to repack a set of resources, substituting a given string
504 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
505 # the "gen" directory, and then introduces a copy rule to copy it to the root
506 # build directory.
508 # It's not clear why this two-step dance is necessary as opposed to just
509 # generating the file in the destination. However, this is what the GYP build
510 # does, and for maintenance purposes, this keeps the same files in the same
511 # place between the two builds when possible.
513 # Argument:
514 #   percent [required]
515 #      String to substitute for the percentage.
516 template("chrome_repack_percent") {
517   percent = invoker.percent
519   repack_name = "${target_name}_repack"
520   repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
522   copy_name = target_name
524   repack(repack_name) {
525     visibility = [ ":$copy_name" ]
527     # All sources should also have deps for completeness.
528     sources = [
529       "$root_gen_dir/components/components_resources_${percent}_percent.pak",
530       "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
531       "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
532       "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
533     ]
535     deps = [
536       "//chrome/app/theme:theme_resources",
537       "//chrome/renderer:resources",
538       "//components/strings",
539       "//net:net_resources",
540     ]
542     if (!is_ios) {
543       sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
544       deps += [ "//content:resources" ]
545     }
546     if (use_ash) {
547       sources +=
548           [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
549       deps += [ "//ash/resources" ]
550     }
551     if (is_chromeos) {
552       sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
553       deps += [ "//ui/chromeos/resources" ]
554     }
555     if (enable_extensions) {
556       sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
557     }
559     output = repack_output_file
560   }
562   copy(copy_name) {
563     visibility = [ ":*" ]
564     deps = [
565       ":$repack_name",
566     ]
567     sources = [
568       repack_output_file,
569     ]
570     outputs = [
571       "$root_build_dir/chrome_${percent}_percent.pak",
572     ]
573   }
576 chrome_repack_percent("repack_chrome_100_percent") {
577   percent = "100"
580 if (enable_hidpi) {
581   chrome_repack_percent("repack_chrome_200_percent") {
582     percent = "200"
583   }
586 # GYP version: chrome/chrome_resources.gyp:chrome_strings
587 group("strings") {
588   deps = [
589     "//chrome/app:chromium_strings",
590     "//chrome/app:generated_resources",
591     "//chrome/app:google_chrome_strings",
592     "//chrome/app/resources:locale_settings",
593   ]
596 if (is_android) {
597   # GYP: //chrome/chrome.gyp:content_setting_java
598   java_cpp_enum("content_setting_javagen") {
599     sources = [
600       "../components/content_settings/core/common/content_settings.h",
601     ]
602     outputs = [
603       "org/chromium/chrome/browser/ContentSetting.java",
604     ]
605   }
607   # GYP: //chrome/chrome.gyp:content_settings_type_java
608   java_cpp_enum("content_settings_type_javagen") {
609     sources = [
610       "../components/content_settings/core/common/content_settings_types.h",
611     ]
612     outputs = [
613       "org/chromium/chrome/browser/ContentSettingsType.java",
614     ]
615   }
617   # GYP: //chrome/chrome.gyp:page_info_connection_type_java
618   java_cpp_enum("page_info_connection_type_javagen") {
619     sources = [
620       "browser/ui/android/website_settings_popup_android.h",
621     ]
622     outputs = [
623       "org/chromium/chrome/browser/PageInfoConnectionType.java",
624     ]
625   }
627   # GYP: //chrome/chrome_android.gypi:chrome_android_core
628   static_library("chrome_android_core") {
629     sources = [
630       "app/android/chrome_android_initializer.cc",
631       "app/android/chrome_android_initializer.h",
632       "app/android/chrome_jni_onload.cc",
633       "app/android/chrome_main_delegate_android.cc",
634       "app/android/chrome_main_delegate_android.h",
635       "app/chrome_main_delegate.cc",
636       "app/chrome_main_delegate.h",
637     ]
639     include_dirs = [ android_ndk_include_dir ]
641     libs = [
642       "android",
643       "jnigraphics",
644     ]
646     deps = [
647       "//chrome/browser",
648       "//chrome/browser/ui",
649       "//chrome/plugin",
650       "//chrome/renderer",
651       "//chrome/utility",
652       "//components/enhanced_bookmarks",
653       "//content/public/app:browser",
654     ]
655   }