BUILD.gn 46 KB

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