BUILD.gn 44 KB

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