BUILD.gn 44 KB

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