BUILD.gn 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. import("//Meta/gn/build/compiled_action.gni")
  2. import("//Meta/gn/build/embed_as_string.gni")
  3. import("generate_idl_bindings.gni")
  4. import("idl_files.gni")
  5. generate_idl_bindings("standard_idl_bindings") {
  6. idl_list = standard_idl_files
  7. type = "standard"
  8. }
  9. generate_idl_bindings("iterable_idl_bindings") {
  10. idl_list = iterable_idl_files
  11. type = "iterable"
  12. }
  13. generate_idl_bindings("namespace_idl_bindings") {
  14. idl_list = namespace_idl_files
  15. type = "namespace"
  16. }
  17. generate_idl_bindings("global_idl_bindings") {
  18. idl_list = global_idl_files
  19. type = "global"
  20. }
  21. generate_idl_targets = [
  22. ":standard_idl_bindings_generated",
  23. ":iterable_idl_bindings_generated",
  24. ":namespace_idl_bindings_generated",
  25. ":global_idl_bindings_generated",
  26. ]
  27. idl_sources_targets = [
  28. ":standard_idl_bindings_sources",
  29. ":iterable_idl_bindings_sources",
  30. ":namespace_idl_bindings_sources",
  31. ":global_idl_bindings_sources",
  32. ]
  33. compiled_action("WebWorkerClientEndpoint") {
  34. tool = "//Meta/Lagom/Tools/CodeGenerators/IPCCompiler"
  35. inputs = [ "//Userland/Libraries/LibWeb/Worker/WebWorkerClient.ipc" ]
  36. outputs = [ "$root_gen_dir/LibWeb/Worker/WebWorkerClientEndpoint.h" ]
  37. args = [
  38. rebase_path(inputs[0], root_build_dir),
  39. "-o",
  40. rebase_path(outputs[0], root_build_dir),
  41. ]
  42. }
  43. compiled_action("WebWorkerServerEndpoint") {
  44. tool = "//Meta/Lagom/Tools/CodeGenerators/IPCCompiler"
  45. inputs = [ "//Userland/Libraries/LibWeb/Worker/WebWorkerServer.ipc" ]
  46. outputs = [ "$root_gen_dir/LibWeb/Worker/WebWorkerServerEndpoint.h" ]
  47. args = [
  48. rebase_path(inputs[0], root_build_dir),
  49. "-o",
  50. rebase_path(outputs[0], root_build_dir),
  51. ]
  52. }
  53. compiled_action("generate_window_or_worker_interfaces") {
  54. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateWindowOrWorkerInterfaces"
  55. inputs = standard_idl_files + iterable_idl_files + namespace_idl_files +
  56. global_idl_files
  57. outputs = [
  58. "$target_gen_dir/Bindings/IntrinsicDefinitions.cpp",
  59. "$target_gen_dir/Bindings/DedicatedWorkerExposedInterfaces.cpp",
  60. "$target_gen_dir/Bindings/DedicatedWorkerExposedInterfaces.h",
  61. "$target_gen_dir/Bindings/SharedWorkerExposedInterfaces.cpp",
  62. "$target_gen_dir/Bindings/SharedWorkerExposedInterfaces.h",
  63. "$target_gen_dir/Bindings/WindowExposedInterfaces.cpp",
  64. "$target_gen_dir/Bindings/WindowExposedInterfaces.h",
  65. ]
  66. args = [
  67. "-o",
  68. rebase_path("$target_gen_dir/Bindings", root_build_dir),
  69. "-b",
  70. rebase_path("//Userland/Libraries/LibWeb", root_build_dir),
  71. ]
  72. foreach(idl, inputs) {
  73. args += [ rebase_path(idl, root_build_dir) ]
  74. }
  75. }
  76. compiled_action("generate_aria_roles") {
  77. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateAriaRoles"
  78. inputs = [ "ARIA/AriaRoles.json" ]
  79. outputs = [
  80. "$target_gen_dir/ARIA/AriaRoles.h",
  81. "$target_gen_dir/ARIA/AriaRoles.cpp",
  82. ]
  83. args = [
  84. "-h",
  85. rebase_path(outputs[0], root_build_dir),
  86. "-c",
  87. rebase_path(outputs[1], root_build_dir),
  88. "-j",
  89. rebase_path(inputs[0], root_build_dir),
  90. ]
  91. }
  92. compiled_action("generate_css_enums") {
  93. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSEnums"
  94. inputs = [ "CSS/Enums.json" ]
  95. outputs = [
  96. "$target_gen_dir/CSS/Enums.h",
  97. "$target_gen_dir/CSS/Enums.cpp",
  98. ]
  99. args = [
  100. "-h",
  101. rebase_path(outputs[0], root_build_dir),
  102. "-c",
  103. rebase_path(outputs[1], root_build_dir),
  104. "-j",
  105. rebase_path(inputs[0], root_build_dir),
  106. ]
  107. }
  108. compiled_action("generate_css_math_functions") {
  109. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSMathFunctions"
  110. inputs = [ "CSS/MathFunctions.json" ]
  111. outputs = [
  112. "$target_gen_dir/CSS/MathFunctions.h",
  113. "$target_gen_dir/CSS/MathFunctions.cpp",
  114. ]
  115. args = [
  116. "-h",
  117. rebase_path(outputs[0], root_build_dir),
  118. "-c",
  119. rebase_path(outputs[1], root_build_dir),
  120. "-j",
  121. rebase_path(inputs[0], root_build_dir),
  122. ]
  123. }
  124. compiled_action("generate_css_media_feature_id") {
  125. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSMediaFeatureID"
  126. inputs = [ "CSS/MediaFeatures.json" ]
  127. outputs = [
  128. "$target_gen_dir/CSS/MediaFeatureID.h",
  129. "$target_gen_dir/CSS/MediaFeatureID.cpp",
  130. ]
  131. args = [
  132. "-h",
  133. rebase_path(outputs[0], root_build_dir),
  134. "-c",
  135. rebase_path(outputs[1], root_build_dir),
  136. "-j",
  137. rebase_path(inputs[0], root_build_dir),
  138. ]
  139. }
  140. compiled_action("generate_css_property_id") {
  141. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSPropertyID"
  142. inputs = [ "CSS/Properties.json" ]
  143. outputs = [
  144. "$target_gen_dir/CSS/PropertyID.h",
  145. "$target_gen_dir/CSS/PropertyID.cpp",
  146. ]
  147. args = [
  148. "-h",
  149. rebase_path(outputs[0], root_build_dir),
  150. "-c",
  151. rebase_path(outputs[1], root_build_dir),
  152. "-j",
  153. rebase_path(inputs[0], root_build_dir),
  154. ]
  155. }
  156. compiled_action("generate_css_pseudo_class") {
  157. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSPseudoClass"
  158. inputs = [ "CSS/PseudoClasses.json" ]
  159. outputs = [
  160. "$target_gen_dir/CSS/PseudoClass.h",
  161. "$target_gen_dir/CSS/PseudoClass.cpp",
  162. ]
  163. args = [
  164. "-h",
  165. rebase_path(outputs[0], root_build_dir),
  166. "-c",
  167. rebase_path(outputs[1], root_build_dir),
  168. "-j",
  169. rebase_path(inputs[0], root_build_dir),
  170. ]
  171. }
  172. compiled_action("generate_css_transform_functions") {
  173. tool =
  174. "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSTransformFunctions"
  175. inputs = [ "CSS/TransformFunctions.json" ]
  176. outputs = [
  177. "$target_gen_dir/CSS/TransformFunctions.h",
  178. "$target_gen_dir/CSS/TransformFunctions.cpp",
  179. ]
  180. args = [
  181. "-h",
  182. rebase_path(outputs[0], root_build_dir),
  183. "-c",
  184. rebase_path(outputs[1], root_build_dir),
  185. "-j",
  186. rebase_path(inputs[0], root_build_dir),
  187. ]
  188. }
  189. compiled_action("generate_css_keyword") {
  190. tool = "//Meta/Lagom/Tools/CodeGenerators/LibWeb:GenerateCSSKeyword"
  191. inputs = [ "CSS/Keywords.json" ]
  192. outputs = [
  193. "$target_gen_dir/CSS/Keyword.h",
  194. "$target_gen_dir/CSS/Keyword.cpp",
  195. ]
  196. args = [
  197. "-h",
  198. rebase_path(outputs[0], root_build_dir),
  199. "-c",
  200. rebase_path(outputs[1], root_build_dir),
  201. "-j",
  202. rebase_path(inputs[0], root_build_dir),
  203. ]
  204. }
  205. embed_as_string("generate_default_stylesheet_source") {
  206. input = "CSS/Default.css"
  207. output = "$target_gen_dir/CSS/DefaultStyleSheetSource.cpp"
  208. variable_name = "default_stylesheet_source"
  209. namespace = "Web::CSS"
  210. }
  211. embed_as_string("generate_mathml_stylesheet_source") {
  212. input = "MathML/Default.css"
  213. output = "$target_gen_dir/MathML/MathMLStyleSheetSource.cpp"
  214. variable_name = "mathml_stylesheet_source"
  215. namespace = "Web::CSS"
  216. }
  217. embed_as_string("generate_svg_stylesheet_source") {
  218. input = "SVG/Default.css"
  219. output = "$target_gen_dir/SVG/SVGStyleSheetSource.cpp"
  220. variable_name = "svg_stylesheet_source"
  221. namespace = "Web::CSS"
  222. }
  223. embed_as_string("generate_quirks_mode_stylesheet_source") {
  224. input = "CSS/QuirksMode.css"
  225. output = "$target_gen_dir/CSS/QuirksModeStyleSheetSource.cpp"
  226. variable_name = "quirks_mode_stylesheet_source"
  227. namespace = "Web::CSS"
  228. }
  229. source_set("all_generated") {
  230. generated_deps = [
  231. ":WebWorkerClientEndpoint",
  232. ":WebWorkerServerEndpoint",
  233. ":generate_aria_roles",
  234. ":generate_css_enums",
  235. ":generate_css_keyword",
  236. ":generate_css_math_functions",
  237. ":generate_css_media_feature_id",
  238. ":generate_css_property_id",
  239. ":generate_css_pseudo_class",
  240. ":generate_css_transform_functions",
  241. ":generate_default_stylesheet_source",
  242. ":generate_mathml_stylesheet_source",
  243. ":generate_quirks_mode_stylesheet_source",
  244. ":generate_svg_stylesheet_source",
  245. ":generate_window_or_worker_interfaces",
  246. ]
  247. configs += [ ":configs" ]
  248. sources = []
  249. foreach(dep, generated_deps) {
  250. sources += get_target_outputs(dep)
  251. }
  252. deps = generated_deps + generate_idl_targets
  253. }
  254. config("configs") {
  255. include_dirs = [
  256. "//Userland/Libraries",
  257. "//Userland/Services", # FIXME: BackingStoreManager lives in WebContent
  258. "$target_gen_dir/..",
  259. ]
  260. configs = [ "//AK:ak_headers" ]
  261. }
  262. shared_library("LibWeb") {
  263. output_name = "web"
  264. public_configs = [ ":configs" ]
  265. sources = [
  266. "Dump.cpp",
  267. "Namespace.cpp",
  268. "PixelUnits.cpp",
  269. ]
  270. deps = [
  271. ":all_generated",
  272. "ARIA",
  273. "Animations",
  274. "Bindings",
  275. "CSS",
  276. "Clipboard",
  277. "Cookie",
  278. "Crypto",
  279. "DOM",
  280. "DOMParsing",
  281. "DOMURL",
  282. "Encoding",
  283. "EntriesAPI",
  284. "EventTiming",
  285. "Fetch",
  286. "FileAPI",
  287. "Geometry",
  288. "HTML",
  289. "HighResolutionTime",
  290. "IndexedDB",
  291. "Infra",
  292. "Internals",
  293. "IntersectionObserver",
  294. "Layout",
  295. "Loader",
  296. "MathML",
  297. "MediaCapabilitiesAPI",
  298. "MimeSniff",
  299. "MixedContent",
  300. "NavigationTiming",
  301. "Page",
  302. "Painting",
  303. "PerformanceTimeline",
  304. "PermissionsPolicy",
  305. "Platform",
  306. "ReferrerPolicy",
  307. "RequestIdleCallback",
  308. "ResizeObserver",
  309. "SRI",
  310. "SVG",
  311. "SecureContexts",
  312. "Selection",
  313. "ServiceWorker",
  314. "StorageAPI",
  315. "Streams",
  316. "UIEvents",
  317. "UserTiming",
  318. "WebAssembly",
  319. "WebAudio",
  320. "WebDriver",
  321. "WebGL",
  322. "WebIDL",
  323. "WebSockets",
  324. "WebVTT",
  325. "Worker",
  326. "XHR",
  327. "XLink",
  328. "XML",
  329. "//AK",
  330. "//Meta/gn/build/libs/skia",
  331. "//Meta/gn/build/libs/vulkan",
  332. "//Userland/Libraries/LibCore",
  333. "//Userland/Libraries/LibCrypto",
  334. "//Userland/Libraries/LibGfx",
  335. "//Userland/Libraries/LibHTTP",
  336. "//Userland/Libraries/LibIDL",
  337. "//Userland/Libraries/LibIPC",
  338. "//Userland/Libraries/LibJS",
  339. "//Userland/Libraries/LibMedia",
  340. "//Userland/Libraries/LibRegex",
  341. "//Userland/Libraries/LibRequests",
  342. "//Userland/Libraries/LibSyntax",
  343. "//Userland/Libraries/LibTLS",
  344. "//Userland/Libraries/LibTextCodec",
  345. "//Userland/Libraries/LibURL",
  346. "//Userland/Libraries/LibUnicode",
  347. "//Userland/Libraries/LibWasm",
  348. "//Userland/Libraries/LibXML",
  349. ] + idl_sources_targets
  350. }