mac: Remove simplified fullscreen.
[chromium-blink-merge.git] / chrome / BUILD.gn
blobd49ff3db1e649e68d0fd86d9161c3e835ffa2a86
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 # TODO(GYP) for Windows need to the the reorder-imports step which probably
12 # means adding another target and renaming this to chrome_initial like in GYP.
13 executable("chrome") {
14   # Because the sources list varies so significantly per-platform, generally
15   # each platform lists its own files rather than relying on filtering or
16   # removing unused files.
17   sources = [
18     "app/chrome_exe_resource.h",
19   ]
20   deps = []
21   datadeps = []
23   # TODO(GYP) mac_bundle_resources, xcode_settings
25   # TODO(GYP) order_profiling, order_text_section
27   if (is_win) {
28     sources += [
29       "app/chrome_exe_main_win.cc",
30       "app/client_util.cc",
31       "app/client_util.h",
32       "app/signature_validator_win.cc",
33       "app/signature_validator_win.h",
34       "//content/app/startup_helper_win.cc",
35     ]
36     deps += [ "//ui/gfx" ]
37   } else if (use_aura) {
38     # Non-Windows aura entrypoint.
39     sources += [ "app/chrome_exe_main_aura.cc" ]
40   }
42   if (is_linux) {
43     # TODO(GYP) manpage action
45     sources += [
46       "app/chrome_dll_resource.h",
47       "app/chrome_main.cc",
48       "app/chrome_main_delegate.cc",
49       "app/chrome_main_delegate.h",
50     ]
52     deps += [
53       # On Linux, link the dependencies (libraries) that make up actual
54       # Chromium functionality directly into the executable.
55       ":browser_dependencies",
56       ":child_dependencies",
58       "//base/allocator",
59       # Needed to use the master_preferences functions
60       "//chrome/installer/util",
61       "//content/public/app:both",
62     ]
64     # Needed for chrome_main.cc initialization of libraries.
65     configs += [ "//build/config/linux:pangocairo" ]
67     # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
68     #   'ldflags': [
69     #      '-pie',
70     #   ],
71     #}],
73     if (use_x11) {
74       configs += [
75         "//build/config/linux:x11",
76         "//build/config/linux:xext",
77       ]
78     }
79   }
81   if (is_mac) {
82     sources += [
83       "app/chrome_exe_main_mac.cc",
84     ]
85     # TODO(GYP) lots more stuff in the is_mac block.
86   } else {  # Non-Mac.
87     deps += [
88       ":packed_extra_resources",
89       ":packed_resources",
91       # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
92       # file decide what to do on a per-OS basis; on Mac, internal plugins
93       # go inside the framework, so this dependency is in chrome_dll.gypi.
94       #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries',  TODO(GYP)
96       # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
97       # file decide what to do on a per-OS basis; on Mac, internal plugins
98       # go inside the framework, so this dependency is in chrome_dll.gypi.
99       #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',  TODO(GYP)
100     ]
102     # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
104   }
107   if (!is_mac && !is_android) {
108     # On Mac this is done in chrome_dll.gypi. Android doesn't use pdfium.
109     datadeps += [ "//pdf" ]
111     # TODO(GYP) pdf linux symbols
112   }
115 shared_library("main_dll") {
116   configs += [ "//build/config/compiler:wexit_time_destructors" ]
118   deps = [
119     ":browser_dependencies",
120     "//base/allocator",
121   ]
122   if (is_win) {
123     output_name = "chrome"
125     sources = [
126       "app/chrome_command_ids.h",
127       "app/chrome_dll.rc",
128       "app/chrome_dll_resource.h",
129       "app/chrome_main.cc",
130       "app/chrome_main_delegate.cc",
131       "app/chrome_main_delegate.h",
132       "app/close_handle_hook_win.cc",
133       "app/close_handle_hook_win.h",
134       "app/delay_load_hook_win.cc",
135       "app/delay_load_hook_win.h",
136       "//base/win/dllmain.cc",
137     ]
139     deps += [
140       # On Windows, link the dependencies (libraries) that make up actual
141       # Chromium functionality into this .dll.
142       #'chrome_version_resources',  TODO(GYP)
143       "//chrome/app/theme:chrome_unscaled_resources",
144       "//content/app/resources",
145       "//crypto",
146       "//net:net_resources",
147       "//third_party/wtl",
148       "//ui/views",
149       #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ]  TODO(GYP)
150     ]
151     if (enable_configuration_policy) {
152       deps += [ "//components/policy" ]
153     }
154     if (cpu_arch == "x86") {
155       # Add a dependency to custom import library for user32 delay imports only
156       # in x86 builds.
157       #deps += [ 'chrome_user32_delay_imports' ]  TODO(GYP)
158     }
160     # TODO(GYP) incremental linking flags in debug builds
161     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
163     # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
165     # TODO(GYP) chrome_pgo_phase on Windows.
166   }
168   if (use_aura) {
169     deps += [ "//ui/compositor" ]
170   }
172   #TODO(GYP) add chrome_multiple_dll support
173   if (false) {  #chrome_multiple_dll) {
174     defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
175     deps += [
176       "//content/app:browser",
177     ]
178   } else {
179     deps += [
180       ":child_dependencies",
181       "//content/app:both",
182     ]
183   }
185   if (cld_version == 0 || cld_version == 2) {
186     deps += [
187       "//third_party/cld_2",
188     ]
189   }
191   if (is_mac) {
192     #['OS=="mac" and component!="shared_library"', {  TODO(GYP)
193     #  'includes': [ 'chrome_dll_bundle.gypi' ],
194     #}],
196     # TODO(GYP) Lots of other stuff in the OS=="mac" block.
197   }
200 # GYP version: chromium_browser_dependencies variable in chrome.gyp
201 group("browser_dependencies") {
202   deps = [
203     "//chrome/browser",
204     "//chrome/common",
205     "//sync",
206   ]
207   if (!is_ios) {
208     deps += [
209       "//ppapi:ppapi_host",
210     ]
211   }
213   if (printing_mode != 0) {
214     deps += [ "//printing" ]
215     if (printing_mode == 1) {
216       deps += [ "//chrome/service" ]
217     }
218   }
221 # GYP version: chromium_child_dependencies variable in chrome.gyp
222 group("child_dependencies") {
223   deps = [
224     "//chrome/common",
225     "//sync",
226   ]
227   if (!is_ios) {
228     deps += [
229       "//chrome/browser/devtools",
230       "//chrome/plugin",
231       "//chrome/renderer",
232       "//chrome/utility",
233       "//content/gpu",
234       "//content/ppapi_plugin",
235       "//third_party/WebKit/public:blink_devtools_frontend_resources",
236     ]
237   }
240 if (is_win) {
241   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
242   # Linux.
243   process_version("version_header") {
244     # TODO(brettW) this should have more reduced visibility, but chrome/browser
245     # currently depends on this.
246     #visibility = ":*"
247     source = "version.h.in"
248     # TODO(brettw) this should move to $target_gen_dir/version.h and
249     # source files including it should reference it via "chrome/version.h"
250     output = "$root_gen_dir/version.h"
251   }
254 # GYP version: chrome/chrome_resources.gyp:chrome_resources
255 group("resources") {
256   deps = [
257     # Note: GYP lists some dependencies in addition to these actions. However,
258     # these are just dependencies for the actions themselves, which our actions
259     # list individually when needed.
260     "//chrome/browser:resources",
261     "//chrome/common:resources",
262     "//chrome/renderer:resources",
263   ]
265   if (enable_extensions) {
266     deps += [ "//chrome/common:extensions_api_resources" ]
267   }
270 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
271 group("extra_resources") {
272   deps = [
273     "//chrome/browser/resources:invalidations_resources",
274     "//chrome/browser/resources:memory_internals_resources",
275     "//chrome/browser/resources:net_internals_resources",
276     "//chrome/browser/resources:password_manager_internals_resources",
277     "//chrome/browser/resources:signin_internals_resources",
278     "//chrome/browser/resources:sync_internals_resources",
279     "//chrome/browser/resources:translate_internals_resources",
280   ]
281   if (!is_ios) {
282     deps += [
283       "//chrome/browser/resources:component_extension_resources",
284       "//chrome/browser/resources:options_resources",
285     ]
286   }
288   if (enable_chromevox_next) {
289     deps += [
290       #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',  TODO(GYP)
291     ]
292   } else {
293     deps += [
294       #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',  TODO(GYP)
295     ]
296   }
298   if (enable_extensions) {
299     deps += [
300       "//chrome/browser/resources:quota_internals_resources",
301       "//chrome/browser/resources:sync_file_system_internals_resources",
302     ]
303   }
306 group("packed_resources") {
307   deps = [
308     ":repack_locales_pack",
309     ":repack_pseudo_locales_pack",
310     ":repack_chrome_100_percent",
311   ]
313   # TODO(GYP) if (is_chrome_branded) {
314   # ... copy default_apps from default_apps_list
316   if (enable_hidpi) {
317     deps += [ ":repack_chrome_200_percent" ]
318   }
321 repack("packed_extra_resources") {
322   visibility = [ ":*" ]
323   sources = [
324     "$root_gen_dir/chrome/browser_resources.pak",
325     "$root_gen_dir/chrome/app/theme/chrome_unscaled_resources.pak",
326     "$root_gen_dir/chrome/common_resources.pak",
327     "$root_gen_dir/chrome/browser/resources/invalidations_resources.pak",
328     "$root_gen_dir/chrome/browser/resources/memory_internals_resources.pak",
329     "$root_gen_dir/chrome/browser/resources/net_internals_resources.pak",
330     "$root_gen_dir/chrome/browser/resources/password_manager_internals_resources.pak",
331     "$root_gen_dir/chrome/browser/resources/signin_internals_resources.pak",
332     "$root_gen_dir/chrome/browser/resources/sync_internals_resources.pak",
333     "$root_gen_dir/chrome/browser/resources/translate_internals_resources.pak",
334     "$root_gen_dir/components/resources/component_resources.pak",
335     "$root_gen_dir/net/net_resources.pak",
336     "$root_gen_dir/ui/resources/webui_resources.pak",
337   ]
338   deps = [
339     "//chrome/browser:resources",
340     "//chrome/app/theme:chrome_unscaled_resources",
341     "//chrome/common:resources",
342     "//chrome/browser/resources:invalidations_resources",
343     "//chrome/browser/resources:memory_internals_resources",
344     "//chrome/browser/resources:net_internals_resources",
345     "//chrome/browser/resources:password_manager_internals_resources",
346     "//chrome/browser/resources:signin_internals_resources",
347     "//chrome/browser/resources:sync_internals_resources",
348     "//chrome/browser/resources:translate_internals_resources",
349     "//components/resources",
350     "//net:net_resources",
351     "//ui/resources",
352   ]
354   if (!is_ios && !is_android) {
355     # New paks should be added here by default.
356     sources += [
357       "$root_gen_dir/webkit/devtools_resources.pak",
358       "$root_gen_dir/chrome/browser/resources/component_extension_resources.pak",
359       "$root_gen_dir/chrome/browser/resources/options_resources.pak",
360       "$root_gen_dir/chrome/browser/resources/quota_internals_resources.pak",
361       "$root_gen_dir/chrome/browser/resources/sync_file_system_internals_resources.pak",
362     ]
363     deps += [
364       "//content/browser/devtools:devtools_resources",
365       "//chrome/browser/resources:component_extension_resources",
366       "//chrome/browser/resources:options_resources",
367       "//chrome/browser/resources:quota_internals_resources",
368       "//chrome/browser/resources:sync_file_system_internals_resources",
369     ]
370   }
371   if (!is_ios) {
372     sources += [
373       "$root_gen_dir/blink/public/resources/blink_resources.pak",
374       "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
375       "$root_gen_dir/content/content_resources.pak",
376       "$root_gen_dir/extensions/extensions_renderer_resources.pak", 
377       "$root_gen_dir/extensions/extensions_resources.pak",
378     ]
379   }
380   if (is_chromeos) {
381     sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
382     deps += [ "//ui/file_manager:resources" ]
383   }
384   if (enable_extensions) {
385     sources += [ "$root_gen_dir/chrome/extensions_api_resources.pak" ]
386     deps += [ "//chrome/common:extensions_api_resources" ]
387   }
389   # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
390   # it them copies it. This skipes the copy step and writes it to the final
391   # location.
392   if (is_mac || is_ios) {
393     output = "$root_gen_dir/repack/resources.pak"
394   } else {
395     output = "$root_out_dir/resources.pak"
396   }
399 # Collects per-locale grit files from many sources into global per-locale files.
400 chrome_repack_locales("repack_locales_pack") {
401   visibility = ":*"
403   input_locales = locales
405   if (is_mac) {
406     output_locales = locales_as_mac_outputs
407   } else {
408     output_locales = locales
409   }
412 chrome_repack_locales("repack_pseudo_locales_pack") {
413   visibility = ":*"
415   input_locales = [ "fake-bidi" ]
417   if (is_mac) {
418     output_locales = [ "fake_bidi" ]  # Mac uses underscores.
419   } else {
420     output_locales = [ "fake-bidi" ]
421   }
424 # Generates a rule to repack a set of resources, substituting a given string
425 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
426 # the "gen" directory, and then introduces a copy rule to copy it to the root
427 # build directory.
429 # It's not clear why this two-step dance is necessary as opposed to just
430 # generating the file in the destination. However, this is what the GYP build
431 # does, and for maintenance purposes, this keeps the same files in the same
432 # place between the two builds when possible.
434 # Argument:
435 #   percent [required]
436 #      String to substitute for the percentage.
437 template("chrome_repack_percent") {
438   percent = invoker.percent
440   repack_name = "${target_name}_repack"
441   repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
443   copy_name = target_name
445   repack(repack_name) {
446     visibility = ":$copy_name"
447     # All sources should also have deps for completeness.
448     sources = [
449       "$root_gen_dir/components/resources/component_resources_${percent}_percent.pak",
450       "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
451       "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
452       "$root_gen_dir/chrome/app/theme/theme_resources_${percent}_percent.pak",
453     ]
455     deps = [
456       "//chrome/app/theme:theme_resources",
457       "//chrome/renderer:resources",
458       "//components/strings",
459       "//net:net_resources",
460     ]
462     if (!is_ios) {
463       sources += [
464         "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
465       ]
466       deps += [ "//content:resources" ]
467     }
468     if (use_ash) {
469       sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
470       deps += [ "//ash/resources" ]
471     }
472     if (use_athena) {
473       sources += [
474         "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
475       ]
476       deps += [ "//athena/resources" ]
477     }
478     if (is_chromeos) {
479       sources += [
480         "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
481       ]
482       deps += [ "//ui/chromeos/resources" ]
483     }
485     output = repack_output_file
486   }
488   copy(copy_name) {
489     visibility = ":*"
490     deps = [ ":$repack_name" ]
491     sources = [ repack_output_file ]
492     outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
493   }
496 chrome_repack_percent("repack_chrome_100_percent") {
497   percent = "100"
500 if (enable_hidpi) {
501   chrome_repack_percent("repack_chrome_200_percent") {
502     percent = "200"
503   }
506 # GYP version: chrome/chrome_resources.gyp:chrome_strings
507 group("strings") {
508   deps = [
509     "//chrome/app:chromium_strings",
510     "//chrome/app:generated_resources",
511     "//chrome/app:google_chrome_strings",
512     "//chrome/app/resources:locale_settings",
513   ]