BUILD.gn 44 KB

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