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