BUILD.gn 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. import("//build/config/locales.gni")
  2. import("//build/config/ui.gni")
  3. import("//build/config/win/manifest.gni")
  4. import("//components/os_crypt/features.gni")
  5. import("//components/spellcheck/spellcheck_build_features.gni")
  6. import("//content/public/app/mac_helpers.gni")
  7. import("//extensions/buildflags/buildflags.gni")
  8. import("//pdf/features.gni")
  9. import("//ppapi/buildflags/buildflags.gni")
  10. import("//printing/buildflags/buildflags.gni")
  11. import("//testing/test.gni")
  12. import("//third_party/ffmpeg/ffmpeg_options.gni")
  13. import("//tools/generate_library_loader/generate_library_loader.gni")
  14. import("//tools/grit/grit_rule.gni")
  15. import("//tools/grit/repack.gni")
  16. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  17. import("//v8/gni/snapshot_toolchain.gni")
  18. import("build/asar.gni")
  19. import("build/extract_symbols.gni")
  20. import("build/npm.gni")
  21. import("build/templated_file.gni")
  22. import("build/tsc.gni")
  23. import("build/webpack/webpack.gni")
  24. import("buildflags/buildflags.gni")
  25. import("electron_paks.gni")
  26. import("filenames.auto.gni")
  27. import("filenames.gni")
  28. import("filenames.hunspell.gni")
  29. import("filenames.libcxx.gni")
  30. import("filenames.libcxxabi.gni")
  31. if (is_mac) {
  32. import("//build/config/mac/rules.gni")
  33. import("//third_party/icu/config.gni")
  34. import("//ui/gl/features.gni")
  35. import("//v8/gni/v8.gni")
  36. import("build/rules.gni")
  37. assert(
  38. mac_deployment_target == "10.13",
  39. "Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
  40. }
  41. if (is_linux) {
  42. import("//build/config/linux/pkg_config.gni")
  43. import("//tools/generate_stubs/rules.gni")
  44. pkg_config("gio_unix") {
  45. packages = [ "gio-unix-2.0" ]
  46. }
  47. pkg_config("libnotify_config") {
  48. packages = [
  49. "glib-2.0",
  50. "gdk-pixbuf-2.0",
  51. ]
  52. }
  53. generate_library_loader("libnotify_loader") {
  54. name = "LibNotifyLoader"
  55. output_h = "libnotify_loader.h"
  56. output_cc = "libnotify_loader.cc"
  57. header = "<libnotify/notify.h>"
  58. config = ":libnotify_config"
  59. functions = [
  60. "notify_is_initted",
  61. "notify_init",
  62. "notify_get_server_caps",
  63. "notify_get_server_info",
  64. "notify_notification_new",
  65. "notify_notification_add_action",
  66. "notify_notification_set_image_from_pixbuf",
  67. "notify_notification_set_timeout",
  68. "notify_notification_set_urgency",
  69. "notify_notification_set_hint_string",
  70. "notify_notification_show",
  71. "notify_notification_close",
  72. ]
  73. }
  74. # Generates electron_gtk_stubs.h header which contains
  75. # stubs for extracting function ptrs from the gtk library.
  76. # Function signatures for which stubs are required should be
  77. # declared in electron_gtk.sigs, currently this file contains
  78. # signatures for the functions used with native file chooser
  79. # implementation. In future, this file can be extended to contain
  80. # gtk4 stubs to switch gtk version in runtime.
  81. generate_stubs("electron_gtk_stubs") {
  82. sigs = [
  83. "shell/browser/ui/electron_gdk_pixbuf.sigs",
  84. "shell/browser/ui/electron_gtk.sigs",
  85. ]
  86. extra_header = "shell/browser/ui/electron_gtk.fragment"
  87. output_name = "electron_gtk_stubs"
  88. public_deps = [ "//ui/gtk:gtk_config" ]
  89. logging_function = "LogNoop()"
  90. logging_include = "ui/gtk/log_noop.h"
  91. }
  92. }
  93. declare_args() {
  94. use_prebuilt_v8_context_snapshot = false
  95. }
  96. branding = read_file("shell/app/BRANDING.json", "json")
  97. electron_project_name = branding.project_name
  98. electron_product_name = branding.product_name
  99. electron_mac_bundle_id = branding.mac_bundle_id
  100. electron_version = exec_script("script/print-version.py",
  101. [],
  102. "trim string",
  103. [
  104. ".git/packed-refs",
  105. ".git/HEAD",
  106. "script/lib/get-version.js",
  107. ])
  108. if (is_mas_build) {
  109. assert(is_mac,
  110. "It doesn't make sense to build a MAS build on a non-mac platform")
  111. }
  112. if (enable_pdf_viewer) {
  113. assert(enable_pdf, "PDF viewer support requires enable_pdf=true")
  114. assert(enable_electron_extensions,
  115. "PDF viewer support requires enable_electron_extensions=true")
  116. }
  117. if (enable_electron_extensions) {
  118. assert(enable_extensions,
  119. "Chrome extension support requires enable_extensions=true")
  120. }
  121. config("branding") {
  122. defines = [
  123. "ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
  124. "ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
  125. ]
  126. }
  127. config("electron_lib_config") {
  128. include_dirs = [ "." ]
  129. }
  130. # We geneate the definitions twice here, once in //electron/electron.d.ts
  131. # and once in $target_gen_dir
  132. # The one in $target_gen_dir is used for the actual TSC build later one
  133. # and the one in //electron/electron.d.ts is used by your IDE (vscode)
  134. # for typescript prompting
  135. npm_action("build_electron_definitions") {
  136. script = "gn-typescript-definitions"
  137. args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
  138. inputs = auto_filenames.api_docs + [ "yarn.lock" ]
  139. outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
  140. }
  141. webpack_build("electron_asar_bundle") {
  142. deps = [ ":build_electron_definitions" ]
  143. inputs = auto_filenames.asar_bundle_deps
  144. config_file = "//electron/build/webpack/webpack.config.asar.js"
  145. out_file = "$target_gen_dir/js2c/asar_bundle.js"
  146. }
  147. webpack_build("electron_browser_bundle") {
  148. deps = [ ":build_electron_definitions" ]
  149. inputs = auto_filenames.browser_bundle_deps
  150. config_file = "//electron/build/webpack/webpack.config.browser.js"
  151. out_file = "$target_gen_dir/js2c/browser_init.js"
  152. }
  153. webpack_build("electron_renderer_bundle") {
  154. deps = [ ":build_electron_definitions" ]
  155. inputs = auto_filenames.renderer_bundle_deps
  156. config_file = "//electron/build/webpack/webpack.config.renderer.js"
  157. out_file = "$target_gen_dir/js2c/renderer_init.js"
  158. }
  159. webpack_build("electron_worker_bundle") {
  160. deps = [ ":build_electron_definitions" ]
  161. inputs = auto_filenames.worker_bundle_deps
  162. config_file = "//electron/build/webpack/webpack.config.worker.js"
  163. out_file = "$target_gen_dir/js2c/worker_init.js"
  164. }
  165. webpack_build("electron_sandboxed_renderer_bundle") {
  166. deps = [ ":build_electron_definitions" ]
  167. inputs = auto_filenames.sandbox_bundle_deps
  168. config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
  169. out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
  170. }
  171. webpack_build("electron_isolated_renderer_bundle") {
  172. deps = [ ":build_electron_definitions" ]
  173. inputs = auto_filenames.isolated_bundle_deps
  174. config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
  175. out_file = "$target_gen_dir/js2c/isolated_bundle.js"
  176. }
  177. action("electron_js2c") {
  178. deps = [
  179. ":electron_asar_bundle",
  180. ":electron_browser_bundle",
  181. ":electron_isolated_renderer_bundle",
  182. ":electron_renderer_bundle",
  183. ":electron_sandboxed_renderer_bundle",
  184. ":electron_worker_bundle",
  185. ]
  186. sources = [
  187. "$target_gen_dir/js2c/asar_bundle.js",
  188. "$target_gen_dir/js2c/browser_init.js",
  189. "$target_gen_dir/js2c/isolated_bundle.js",
  190. "$target_gen_dir/js2c/renderer_init.js",
  191. "$target_gen_dir/js2c/sandbox_bundle.js",
  192. "$target_gen_dir/js2c/worker_init.js",
  193. ]
  194. inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
  195. outputs = [ "$root_gen_dir/electron_natives.cc" ]
  196. script = "build/js2c.py"
  197. args = [ rebase_path("//third_party/electron_node") ] +
  198. rebase_path(outputs, root_build_dir) +
  199. rebase_path(sources, root_build_dir)
  200. }
  201. action("generate_config_gypi") {
  202. outputs = [ "$root_gen_dir/config.gypi" ]
  203. script = "script/generate-config-gypi.py"
  204. inputs = [ "//third_party/electron_node/configure.py" ]
  205. args = rebase_path(outputs) + [ target_cpu ]
  206. }
  207. target_gen_default_app_js = "$target_gen_dir/js/default_app"
  208. typescript_build("default_app_js") {
  209. deps = [ ":build_electron_definitions" ]
  210. sources = filenames.default_app_ts_sources
  211. output_gen_dir = target_gen_default_app_js
  212. output_dir_name = "default_app"
  213. tsconfig = "tsconfig.default_app.json"
  214. }
  215. copy("default_app_static") {
  216. sources = filenames.default_app_static_sources
  217. outputs = [ "$target_gen_default_app_js/{{source}}" ]
  218. }
  219. copy("default_app_octicon_deps") {
  220. sources = filenames.default_app_octicon_sources
  221. outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
  222. }
  223. asar("default_app_asar") {
  224. deps = [
  225. ":default_app_js",
  226. ":default_app_octicon_deps",
  227. ":default_app_static",
  228. ]
  229. root = "$target_gen_default_app_js/electron/default_app"
  230. sources = get_target_outputs(":default_app_js") +
  231. get_target_outputs(":default_app_static") +
  232. get_target_outputs(":default_app_octicon_deps")
  233. outputs = [ "$root_out_dir/resources/default_app.asar" ]
  234. }
  235. grit("resources") {
  236. source = "electron_resources.grd"
  237. outputs = [
  238. "grit/electron_resources.h",
  239. "electron_resources.pak",
  240. ]
  241. # Mojo manifest overlays are generated.
  242. grit_flags = [
  243. "-E",
  244. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  245. ]
  246. deps = [ ":copy_shell_devtools_discovery_page" ]
  247. output_dir = "$target_gen_dir"
  248. }
  249. copy("copy_shell_devtools_discovery_page") {
  250. sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
  251. outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
  252. }
  253. npm_action("electron_version_args") {
  254. script = "generate-version-json"
  255. outputs = [ "$target_gen_dir/electron_version.args" ]
  256. args = rebase_path(outputs) + [ "$electron_version" ]
  257. inputs = [ "script/generate-version-json.js" ]
  258. }
  259. templated_file("electron_version_header") {
  260. deps = [ ":electron_version_args" ]
  261. template = "build/templates/electron_version.tmpl"
  262. output = "$target_gen_dir/electron_version.h"
  263. args_files = get_target_outputs(":electron_version_args")
  264. }
  265. templated_file("electron_win_rc") {
  266. deps = [ ":electron_version_args" ]
  267. template = "build/templates/electron_rc.tmpl"
  268. output = "$target_gen_dir/win-resources/electron.rc"
  269. args_files = get_target_outputs(":electron_version_args")
  270. }
  271. copy("electron_win_resource_files") {
  272. sources = [
  273. "shell/browser/resources/win/electron.ico",
  274. "shell/browser/resources/win/resource.h",
  275. ]
  276. outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
  277. }
  278. templated_file("electron_version_file") {
  279. deps = [ ":electron_version_args" ]
  280. template = "build/templates/version_string.tmpl"
  281. output = "$root_build_dir/version"
  282. args_files = get_target_outputs(":electron_version_args")
  283. }
  284. group("electron_win32_resources") {
  285. public_deps = [
  286. ":electron_win_rc",
  287. ":electron_win_resource_files",
  288. ]
  289. }
  290. action("electron_fuses") {
  291. script = "build/fuses/build.py"
  292. inputs = [ "build/fuses/fuses.json5" ]
  293. outputs = [
  294. "$target_gen_dir/fuses.h",
  295. "$target_gen_dir/fuses.cc",
  296. ]
  297. args = rebase_path(outputs)
  298. }
  299. action("electron_generate_node_defines") {
  300. script = "build/generate_node_defines.py"
  301. inputs = [
  302. "//third_party/electron_node/src/tracing/trace_event_common.h",
  303. "//third_party/electron_node/src/tracing/trace_event.h",
  304. "//third_party/electron_node/src/util.h",
  305. ]
  306. outputs = [
  307. "$target_gen_dir/push_and_undef_node_defines.h",
  308. "$target_gen_dir/pop_node_defines.h",
  309. ]
  310. args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
  311. }
  312. source_set("electron_lib") {
  313. configs += [ "//v8:external_startup_data" ]
  314. configs += [ "//third_party/electron_node:node_internals" ]
  315. public_configs = [
  316. ":branding",
  317. ":electron_lib_config",
  318. ]
  319. deps = [
  320. ":electron_fuses",
  321. ":electron_generate_node_defines",
  322. ":electron_js2c",
  323. ":electron_version_header",
  324. ":resources",
  325. "buildflags",
  326. "chromium_src:chrome",
  327. "chromium_src:chrome_spellchecker",
  328. "shell/common/api:mojo",
  329. "//base:base_static",
  330. "//base/allocator:buildflags",
  331. "//chrome:strings",
  332. "//chrome/app:command_ids",
  333. "//chrome/app/resources:platform_locale_settings",
  334. "//components/autofill/core/common:features",
  335. "//components/certificate_transparency",
  336. "//components/embedder_support:browser_util",
  337. "//components/language/core/browser",
  338. "//components/net_log",
  339. "//components/network_hints/browser",
  340. "//components/network_hints/common:mojo_bindings",
  341. "//components/network_hints/renderer",
  342. "//components/network_session_configurator/common",
  343. "//components/omnibox/browser:buildflags",
  344. "//components/os_crypt",
  345. "//components/pref_registry",
  346. "//components/prefs",
  347. "//components/security_state/content",
  348. "//components/upload_list",
  349. "//components/user_prefs",
  350. "//components/viz/host",
  351. "//components/viz/service",
  352. "//content/public/browser",
  353. "//content/public/child",
  354. "//content/public/gpu",
  355. "//content/public/renderer",
  356. "//content/public/utility",
  357. "//device/bluetooth",
  358. "//device/bluetooth/public/cpp",
  359. "//gin",
  360. "//media/capture/mojom:video_capture",
  361. "//media/mojo/mojom",
  362. "//net:extras",
  363. "//net:net_resources",
  364. "//printing/buildflags",
  365. "//services/device/public/cpp/geolocation",
  366. "//services/device/public/cpp/hid",
  367. "//services/device/public/mojom",
  368. "//services/proxy_resolver:lib",
  369. "//services/video_capture/public/mojom:constants",
  370. "//services/viz/privileged/mojom/compositing",
  371. "//skia",
  372. "//third_party/blink/public:blink",
  373. "//third_party/blink/public:blink_devtools_inspector_resources",
  374. "//third_party/blink/public/platform/media",
  375. "//third_party/boringssl",
  376. "//third_party/electron_node:node_lib",
  377. "//third_party/inspector_protocol:crdtp",
  378. "//third_party/leveldatabase",
  379. "//third_party/libyuv",
  380. "//third_party/webrtc_overrides:webrtc_component",
  381. "//third_party/widevine/cdm:headers",
  382. "//third_party/zlib/google:zip",
  383. "//ui/base/idle",
  384. "//ui/events:dom_keycode_converter",
  385. "//ui/gl",
  386. "//ui/native_theme",
  387. "//ui/shell_dialogs",
  388. "//ui/views",
  389. "//v8",
  390. "//v8:v8_libplatform",
  391. ]
  392. public_deps = [
  393. "//base",
  394. "//base:i18n",
  395. "//content/public/app",
  396. ]
  397. include_dirs = [
  398. ".",
  399. "$target_gen_dir",
  400. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  401. # API of blink, then remove this from the include_dirs.
  402. "//third_party/blink/renderer",
  403. ]
  404. defines = [ "V8_DEPRECATION_WARNINGS" ]
  405. libs = []
  406. if (is_linux) {
  407. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  408. }
  409. if (!is_mas_build) {
  410. deps += [
  411. "//components/crash/core/app",
  412. "//components/crash/core/browser",
  413. ]
  414. }
  415. sources = filenames.lib_sources
  416. if (is_win) {
  417. sources += filenames.lib_sources_win
  418. }
  419. if (is_mac) {
  420. sources += filenames.lib_sources_mac
  421. }
  422. if (is_posix) {
  423. sources += filenames.lib_sources_posix
  424. }
  425. if (is_linux) {
  426. sources += filenames.lib_sources_linux
  427. }
  428. if (!is_mac) {
  429. sources += filenames.lib_sources_views
  430. }
  431. if (is_component_build) {
  432. defines += [ "NODE_SHARED_MODE" ]
  433. }
  434. if (enable_fake_location_provider) {
  435. sources += [
  436. "shell/browser/fake_location_provider.cc",
  437. "shell/browser/fake_location_provider.h",
  438. ]
  439. }
  440. if (is_linux) {
  441. deps += [
  442. "//components/crash/content/browser",
  443. "//ui/gtk:gtk_config",
  444. ]
  445. }
  446. if (is_mac) {
  447. deps += [
  448. "//components/remote_cocoa/app_shim",
  449. "//components/remote_cocoa/browser",
  450. "//content/common:mac_helpers",
  451. "//ui/accelerated_widget_mac",
  452. ]
  453. if (!is_mas_build) {
  454. deps += [ "//third_party/crashpad/crashpad/client" ]
  455. }
  456. frameworks = [
  457. "AVFoundation.framework",
  458. "Carbon.framework",
  459. "LocalAuthentication.framework",
  460. "QuartzCore.framework",
  461. "Quartz.framework",
  462. "Security.framework",
  463. "SecurityInterface.framework",
  464. "ServiceManagement.framework",
  465. "StoreKit.framework",
  466. ]
  467. weak_frameworks = [ "QuickLookThumbnailing.framework" ]
  468. sources += [
  469. "shell/browser/ui/views/autofill_popup_view.cc",
  470. "shell/browser/ui/views/autofill_popup_view.h",
  471. ]
  472. if (is_mas_build) {
  473. sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
  474. sources -= [ "shell/browser/auto_updater_mac.mm" ]
  475. defines += [ "MAS_BUILD" ]
  476. sources -= [
  477. "shell/app/electron_crash_reporter_client.cc",
  478. "shell/app/electron_crash_reporter_client.h",
  479. "shell/common/crash_keys.cc",
  480. "shell/common/crash_keys.h",
  481. ]
  482. } else {
  483. frameworks += [
  484. "Squirrel.framework",
  485. "ReactiveObjC.framework",
  486. "Mantle.framework",
  487. ]
  488. deps += [
  489. "//third_party/squirrel.mac:reactiveobjc_framework+link",
  490. "//third_party/squirrel.mac:squirrel_framework+link",
  491. ]
  492. # ReactiveObjC which is used by Squirrel requires using __weak.
  493. cflags_objcc = [ "-fobjc-weak" ]
  494. }
  495. }
  496. if (is_linux) {
  497. libs = [ "xshmfence" ]
  498. deps += [
  499. ":electron_gtk_stubs",
  500. ":libnotify_loader",
  501. "//build/config/linux/gtk",
  502. "//dbus",
  503. "//device/bluetooth",
  504. "//ui/base/ime/linux",
  505. "//ui/events/devices/x11",
  506. "//ui/events/platform/x11",
  507. "//ui/views/controls/webview",
  508. "//ui/views/linux_ui:linux_ui_factory",
  509. "//ui/wm",
  510. ]
  511. if (ozone_platform_x11) {
  512. sources += filenames.lib_sources_linux_x11
  513. public_deps += [
  514. "//ui/base/x",
  515. "//ui/ozone/platform/x11",
  516. ]
  517. }
  518. configs += [ ":gio_unix" ]
  519. defines += [
  520. # Disable warnings for g_settings_list_schemas.
  521. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  522. ]
  523. sources += [
  524. "shell/browser/certificate_manager_model.cc",
  525. "shell/browser/certificate_manager_model.h",
  526. "shell/browser/ui/gtk/app_indicator_icon.cc",
  527. "shell/browser/ui/gtk/app_indicator_icon.h",
  528. "shell/browser/ui/gtk/app_indicator_icon_menu.cc",
  529. "shell/browser/ui/gtk/app_indicator_icon_menu.h",
  530. "shell/browser/ui/gtk/gtk_status_icon.cc",
  531. "shell/browser/ui/gtk/gtk_status_icon.h",
  532. "shell/browser/ui/gtk/menu_util.cc",
  533. "shell/browser/ui/gtk/menu_util.h",
  534. "shell/browser/ui/gtk/status_icon.cc",
  535. "shell/browser/ui/gtk/status_icon.h",
  536. "shell/browser/ui/gtk_util.cc",
  537. "shell/browser/ui/gtk_util.h",
  538. ]
  539. }
  540. if (is_win) {
  541. libs += [ "dwmapi.lib" ]
  542. deps += [
  543. "//components/crash/core/app:crash_export_thunks",
  544. "//ui/native_theme:native_theme_browser",
  545. "//ui/views/controls/webview",
  546. "//ui/wm",
  547. "//ui/wm/public",
  548. ]
  549. public_deps += [
  550. "//sandbox/win:sandbox",
  551. "//third_party/crashpad/crashpad/handler",
  552. ]
  553. }
  554. if (enable_plugins) {
  555. deps += [
  556. "chromium_src:plugins",
  557. "//ppapi/host",
  558. "//ppapi/proxy",
  559. "//ppapi/shared_impl",
  560. ]
  561. sources += [
  562. "shell/renderer/electron_renderer_pepper_host_factory.cc",
  563. "shell/renderer/electron_renderer_pepper_host_factory.h",
  564. "shell/renderer/pepper_helper.cc",
  565. "shell/renderer/pepper_helper.h",
  566. ]
  567. }
  568. if (enable_run_as_node) {
  569. sources += [
  570. "shell/app/node_main.cc",
  571. "shell/app/node_main.h",
  572. ]
  573. }
  574. if (enable_osr) {
  575. sources += [
  576. "shell/browser/osr/osr_host_display_client.cc",
  577. "shell/browser/osr/osr_host_display_client.h",
  578. "shell/browser/osr/osr_render_widget_host_view.cc",
  579. "shell/browser/osr/osr_render_widget_host_view.h",
  580. "shell/browser/osr/osr_video_consumer.cc",
  581. "shell/browser/osr/osr_video_consumer.h",
  582. "shell/browser/osr/osr_view_proxy.cc",
  583. "shell/browser/osr/osr_view_proxy.h",
  584. "shell/browser/osr/osr_web_contents_view.cc",
  585. "shell/browser/osr/osr_web_contents_view.h",
  586. ]
  587. if (is_mac) {
  588. sources += [
  589. "shell/browser/osr/osr_host_display_client_mac.mm",
  590. "shell/browser/osr/osr_web_contents_view_mac.mm",
  591. ]
  592. }
  593. deps += [
  594. "//components/viz/service",
  595. "//services/viz/public/mojom",
  596. "//ui/compositor",
  597. ]
  598. }
  599. if (enable_desktop_capturer) {
  600. sources += [
  601. "shell/browser/api/electron_api_desktop_capturer.cc",
  602. "shell/browser/api/electron_api_desktop_capturer.h",
  603. ]
  604. }
  605. if (enable_views_api) {
  606. sources += [
  607. "shell/browser/api/views/electron_api_image_view.cc",
  608. "shell/browser/api/views/electron_api_image_view.h",
  609. ]
  610. }
  611. if (enable_basic_printing) {
  612. sources += [
  613. "shell/browser/printing/print_preview_message_handler.cc",
  614. "shell/browser/printing/print_preview_message_handler.h",
  615. "shell/browser/printing/print_view_manager_electron.cc",
  616. "shell/browser/printing/print_view_manager_electron.h",
  617. "shell/renderer/printing/print_render_frame_helper_delegate.cc",
  618. "shell/renderer/printing/print_render_frame_helper_delegate.h",
  619. ]
  620. deps += [
  621. "//chrome/services/printing/public/mojom",
  622. "//components/printing/common:mojo_interfaces",
  623. ]
  624. if (is_mac) {
  625. deps += [ "//chrome/services/mac_notifications/public/mojom" ]
  626. }
  627. }
  628. if (enable_electron_extensions) {
  629. sources += filenames.lib_sources_extensions
  630. deps += [
  631. "shell/browser/extensions/api:api_registration",
  632. "shell/common/extensions/api",
  633. "shell/common/extensions/api:extensions_features",
  634. "//chrome/browser/resources:component_extension_resources",
  635. "//components/update_client:update_client",
  636. "//components/zoom",
  637. "//extensions/browser",
  638. "//extensions/browser:core_api_provider",
  639. "//extensions/browser/updater",
  640. "//extensions/common",
  641. "//extensions/common:core_api_provider",
  642. "//extensions/renderer",
  643. ]
  644. }
  645. if (enable_pdf) {
  646. # Printing depends on some //pdf code, so it needs to be built even if the
  647. # pdf viewer isn't enabled.
  648. deps += [
  649. "//pdf",
  650. "//pdf:features",
  651. ]
  652. }
  653. if (enable_pdf_viewer) {
  654. deps += [
  655. "//chrome/browser/resources/pdf:resources",
  656. "//components/pdf/browser",
  657. "//components/pdf/browser:interceptors",
  658. "//components/pdf/common",
  659. "//components/pdf/renderer",
  660. "//pdf",
  661. ]
  662. sources += [
  663. "shell/browser/electron_pdf_web_contents_helper_client.cc",
  664. "shell/browser/electron_pdf_web_contents_helper_client.h",
  665. ]
  666. }
  667. sources += get_target_outputs(":electron_fuses")
  668. if (allow_runtime_configurable_key_storage) {
  669. defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
  670. }
  671. }
  672. electron_paks("packed_resources") {
  673. if (is_mac) {
  674. output_dir = "$root_gen_dir/electron_repack"
  675. copy_data_to_bundle = true
  676. } else {
  677. output_dir = root_out_dir
  678. }
  679. }
  680. if (is_mac) {
  681. electron_framework_name = "$electron_product_name Framework"
  682. electron_helper_name = "$electron_product_name Helper"
  683. electron_login_helper_name = "$electron_product_name Login Helper"
  684. electron_framework_version = "A"
  685. mac_xib_bundle_data("electron_xibs") {
  686. sources = [ "shell/common/resources/mac/MainMenu.xib" ]
  687. }
  688. action("fake_v8_context_snapshot_generator") {
  689. script = "build/fake_v8_context_snapshot_generator.py"
  690. args = [
  691. rebase_path("$root_out_dir/$v8_context_snapshot_filename"),
  692. rebase_path("$root_out_dir/fake/$v8_context_snapshot_filename"),
  693. ]
  694. outputs = [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
  695. }
  696. bundle_data("electron_framework_resources") {
  697. public_deps = [ ":packed_resources" ]
  698. sources = []
  699. if (icu_use_data_file) {
  700. sources += [ "$root_out_dir/icudtl.dat" ]
  701. public_deps += [ "//third_party/icu:icudata" ]
  702. }
  703. if (v8_use_external_startup_data) {
  704. public_deps += [ "//v8" ]
  705. if (use_v8_context_snapshot) {
  706. if (use_prebuilt_v8_context_snapshot) {
  707. sources += [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
  708. public_deps += [ ":fake_v8_context_snapshot_generator" ]
  709. } else {
  710. sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
  711. public_deps += [ "//tools/v8_context_snapshot" ]
  712. }
  713. } else {
  714. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  715. }
  716. }
  717. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  718. }
  719. if (!is_component_build && is_component_ffmpeg) {
  720. bundle_data("electron_framework_libraries") {
  721. sources = []
  722. public_deps = []
  723. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  724. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  725. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  726. }
  727. } else {
  728. group("electron_framework_libraries") {
  729. }
  730. }
  731. if (use_egl) {
  732. # Add the ANGLE .dylibs in the Libraries directory of the Framework.
  733. bundle_data("electron_angle_binaries") {
  734. sources = [
  735. "$root_out_dir/egl_intermediates/libEGL.dylib",
  736. "$root_out_dir/egl_intermediates/libGLESv2.dylib",
  737. ]
  738. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  739. public_deps = [ "//ui/gl:angle_library_copy" ]
  740. }
  741. # Add the SwiftShader .dylibs in the Libraries directory of the Framework.
  742. bundle_data("electron_swiftshader_binaries") {
  743. sources = [
  744. "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
  745. "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
  746. ]
  747. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  748. public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
  749. }
  750. }
  751. group("electron_angle_library") {
  752. if (use_egl) {
  753. deps = [ ":electron_angle_binaries" ]
  754. }
  755. }
  756. group("electron_swiftshader_library") {
  757. if (use_egl) {
  758. deps = [ ":electron_swiftshader_binaries" ]
  759. }
  760. }
  761. bundle_data("electron_crashpad_helper") {
  762. sources = [ "$root_out_dir/chrome_crashpad_handler" ]
  763. outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
  764. public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  765. if (is_asan) {
  766. # crashpad_handler requires the ASan runtime at its @executable_path.
  767. sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
  768. public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
  769. }
  770. }
  771. mac_framework_bundle("electron_framework") {
  772. output_name = electron_framework_name
  773. framework_version = electron_framework_version
  774. framework_contents = [
  775. "Resources",
  776. "Libraries",
  777. ]
  778. if (!is_mas_build) {
  779. framework_contents += [ "Helpers" ]
  780. }
  781. public_deps = [
  782. ":electron_framework_libraries",
  783. ":electron_lib",
  784. ]
  785. deps = [
  786. ":electron_angle_library",
  787. ":electron_framework_libraries",
  788. ":electron_framework_resources",
  789. ":electron_swiftshader_library",
  790. ":electron_xibs",
  791. ]
  792. if (!is_mas_build) {
  793. deps += [ ":electron_crashpad_helper" ]
  794. }
  795. info_plist = "shell/common/resources/mac/Info.plist"
  796. extra_substitutions = [
  797. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
  798. "ELECTRON_VERSION=$electron_version",
  799. ]
  800. include_dirs = [ "." ]
  801. sources = filenames.framework_sources
  802. frameworks = []
  803. if (enable_osr) {
  804. frameworks += [ "IOSurface.framework" ]
  805. }
  806. ldflags = [
  807. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  808. "-rpath",
  809. "@loader_path/Libraries",
  810. # Required for exporting all symbols of libuv.
  811. "-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a",
  812. ]
  813. if (is_component_build) {
  814. ldflags += [
  815. "-rpath",
  816. "@executable_path/../../../../../..",
  817. ]
  818. }
  819. }
  820. template("electron_helper_app") {
  821. mac_app_bundle(target_name) {
  822. assert(defined(invoker.helper_name_suffix))
  823. output_name = electron_helper_name + invoker.helper_name_suffix
  824. deps = [
  825. ":electron_framework+link",
  826. "//base/allocator:early_zone_registration_mac",
  827. ]
  828. if (!is_mas_build) {
  829. deps += [ "//sandbox/mac:seatbelt" ]
  830. }
  831. defines = [ "HELPER_EXECUTABLE" ]
  832. sources = [
  833. "shell/app/electron_main_mac.cc",
  834. "shell/app/uv_stdio_fix.cc",
  835. "shell/app/uv_stdio_fix.h",
  836. "shell/common/electron_constants.cc",
  837. ]
  838. include_dirs = [ "." ]
  839. info_plist = "shell/renderer/resources/mac/Info.plist"
  840. extra_substitutions =
  841. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  842. ldflags = [
  843. "-rpath",
  844. "@executable_path/../../..",
  845. ]
  846. if (is_component_build) {
  847. ldflags += [
  848. "-rpath",
  849. "@executable_path/../../../../../..",
  850. ]
  851. }
  852. }
  853. }
  854. foreach(helper_params, content_mac_helpers) {
  855. _helper_target = helper_params[0]
  856. _helper_bundle_id = helper_params[1]
  857. _helper_suffix = helper_params[2]
  858. electron_helper_app("electron_helper_app_${_helper_target}") {
  859. helper_name_suffix = _helper_suffix
  860. }
  861. }
  862. template("stripped_framework") {
  863. action(target_name) {
  864. assert(defined(invoker.framework))
  865. script = "//electron/build/strip_framework.py"
  866. forward_variables_from(invoker, [ "deps" ])
  867. inputs = [ "$root_out_dir/" + invoker.framework ]
  868. outputs = [ "$target_out_dir/stripped_frameworks/" + invoker.framework ]
  869. args = rebase_path(inputs) + rebase_path(outputs)
  870. }
  871. }
  872. stripped_framework("stripped_mantle_framework") {
  873. framework = "Mantle.framework"
  874. deps = [ "//third_party/squirrel.mac:mantle_framework" ]
  875. }
  876. stripped_framework("stripped_reactiveobjc_framework") {
  877. framework = "ReactiveObjC.framework"
  878. deps = [ "//third_party/squirrel.mac:reactiveobjc_framework" ]
  879. }
  880. stripped_framework("stripped_squirrel_framework") {
  881. framework = "Squirrel.framework"
  882. deps = [ "//third_party/squirrel.mac:squirrel_framework" ]
  883. }
  884. bundle_data("electron_app_framework_bundle_data") {
  885. sources = [ "$root_out_dir/$electron_framework_name.framework" ]
  886. if (!is_mas_build) {
  887. sources += get_target_outputs(":stripped_mantle_framework") +
  888. get_target_outputs(":stripped_reactiveobjc_framework") +
  889. get_target_outputs(":stripped_squirrel_framework")
  890. }
  891. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  892. public_deps = [
  893. ":electron_framework+link",
  894. ":stripped_mantle_framework",
  895. ":stripped_reactiveobjc_framework",
  896. ":stripped_squirrel_framework",
  897. ]
  898. foreach(helper_params, content_mac_helpers) {
  899. sources +=
  900. [ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
  901. public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
  902. }
  903. }
  904. mac_app_bundle("electron_login_helper") {
  905. output_name = electron_login_helper_name
  906. sources = filenames.login_helper_sources
  907. include_dirs = [ "." ]
  908. frameworks = [ "AppKit.framework" ]
  909. info_plist = "shell/app/resources/mac/loginhelper-Info.plist"
  910. extra_substitutions =
  911. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  912. }
  913. bundle_data("electron_login_helper_app") {
  914. public_deps = [ ":electron_login_helper" ]
  915. sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
  916. outputs =
  917. [ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
  918. }
  919. action("electron_app_lproj_dirs") {
  920. outputs = []
  921. foreach(locale, locales_as_apple_outputs) {
  922. outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  923. }
  924. script = "build/mac/make_locale_dirs.py"
  925. args = rebase_path(outputs)
  926. }
  927. foreach(locale, locales_as_apple_outputs) {
  928. bundle_data("electron_app_strings_${locale}_bundle_data") {
  929. sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  930. outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
  931. public_deps = [ ":electron_app_lproj_dirs" ]
  932. }
  933. }
  934. group("electron_app_strings_bundle_data") {
  935. public_deps = []
  936. foreach(locale, locales_as_apple_outputs) {
  937. public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
  938. }
  939. }
  940. bundle_data("electron_app_resources") {
  941. public_deps = [
  942. ":default_app_asar",
  943. ":electron_app_strings_bundle_data",
  944. ]
  945. sources = [
  946. "$root_out_dir/resources/default_app.asar",
  947. "shell/browser/resources/mac/electron.icns",
  948. ]
  949. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  950. }
  951. asar_hashed_info_plist("electron_app_plist") {
  952. keys = [ "DEFAULT_APP_ASAR_HEADER_SHA" ]
  953. hash_targets = [ ":default_app_asar_header_hash" ]
  954. plist_file = "shell/browser/resources/mac/Info.plist"
  955. }
  956. mac_app_bundle("electron_app") {
  957. output_name = electron_product_name
  958. sources = [
  959. "shell/app/electron_main_mac.cc",
  960. "shell/app/uv_stdio_fix.cc",
  961. "shell/app/uv_stdio_fix.h",
  962. ]
  963. include_dirs = [ "." ]
  964. deps = [
  965. ":electron_app_framework_bundle_data",
  966. ":electron_app_plist",
  967. ":electron_app_resources",
  968. ":electron_fuses",
  969. "//base/allocator:early_zone_registration_mac",
  970. "//electron/buildflags",
  971. ]
  972. if (is_mas_build) {
  973. deps += [ ":electron_login_helper_app" ]
  974. }
  975. info_plist_target = ":electron_app_plist"
  976. extra_substitutions = [
  977. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
  978. "ELECTRON_VERSION=$electron_version",
  979. ]
  980. ldflags = [
  981. "-rpath",
  982. "@executable_path/../Frameworks",
  983. ]
  984. }
  985. if (enable_dsyms) {
  986. extract_symbols("electron_framework_syms") {
  987. binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
  988. symbol_dir = "$root_out_dir/breakpad_symbols"
  989. dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
  990. deps = [ ":electron_framework" ]
  991. }
  992. foreach(helper_params, content_mac_helpers) {
  993. _helper_target = helper_params[0]
  994. _helper_bundle_id = helper_params[1]
  995. _helper_suffix = helper_params[2]
  996. extract_symbols("electron_helper_syms_${_helper_target}") {
  997. binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
  998. symbol_dir = "$root_out_dir/breakpad_symbols"
  999. dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
  1000. deps = [ ":electron_helper_app_${_helper_target}" ]
  1001. }
  1002. }
  1003. extract_symbols("electron_app_syms") {
  1004. binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
  1005. symbol_dir = "$root_out_dir/breakpad_symbols"
  1006. dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
  1007. deps = [ ":electron_app" ]
  1008. }
  1009. extract_symbols("egl_syms") {
  1010. binary = "$root_out_dir/libEGL.dylib"
  1011. symbol_dir = "$root_out_dir/breakpad_symbols"
  1012. dsym_file = "$root_out_dir/libEGL.dylib.dSYM/Contents/Resources/DWARF/libEGL.dylib"
  1013. deps = [ "//third_party/angle:libEGL" ]
  1014. }
  1015. extract_symbols("gles_syms") {
  1016. binary = "$root_out_dir/libGLESv2.dylib"
  1017. symbol_dir = "$root_out_dir/breakpad_symbols"
  1018. dsym_file = "$root_out_dir/libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libGLESv2.dylib"
  1019. deps = [ "//third_party/angle:libGLESv2" ]
  1020. }
  1021. extract_symbols("crashpad_handler_syms") {
  1022. binary = "$root_out_dir/chrome_crashpad_handler"
  1023. symbol_dir = "$root_out_dir/breakpad_symbols"
  1024. dsym_file = "$root_out_dir/chrome_crashpad_handler.dSYM/Contents/Resources/DWARF/chrome_crashpad_handler"
  1025. deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1026. }
  1027. group("electron_symbols") {
  1028. deps = [
  1029. ":egl_syms",
  1030. ":electron_app_syms",
  1031. ":electron_framework_syms",
  1032. ":gles_syms",
  1033. ]
  1034. if (!is_mas_build) {
  1035. deps += [ ":crashpad_handler_syms" ]
  1036. }
  1037. foreach(helper_params, content_mac_helpers) {
  1038. _helper_target = helper_params[0]
  1039. deps += [ ":electron_helper_syms_${_helper_target}" ]
  1040. }
  1041. }
  1042. } else {
  1043. group("electron_symbols") {
  1044. }
  1045. }
  1046. } else {
  1047. windows_manifest("electron_app_manifest") {
  1048. sources = [
  1049. "shell/browser/resources/win/disable_window_filtering.manifest",
  1050. "shell/browser/resources/win/dpi_aware.manifest",
  1051. as_invoker_manifest,
  1052. common_controls_manifest,
  1053. default_compatibility_manifest,
  1054. ]
  1055. }
  1056. executable("electron_app") {
  1057. output_name = electron_project_name
  1058. if (is_win) {
  1059. sources = [ "shell/app/electron_main_win.cc" ]
  1060. } else if (is_linux) {
  1061. sources = [
  1062. "shell/app/electron_main_linux.cc",
  1063. "shell/app/uv_stdio_fix.cc",
  1064. "shell/app/uv_stdio_fix.h",
  1065. ]
  1066. }
  1067. include_dirs = [ "." ]
  1068. deps = [
  1069. ":default_app_asar",
  1070. ":electron_app_manifest",
  1071. ":electron_lib",
  1072. ":electron_win32_resources",
  1073. ":packed_resources",
  1074. "//components/crash/core/app",
  1075. "//content:sandbox_helper_win",
  1076. "//electron/buildflags",
  1077. "//ui/strings",
  1078. ]
  1079. data = []
  1080. data_deps = []
  1081. data += [ "$root_out_dir/resources.pak" ]
  1082. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  1083. if (enable_hidpi) {
  1084. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  1085. }
  1086. foreach(locale, platform_pak_locales) {
  1087. data += [ "$root_out_dir/locales/$locale.pak" ]
  1088. }
  1089. if (!is_mac) {
  1090. data += [ "$root_out_dir/resources/default_app.asar" ]
  1091. }
  1092. if (use_v8_context_snapshot) {
  1093. public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
  1094. }
  1095. if (is_linux) {
  1096. data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1097. }
  1098. if (is_win) {
  1099. sources += [
  1100. "$target_gen_dir/win-resources/electron.rc",
  1101. "shell/browser/resources/win/resource.h",
  1102. ]
  1103. deps += [
  1104. "//components/browser_watcher:browser_watcher_client",
  1105. "//components/crash/core/app:run_as_crashpad_handler",
  1106. ]
  1107. ldflags = []
  1108. libs = [
  1109. "comctl32.lib",
  1110. "uiautomationcore.lib",
  1111. "wtsapi32.lib",
  1112. ]
  1113. configs -= [ "//build/config/win:console" ]
  1114. configs += [
  1115. "//build/config/win:windowed",
  1116. "//build/config/win:delayloads",
  1117. ]
  1118. if (current_cpu == "x86") {
  1119. # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
  1120. # Chrome's main thread. This saves significant memory on threads (like
  1121. # those in the Windows thread pool, and others) whose stack size we can
  1122. # only control through this setting. Because Chrome's main thread needs
  1123. # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
  1124. # fibers to switch to a 1.5 MiB stack before running any other code.
  1125. ldflags += [ "/STACK:0x80000" ]
  1126. } else {
  1127. # Increase the initial stack size. The default is 1MB, this is 8MB.
  1128. ldflags += [ "/STACK:0x800000" ]
  1129. }
  1130. # This is to support renaming of electron.exe. node-gyp has hard-coded
  1131. # executable names which it will recognise as node. This module definition
  1132. # file claims that the electron executable is in fact named "node.exe",
  1133. # which is one of the executable names that node-gyp recognizes.
  1134. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  1135. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  1136. inputs = [
  1137. "shell/browser/resources/win/electron.ico",
  1138. "build/electron.def",
  1139. ]
  1140. }
  1141. if (is_linux) {
  1142. ldflags = [
  1143. "-pie",
  1144. # Required for exporting all symbols of libuv.
  1145. "-Wl,--whole-archive",
  1146. "obj/third_party/electron_node/deps/uv/libuv.a",
  1147. "-Wl,--no-whole-archive",
  1148. ]
  1149. if (!is_component_build && is_component_ffmpeg) {
  1150. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  1151. }
  1152. if (is_linux) {
  1153. deps += [ "//sandbox/linux:chrome_sandbox" ]
  1154. }
  1155. }
  1156. }
  1157. if (is_official_build) {
  1158. if (is_linux) {
  1159. _target_executable_suffix = ""
  1160. _target_shared_library_suffix = ".so"
  1161. } else if (is_win) {
  1162. _target_executable_suffix = ".exe"
  1163. _target_shared_library_suffix = ".dll"
  1164. }
  1165. extract_symbols("electron_app_symbols") {
  1166. binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
  1167. symbol_dir = "$root_out_dir/breakpad_symbols"
  1168. deps = [ ":electron_app" ]
  1169. }
  1170. extract_symbols("egl_symbols") {
  1171. binary = "$root_out_dir/libEGL$_target_shared_library_suffix"
  1172. symbol_dir = "$root_out_dir/breakpad_symbols"
  1173. deps = [ "//third_party/angle:libEGL" ]
  1174. }
  1175. extract_symbols("gles_symbols") {
  1176. binary = "$root_out_dir/libGLESv2$_target_shared_library_suffix"
  1177. symbol_dir = "$root_out_dir/breakpad_symbols"
  1178. deps = [ "//third_party/angle:libGLESv2" ]
  1179. }
  1180. group("electron_symbols") {
  1181. deps = [
  1182. ":egl_symbols",
  1183. ":electron_app_symbols",
  1184. ":gles_symbols",
  1185. ]
  1186. }
  1187. }
  1188. }
  1189. test("shell_browser_ui_unittests") {
  1190. sources = [
  1191. "//electron/shell/browser/ui/accelerator_util_unittests.cc",
  1192. "//electron/shell/browser/ui/run_all_unittests.cc",
  1193. ]
  1194. configs += [ ":electron_lib_config" ]
  1195. deps = [
  1196. ":electron_lib",
  1197. "//base",
  1198. "//base/test:test_support",
  1199. "//testing/gmock",
  1200. "//testing/gtest",
  1201. "//ui/base",
  1202. "//ui/strings",
  1203. ]
  1204. }
  1205. template("dist_zip") {
  1206. _runtime_deps_target = "${target_name}__deps"
  1207. _runtime_deps_file =
  1208. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  1209. get_label_info(target_name, "name") + ".runtime_deps"
  1210. group(_runtime_deps_target) {
  1211. forward_variables_from(invoker,
  1212. [
  1213. "deps",
  1214. "data_deps",
  1215. "data",
  1216. "testonly",
  1217. ])
  1218. write_runtime_deps = _runtime_deps_file
  1219. }
  1220. action(target_name) {
  1221. script = "//electron/build/zip.py"
  1222. deps = [ ":$_runtime_deps_target" ]
  1223. forward_variables_from(invoker,
  1224. [
  1225. "outputs",
  1226. "testonly",
  1227. ])
  1228. flatten = false
  1229. flatten_relative_to = false
  1230. if (defined(invoker.flatten)) {
  1231. flatten = invoker.flatten
  1232. if (defined(invoker.flatten_relative_to)) {
  1233. flatten_relative_to = invoker.flatten_relative_to
  1234. }
  1235. }
  1236. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  1237. target_cpu,
  1238. target_os,
  1239. "$flatten",
  1240. "$flatten_relative_to",
  1241. ]
  1242. }
  1243. }
  1244. copy("electron_license") {
  1245. sources = [ "LICENSE" ]
  1246. outputs = [ "$root_build_dir/{{source_file_part}}" ]
  1247. }
  1248. copy("chromium_licenses") {
  1249. deps = [ "//components/resources:about_credits" ]
  1250. sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
  1251. outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
  1252. }
  1253. group("licenses") {
  1254. data_deps = [
  1255. ":chromium_licenses",
  1256. ":electron_license",
  1257. ]
  1258. }
  1259. dist_zip("electron_dist_zip") {
  1260. data_deps = [
  1261. ":electron_app",
  1262. ":electron_version_file",
  1263. ":licenses",
  1264. ]
  1265. if (is_linux) {
  1266. data_deps += [ "//sandbox/linux:chrome_sandbox" ]
  1267. }
  1268. deps = data_deps
  1269. outputs = [ "$root_build_dir/dist.zip" ]
  1270. }
  1271. dist_zip("electron_ffmpeg_zip") {
  1272. data_deps = [ "//third_party/ffmpeg" ]
  1273. deps = data_deps
  1274. outputs = [ "$root_build_dir/ffmpeg.zip" ]
  1275. }
  1276. electron_chromedriver_deps = [
  1277. ":licenses",
  1278. "//chrome/test/chromedriver",
  1279. "//electron/buildflags",
  1280. ]
  1281. group("electron_chromedriver") {
  1282. testonly = true
  1283. public_deps = electron_chromedriver_deps
  1284. }
  1285. dist_zip("electron_chromedriver_zip") {
  1286. testonly = true
  1287. data_deps = electron_chromedriver_deps
  1288. deps = data_deps
  1289. outputs = [ "$root_build_dir/chromedriver.zip" ]
  1290. }
  1291. mksnapshot_deps = [
  1292. ":licenses",
  1293. "//v8:mksnapshot($v8_snapshot_toolchain)",
  1294. ]
  1295. if (use_v8_context_snapshot) {
  1296. mksnapshot_deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
  1297. }
  1298. group("electron_mksnapshot") {
  1299. public_deps = mksnapshot_deps
  1300. }
  1301. dist_zip("electron_mksnapshot_zip") {
  1302. data_deps = mksnapshot_deps
  1303. deps = data_deps
  1304. outputs = [ "$root_build_dir/mksnapshot.zip" ]
  1305. }
  1306. copy("hunspell_dictionaries") {
  1307. sources = hunspell_dictionaries + hunspell_licenses
  1308. outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
  1309. }
  1310. dist_zip("hunspell_dictionaries_zip") {
  1311. data_deps = [ ":hunspell_dictionaries" ]
  1312. deps = data_deps
  1313. flatten = true
  1314. outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
  1315. }
  1316. copy("libcxx_headers") {
  1317. sources = libcxx_headers + libcxx_licenses +
  1318. [ "//buildtools/third_party/libc++/__config_site" ]
  1319. outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1320. }
  1321. dist_zip("libcxx_headers_zip") {
  1322. data_deps = [ ":libcxx_headers" ]
  1323. deps = data_deps
  1324. flatten = true
  1325. flatten_relative_to = rebase_path(
  1326. "$target_gen_dir/electron_libcxx_include/buildtools/third_party/libc++/trunk",
  1327. "$root_out_dir")
  1328. outputs = [ "$root_build_dir/libcxx_headers.zip" ]
  1329. }
  1330. copy("libcxxabi_headers") {
  1331. sources = libcxxabi_headers + libcxxabi_licenses
  1332. outputs = [ "$target_gen_dir/electron_libcxxabi_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1333. }
  1334. dist_zip("libcxxabi_headers_zip") {
  1335. data_deps = [ ":libcxxabi_headers" ]
  1336. deps = data_deps
  1337. flatten = true
  1338. flatten_relative_to = rebase_path(
  1339. "$target_gen_dir/electron_libcxxabi_include/buildtools/third_party/libc++abi/trunk",
  1340. "$root_out_dir")
  1341. outputs = [ "$root_build_dir/libcxxabi_headers.zip" ]
  1342. }
  1343. action("libcxx_objects_zip") {
  1344. deps = [ "//buildtools/third_party/libc++" ]
  1345. script = "build/zip_libcxx.py"
  1346. outputs = [ "$root_build_dir/libcxx_objects.zip" ]
  1347. args = rebase_path(outputs)
  1348. }
  1349. group("electron") {
  1350. public_deps = [ ":electron_app" ]
  1351. }