BUILD.gn 43 KB

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