BUILD.gn 46 KB

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