BUILD.gn 44 KB

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