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/chrome_build.gni")
6 import("//build/config/features.gni")
7 import("//build/config/locales.gni")
8 import("//build/config/ui.gni")
9 import("//chrome/chrome_repack_locales.gni")
10 import("//chrome/version.gni")
13 import("//build/config/android/rules.gni")
17 # TODO(GYP) for Windows need to the the reorder-imports step which probably
18 # means adding another target and renaming this to chrome_initial like in GYP.
19 executable("chrome") {
20 # Because the sources list varies so significantly per-platform, generally
21 # each platform lists its own files rather than relying on filtering or
22 # removing unused files.
24 "app/chrome_exe_resource.h",
30 # TODO(GYP) mac_bundle_resources, xcode_settings
32 # TODO(GYP) order_profiling, order_text_section
36 "//content/public/common/content_switches.cc",
37 "app/chrome_crash_reporter_client.cc",
38 "app/chrome_crash_reporter_client.h",
40 "app/chrome_exe_main_win.cc",
41 "app/chrome_watcher_client_win.cc",
42 "app/chrome_watcher_client_win.h",
43 "app/chrome_watcher_command_line_win.cc",
44 "app/chrome_watcher_command_line_win.h",
47 "app/kasko_client.cc",
49 "app/signature_validator_win.cc",
50 "app/signature_validator_win.h",
51 "common/crash_keys.cc",
52 "common/crash_keys.h'",
55 if (is_component_build) {
56 # This is necessary to make content_switches compile without DLL
57 # linkage errors in a component build.
58 defines += [ "COMPILE_CONTENT_STATICALLY" ]
62 ":chrome_exe_version",
66 # 'chrome_nacl_win64" TODO(GYP)
67 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP)
68 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP)
70 "//breakpad:breakpad_handler",
71 "//breakpad:breakpad_sender",
72 "//chrome/browser:chrome_process_finder",
73 "//chrome/chrome_watcher",
74 "//chrome/chrome_watcher:client",
75 "//chrome/installer/util",
77 "//components/browser_watcher:browser_watcher_client",
78 "//components/crash/app",
79 "//content:startup_helper_win",
88 configs -= [ "//build/config/win:console" ]
89 configs += [ "//build/config/win:windowed" ]
90 } else if (use_aura) {
91 # Non-Windows aura entrypoint.
92 sources += [ "app/chrome_exe_main_aura.cc" ]
97 "app/chrome_dll_resource.h",
99 "app/chrome_main_delegate.cc",
100 "app/chrome_main_delegate.h",
104 # On Linux, link the dependencies (libraries) that make up actual
105 # Chromium functionality directly into the executable.
106 ":browser_dependencies",
107 ":child_dependencies",
111 # Needed to use the master_preferences functions
112 "//chrome/installer/util",
113 "//content/public/app:both",
116 # Needed for chrome_main.cc initialization of libraries.
117 configs += [ "//build/config/linux:pangocairo" ]
119 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
127 "//build/config/linux:x11",
128 "//build/config/linux:xext",
134 sources += [ "app/chrome_exe_main_mac.cc" ]
135 # TODO(GYP) lots more stuff in the is_mac block.
138 ":packed_extra_resources",
140 "//components/startup_metric_utils",
142 # Precompiled plugins that need to get copied to the output directory.
143 # On Mac, internal plugins go inside the framework, so these
144 # dependencies are on chrome.dll.
145 "//third_party/adobe/flash:flapper_binaries",
146 "//third_party/widevine/cdm:widevinecdmadapter",
150 if (is_linux && enable_plugins) {
154 if (is_multi_dll_chrome) {
155 defines += [ "CHROME_MULTIPLE_DLL" ]
156 data_deps += [ ":chrome_child" ]
161 shared_library("main_dll") {
162 configs += [ "//build/config/compiler:wexit_time_destructors" ]
166 ":browser_dependencies",
170 output_name = "chrome"
173 "//base/win/dllmain.cc",
174 "app/chrome_command_ids.h",
176 "app/chrome_dll_resource.h",
177 "app/chrome_main.cc",
178 "app/chrome_main_delegate.cc",
179 "app/chrome_main_delegate.h",
180 "app/close_handle_hook_win.cc",
181 "app/close_handle_hook_win.h",
182 "app/delay_load_hook_win.cc",
183 "app/delay_load_hook_win.h",
187 ":chrome_dll_version",
188 "//base/trace_event/etw_manifest:chrome_events_win",
189 "//chrome/app/theme:chrome_unscaled_resources",
191 "//content/app/resources",
193 "//net:net_resources",
197 if (enable_configuration_policy) {
198 deps += [ "//components/policy" ]
200 if (current_cpu == "x86") {
201 # Add a dependency to custom import library for user32 delay imports only
203 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
206 # This is a large module that can't do incremental linking in some cases.
207 configs -= [ "//build/config/win:default_incremental_linking" ]
208 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
210 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
212 # TODO(GYP) chrome_pgo_phase on Windows.
216 deps += [ "//ui/compositor" ]
219 if (is_multi_dll_chrome) {
220 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
221 deps += [ "//content/public/app:browser" ]
224 ":child_dependencies",
225 "//content/public/app:both",
229 if (cld_version == 0 || cld_version == 2) {
230 deps += [ "//third_party/cld_2" ]
234 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
235 # 'includes': [ 'chrome_dll_bundle.gypi' ],
237 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
240 if (enable_plugins && !is_multi_dll_chrome) {
245 if (is_multi_dll_chrome) {
246 shared_library("chrome_child") {
248 "app/chrome_main.cc",
249 "app/chrome_main_delegate.cc",
250 "app/chrome_main_delegate.h",
251 "app/close_handle_hook_win.cc",
252 "app/close_handle_hook_win.h",
255 configs += [ "//build/config/compiler:wexit_time_destructors" ]
256 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
259 ":child_dependencies",
260 ":chrome_dll_version",
261 "//chrome/browser/policy:path_parser",
262 "//content/public/app:child",
266 deps += [ "//chrome_elf" ]
267 # TODO(GYP): PGO on Windows.
268 # ['chrome_pgo_phase==1', {
271 # 'LinkTimeCodeGeneration': '2',
275 # ['chrome_pgo_phase==2', {
278 # 'LinkTimeCodeGeneration': '3',
283 if (enable_plugins) {
289 # GYP version: chromium_browser_dependencies variable in chrome.gyp
290 group("browser_dependencies") {
297 deps += [ "//ppapi/host" ]
300 if (enable_basic_printing || enable_print_preview) {
301 deps += [ "//printing" ]
302 if (enable_print_preview) {
303 deps += [ "//chrome/service" ]
308 # GYP version: chromium_child_dependencies variable in chrome.gyp
309 group("child_dependencies") {
316 "//chrome/browser/devtools",
321 "//content/public/child",
322 "//third_party/WebKit/public:blink_devtools_frontend_resources",
325 if (cld_version == 0 || cld_version == 2) {
326 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
330 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
332 if (enable_remoting) {
333 deps += [ "//remoting/client/plugin" ]
338 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
340 process_version("version_header") {
341 # TODO(brettW) this should have more reduced visibility, but chrome/browser
342 # currently depends on this.
343 #visibility = [ ":*" ]
345 # This one just uses the custom template and no separate sources.
347 template_file = "version.h.in"
349 # TODO(brettw) this should move to $target_gen_dir/version.h and
350 # source files including it should reference it via "chrome/version.h"
351 output = "$root_gen_dir/version.h"
354 process_version("chrome_exe_version") {
356 "app/chrome_exe.ver",
358 output = "$target_gen_dir/chrome_exe_version.rc"
361 process_version("chrome_dll_version") {
363 "app/chrome_dll.ver",
365 output = "$target_gen_dir/chrome_dll_version.rc"
368 process_version("nacl64_exe_version") {
370 "app/nacl64_exe.ver",
372 output = "$target_gen_dir/nacl64_exe_version.rc"
375 process_version("other_version") {
379 output = "$target_gen_dir/other_version.rc"
382 source_set("image_pre_reader") {
384 "app/image_pre_reader_win.cc",
385 "app/image_pre_reader_win.h",
393 # GYP version: chrome/chrome_resources.gyp:chrome_resources
396 # Note: GYP lists some dependencies in addition to these actions. However,
397 # these are just dependencies for the actions themselves, which our actions
398 # list individually when needed.
399 "//chrome/browser:resources",
400 "//chrome/common:resources",
401 "//chrome/renderer:resources",
404 if (enable_extensions) {
405 deps += [ "//chrome/common:extensions_api_resources" ]
409 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
410 group("extra_resources") {
412 "//chrome/browser/resources:invalidations_resources",
413 "//chrome/browser/resources:memory_internals_resources",
414 "//chrome/browser/resources:net_internals_resources",
415 "//chrome/browser/resources:password_manager_internals_resources",
416 "//chrome/browser/resources:signin_internals_resources",
417 "//chrome/browser/resources:sync_internals_resources",
418 "//chrome/browser/resources:translate_internals_resources",
422 "//chrome/browser/resources:component_extension_resources",
423 "//chrome/browser/resources:options_resources",
424 "//chrome/browser/resources:settings_resources",
428 if (enable_chromevox_next) {
430 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
434 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
438 if (enable_extensions) {
440 "//chrome/browser/resources:quota_internals_resources",
441 "//chrome/browser/resources:sync_file_system_internals_resources",
446 if (is_chrome_branded) {
447 copy("default_apps") {
448 visibility = [ ":packed_resources" ]
450 "browser/resources/default_apps/docs.crx",
451 "browser/resources/default_apps/drive.crx",
452 "browser/resources/default_apps/external_extensions.json",
453 "browser/resources/default_apps/gmail.crx",
454 "browser/resources/default_apps/search.crx",
455 "browser/resources/default_apps/youtube.crx",
458 "$root_out_dir/default_apps/{{source_file_part}}",
463 group("packed_resources") {
465 ":repack_locales_pack",
466 ":repack_pseudo_locales_pack",
467 ":repack_chrome_100_percent",
470 if (is_chrome_branded) {
471 deps += [ ":default_apps" ]
475 deps += [ ":repack_chrome_200_percent" ]
479 repack("packed_extra_resources") {
480 visibility = [ "./*" ]
482 "$root_gen_dir/chrome/browser_resources.pak",
483 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
484 "$root_gen_dir/chrome/common_resources.pak",
485 "$root_gen_dir/chrome/invalidations_resources.pak",
486 "$root_gen_dir/chrome/memory_internals_resources.pak",
487 "$root_gen_dir/chrome/net_internals_resources.pak",
488 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
489 "$root_gen_dir/chrome/signin_internals_resources.pak",
490 "$root_gen_dir/chrome/sync_internals_resources.pak",
491 "$root_gen_dir/chrome/translate_internals_resources.pak",
492 "$root_gen_dir/components/components_resources.pak",
493 "$root_gen_dir/net/net_resources.pak",
494 "$root_gen_dir/ui/resources/webui_resources.pak",
497 "//chrome/browser:resources",
498 "//chrome/app/theme:chrome_unscaled_resources",
499 "//chrome/common:resources",
500 "//chrome/browser/resources:invalidations_resources",
501 "//chrome/browser/resources:memory_internals_resources",
502 "//chrome/browser/resources:net_internals_resources",
503 "//chrome/browser/resources:password_manager_internals_resources",
504 "//chrome/browser/resources:signin_internals_resources",
505 "//chrome/browser/resources:sync_internals_resources",
506 "//chrome/browser/resources:translate_internals_resources",
507 "//components/resources",
508 "//net:net_resources",
512 if (!is_ios && !is_android) {
513 # New paks should be added here by default.
515 "$root_gen_dir/blink/devtools_resources.pak",
516 "$root_gen_dir/chrome/component_extension_resources.pak",
517 "$root_gen_dir/chrome/options_resources.pak",
518 "$root_gen_dir/chrome/quota_internals_resources.pak",
519 "$root_gen_dir/chrome/settings_resources.pak",
520 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
521 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
524 "//chrome/browser/devtools:webrtc_device_provider_resources",
525 "//chrome/browser/resources:component_extension_resources",
526 "//chrome/browser/resources:options_resources",
527 "//chrome/browser/resources:settings_resources",
528 "//chrome/browser/resources:quota_internals_resources",
529 "//chrome/browser/resources:sync_file_system_internals_resources",
530 "//content/browser/devtools:devtools_resources",
535 "$root_gen_dir/blink/public/resources/blink_resources.pak",
536 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
537 "$root_gen_dir/content/content_resources.pak",
541 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
542 sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
543 deps += [ "//ui/file_manager:resources" ]
544 deps += [ "//ui/oobe:resources" ]
546 if (enable_extensions) {
548 "$root_gen_dir/chrome/extensions_api_resources.pak",
549 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
550 "$root_gen_dir/extensions/extensions_resources.pak",
552 deps += [ "//chrome/common:extensions_api_resources" ]
555 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
556 # it them copies it. This skipes the copy step and writes it to the final
558 if (is_mac || is_ios) {
559 output = "$root_gen_dir/repack/resources.pak"
561 output = "$root_out_dir/resources.pak"
565 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
566 repack("browser_tests_pak") {
568 "$root_gen_dir/chrome/options_test_resources.pak",
570 output = "$root_out_dir/browser_tests.pak"
573 # Collects per-locale grit files from many sources into global per-locale files.
574 chrome_repack_locales("repack_locales_pack") {
575 visibility = [ ":*" ]
577 input_locales = locales
580 output_locales = locales_as_mac_outputs
582 output_locales = locales
586 chrome_repack_locales("repack_pseudo_locales_pack") {
587 visibility = [ ":*" ]
589 input_locales = [ "fake-bidi" ]
592 output_locales = [ "fake_bidi" ] # Mac uses underscores.
594 output_locales = [ "fake-bidi" ]
598 # Generates a rule to repack a set of resources, substituting a given string
599 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
600 # the "gen" directory, and then introduces a copy rule to copy it to the root
603 # It's not clear why this two-step dance is necessary as opposed to just
604 # generating the file in the destination. However, this is what the GYP build
605 # does, and for maintenance purposes, this keeps the same files in the same
606 # place between the two builds when possible.
610 # String to substitute for the percentage.
611 template("chrome_repack_percent") {
612 percent = invoker.percent
614 repack_name = "${target_name}_repack"
615 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
617 copy_name = target_name
619 repack(repack_name) {
620 visibility = [ ":$copy_name" ]
622 # All sources should also have deps for completeness.
624 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
625 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
626 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
627 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
631 "//chrome/app/theme:theme_resources",
632 "//chrome/renderer:resources",
633 "//components/strings",
634 "//net:net_resources",
639 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
640 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
642 deps += [ "//content:resources" ]
646 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
647 deps += [ "//ash/resources" ]
650 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
651 deps += [ "//ui/chromeos/resources" ]
653 if (enable_extensions) {
654 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
657 output = repack_output_file
661 visibility = [ ":*" ]
669 "$root_build_dir/chrome_${percent}_percent.pak",
674 chrome_repack_percent("repack_chrome_100_percent") {
679 chrome_repack_percent("repack_chrome_200_percent") {
684 # GYP version: chrome/chrome_resources.gyp:chrome_strings
687 "//chrome/app:chromium_strings",
688 "//chrome/app:generated_resources",
689 "//chrome/app:google_chrome_strings",
690 "//chrome/app/resources:locale_settings",
695 # GYP: //chrome/chrome.gyp:content_setting_java
696 java_cpp_enum("content_setting_javagen") {
698 "../components/content_settings/core/common/content_settings.h",
701 "org/chromium/chrome/browser/ContentSetting.java",
705 # GYP: //chrome/chrome.gyp:content_settings_type_java
706 java_cpp_enum("content_settings_type_javagen") {
708 "../components/content_settings/core/common/content_settings_types.h",
711 "org/chromium/chrome/browser/ContentSettingsType.java",
715 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
716 java_cpp_enum("page_info_connection_type_javagen") {
718 "browser/ui/android/website_settings_popup_android.h",
721 "org/chromium/chrome/browser/PageInfoConnectionType.java",
725 # GYP: //chrome/chrome_android.gypi:chrome_android_core
726 static_library("chrome_android_core") {
728 "app/android/chrome_android_initializer.cc",
729 "app/android/chrome_android_initializer.h",
730 "app/android/chrome_jni_onload.cc",
731 "app/android/chrome_jni_onload.h",
732 "app/android/chrome_main_delegate_android.cc",
733 "app/android/chrome_main_delegate_android.h",
734 "app/chrome_main_delegate.cc",
735 "app/chrome_main_delegate.h",
738 include_dirs = [ android_ndk_include_dir ]
747 "//chrome/browser/ui",
752 "//components/enhanced_bookmarks",
753 "//content/public/app:both",
760 if (is_chrome_branded) {
761 name = "Google Chrome"
762 filename = "google-chrome"
763 confdir = "google-chrome"
766 filename = "chromium-browser"
770 script = "//chrome/tools/build/linux/sed.py"
771 infile = "app/resources/manpage.1.in"
776 outfile = "$root_out_dir/chrome.1"
782 rebase_path(infile, root_build_dir),
783 rebase_path(outfile, root_build_dir),
784 "-e s/@@NAME@@/$name/",
785 "-e s/@@FILENAME@@/$filename/",
786 "-e s/@@CONFDIR@@/$confdir/",