shaderc.lua 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. --
  2. -- Copyright 2010-2026 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  4. --
  5. group "tools/shaderc"
  6. local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
  7. local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
  8. local GLSLANG = path.join(BGFX_DIR, "3rdparty/glslang")
  9. local SPIRV_CROSS = path.join(BGFX_DIR, "3rdparty/spirv-cross")
  10. local SPIRV_HEADERS = path.join(BGFX_DIR, "3rdparty/spirv-headers")
  11. local SPIRV_TOOLS = path.join(BGFX_DIR, "3rdparty/spirv-tools")
  12. local TINT = path.join(BGFX_DIR, "3rdparty/dawn")
  13. project "tint-core"
  14. kind "StaticLib"
  15. includedirs {
  16. path.join(TINT),
  17. path.join(TINT, "src/tint"),
  18. path.join(TINT, "third_party/protobuf/src"),
  19. path.join(TINT, "third_party/abseil-cpp"),
  20. path.join(SPIRV_TOOLS),
  21. path.join(SPIRV_TOOLS, "include"),
  22. path.join(SPIRV_TOOLS, "include/generated"),
  23. path.join(SPIRV_HEADERS, "include"),
  24. }
  25. defines {
  26. "TINT_BUILD_GLSL_WRITER=0",
  27. "TINT_BUILD_HLSL_WRITER=0",
  28. "TINT_BUILD_MSL_WRITER=0",
  29. "TINT_BUILD_NULL_WRITER=0",
  30. "TINT_BUILD_SPV_READER=1",
  31. "TINT_BUILD_SPV_WRITER=0",
  32. "TINT_BUILD_WGSL_READER=0",
  33. "TINT_BUILD_WGSL_WRITER=1",
  34. "TINT_BUILD_IS_LINUX=1",
  35. "TINT_BUILD_IS_MAC=0",
  36. "TINT_BUILD_IS_WIN=0",
  37. "TINT_ENABLE_IR_VALIDATION=0",
  38. }
  39. files {
  40. path.join(TINT, "src/tint/utils/**.cc"),
  41. path.join(TINT, "src/tint/utils/**.h"),
  42. path.join(TINT, "src/tint/lang/core/**.cc"),
  43. path.join(TINT, "src/tint/lang/core/**.h"),
  44. path.join(TINT, "src/tint/lang/null/**.cc"),
  45. path.join(TINT, "src/tint/lang/null/**.h"),
  46. }
  47. project "tint-lang"
  48. kind "StaticLib"
  49. includedirs {
  50. path.join(TINT),
  51. path.join(TINT, "src/tint"),
  52. path.join(TINT, "third_party/protobuf/src"),
  53. path.join(TINT, "third_party/abseil-cpp"),
  54. path.join(SPIRV_TOOLS),
  55. path.join(SPIRV_TOOLS, "include"),
  56. path.join(SPIRV_TOOLS, "include/generated"),
  57. path.join(SPIRV_HEADERS, "include"),
  58. }
  59. defines {
  60. "TINT_BUILD_GLSL_WRITER=0",
  61. "TINT_BUILD_HLSL_WRITER=0",
  62. "TINT_BUILD_MSL_WRITER=0",
  63. "TINT_BUILD_NULL_WRITER=0",
  64. "TINT_BUILD_SPV_READER=1",
  65. "TINT_BUILD_SPV_WRITER=0",
  66. "TINT_BUILD_WGSL_READER=0",
  67. "TINT_BUILD_WGSL_WRITER=1",
  68. "TINT_BUILD_IS_LINUX=1",
  69. "TINT_BUILD_IS_MAC=0",
  70. "TINT_BUILD_IS_WIN=0",
  71. "TINT_ENABLE_IR_VALIDATION=0",
  72. }
  73. files {
  74. path.join(TINT, "src/tint/lang/spirv/**.cc"),
  75. path.join(TINT, "src/tint/lang/spirv/**.h"),
  76. path.join(TINT, "src/tint/lang/wgsl/**.cc"),
  77. path.join(TINT, "src/tint/lang/wgsl/**.h"),
  78. }
  79. project "tint-api"
  80. kind "StaticLib"
  81. includedirs {
  82. path.join(TINT),
  83. path.join(TINT, "src/tint"),
  84. path.join(TINT, "third_party/protobuf/src"),
  85. path.join(TINT, "third_party/abseil-cpp"),
  86. path.join(SPIRV_TOOLS),
  87. path.join(SPIRV_TOOLS, "include"),
  88. path.join(SPIRV_TOOLS, "include/generated"),
  89. path.join(SPIRV_HEADERS, "include"),
  90. }
  91. defines {
  92. "TINT_BUILD_GLSL_WRITER=0",
  93. "TINT_BUILD_HLSL_WRITER=0",
  94. "TINT_BUILD_MSL_WRITER=0",
  95. "TINT_BUILD_NULL_WRITER=0",
  96. "TINT_BUILD_SPV_READER=1",
  97. "TINT_BUILD_SPV_WRITER=0",
  98. "TINT_BUILD_WGSL_READER=0",
  99. "TINT_BUILD_WGSL_WRITER=1",
  100. "TINT_BUILD_IS_LINUX=1",
  101. "TINT_BUILD_IS_MAC=0",
  102. "TINT_BUILD_IS_WIN=0",
  103. "TINT_ENABLE_IR_VALIDATION=0",
  104. }
  105. files {
  106. path.join(TINT, "src/tint/api/**.cc"),
  107. path.join(TINT, "src/tint/api/**.h"),
  108. }
  109. project "spirv-opt"
  110. kind "StaticLib"
  111. includedirs {
  112. SPIRV_TOOLS,
  113. path.join(SPIRV_TOOLS, "include"),
  114. path.join(SPIRV_TOOLS, "include/generated"),
  115. path.join(SPIRV_TOOLS, "source"),
  116. path.join(SPIRV_HEADERS, "include"),
  117. }
  118. files {
  119. path.join(SPIRV_TOOLS, "source/opt/**.cpp"),
  120. path.join(SPIRV_TOOLS, "source/opt/**.h"),
  121. path.join(SPIRV_TOOLS, "source/reduce/**.cpp"),
  122. path.join(SPIRV_TOOLS, "source/reduce/**.h"),
  123. path.join(SPIRV_TOOLS, "source/val/**.cpp"),
  124. path.join(SPIRV_TOOLS, "source/val/**.h"),
  125. -- libspirv
  126. path.join(SPIRV_TOOLS, "source/assembly_grammar.cpp"),
  127. path.join(SPIRV_TOOLS, "source/assembly_grammar.h"),
  128. path.join(SPIRV_TOOLS, "source/binary.cpp"),
  129. path.join(SPIRV_TOOLS, "source/binary.h"),
  130. path.join(SPIRV_TOOLS, "source/cfa.h"),
  131. path.join(SPIRV_TOOLS, "source/diagnostic.cpp"),
  132. path.join(SPIRV_TOOLS, "source/diagnostic.h"),
  133. path.join(SPIRV_TOOLS, "source/disassemble.cpp"),
  134. path.join(SPIRV_TOOLS, "source/disassemble.h"),
  135. path.join(SPIRV_TOOLS, "source/enum_set.h"),
  136. path.join(SPIRV_TOOLS, "source/ext_inst.cpp"),
  137. path.join(SPIRV_TOOLS, "source/ext_inst.h"),
  138. path.join(SPIRV_TOOLS, "source/extensions.cpp"),
  139. path.join(SPIRV_TOOLS, "source/extensions.h"),
  140. path.join(SPIRV_TOOLS, "source/instruction.h"),
  141. path.join(SPIRV_TOOLS, "source/latest_version_glsl_std_450_header.h"),
  142. path.join(SPIRV_TOOLS, "source/latest_version_opencl_std_header.h"),
  143. path.join(SPIRV_TOOLS, "source/latest_version_spirv_header.h"),
  144. path.join(SPIRV_TOOLS, "source/libspirv.cpp"),
  145. path.join(SPIRV_TOOLS, "source/macro.h"),
  146. path.join(SPIRV_TOOLS, "source/name_mapper.cpp"),
  147. path.join(SPIRV_TOOLS, "source/name_mapper.h"),
  148. path.join(SPIRV_TOOLS, "source/opcode.cpp"),
  149. path.join(SPIRV_TOOLS, "source/opcode.h"),
  150. path.join(SPIRV_TOOLS, "source/operand.cpp"),
  151. path.join(SPIRV_TOOLS, "source/operand.h"),
  152. path.join(SPIRV_TOOLS, "source/parsed_operand.cpp"),
  153. path.join(SPIRV_TOOLS, "source/parsed_operand.h"),
  154. path.join(SPIRV_TOOLS, "source/print.cpp"),
  155. path.join(SPIRV_TOOLS, "source/print.h"),
  156. path.join(SPIRV_TOOLS, "source/software_version.cpp"),
  157. path.join(SPIRV_TOOLS, "source/spirv_constant.h"),
  158. path.join(SPIRV_TOOLS, "source/spirv_definition.h"),
  159. path.join(SPIRV_TOOLS, "source/spirv_endian.cpp"),
  160. path.join(SPIRV_TOOLS, "source/spirv_endian.h"),
  161. path.join(SPIRV_TOOLS, "source/spirv_optimizer_options.cpp"),
  162. path.join(SPIRV_TOOLS, "source/spirv_reducer_options.cpp"),
  163. path.join(SPIRV_TOOLS, "source/spirv_target_env.cpp"),
  164. path.join(SPIRV_TOOLS, "source/spirv_target_env.h"),
  165. path.join(SPIRV_TOOLS, "source/spirv_validator_options.cpp"),
  166. path.join(SPIRV_TOOLS, "source/spirv_validator_options.h"),
  167. path.join(SPIRV_TOOLS, "source/table.cpp"),
  168. path.join(SPIRV_TOOLS, "source/table.h"),
  169. path.join(SPIRV_TOOLS, "source/table2.cpp"),
  170. path.join(SPIRV_TOOLS, "source/table2.h"),
  171. path.join(SPIRV_TOOLS, "source/text.cpp"),
  172. path.join(SPIRV_TOOLS, "source/text.h"),
  173. path.join(SPIRV_TOOLS, "source/text_handler.cpp"),
  174. path.join(SPIRV_TOOLS, "source/text_handler.h"),
  175. path.join(SPIRV_TOOLS, "source/to_string.cpp"),
  176. path.join(SPIRV_TOOLS, "source/to_string.h"),
  177. path.join(SPIRV_TOOLS, "source/util/bit_vector.cpp"),
  178. path.join(SPIRV_TOOLS, "source/util/bit_vector.h"),
  179. path.join(SPIRV_TOOLS, "source/util/bitutils.h"),
  180. path.join(SPIRV_TOOLS, "source/util/hex_float.h"),
  181. path.join(SPIRV_TOOLS, "source/util/parse_number.cpp"),
  182. path.join(SPIRV_TOOLS, "source/util/parse_number.h"),
  183. path.join(SPIRV_TOOLS, "source/util/string_utils.cpp"),
  184. path.join(SPIRV_TOOLS, "source/util/string_utils.h"),
  185. path.join(SPIRV_TOOLS, "source/util/timer.h"),
  186. }
  187. configuration { "vs*" }
  188. buildoptions {
  189. "/wd4127", -- warning C4127: conditional expression is constant
  190. "/wd4267", -- warning C4267: 'argument': conversion from '' to '', possible loss of data
  191. "/wd4389", -- warning C4389: '==': signed/unsigned mismatch
  192. "/wd4702", -- warning C4702: unreachable code
  193. "/wd4706", -- warning C4706: assignment within conditional expression
  194. }
  195. configuration { "mingw* or linux* or osx*" }
  196. buildoptions {
  197. "-Wno-switch",
  198. }
  199. configuration { "mingw* or linux-gcc-*" }
  200. buildoptions {
  201. "-Wno-misleading-indentation",
  202. }
  203. configuration {}
  204. project "spirv-cross"
  205. kind "StaticLib"
  206. defines {
  207. "SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS",
  208. }
  209. includedirs {
  210. path.join(SPIRV_CROSS, "include"),
  211. }
  212. files {
  213. path.join(SPIRV_CROSS, "spirv.hpp"),
  214. path.join(SPIRV_CROSS, "spirv_cfg.cpp"),
  215. path.join(SPIRV_CROSS, "spirv_cfg.hpp"),
  216. path.join(SPIRV_CROSS, "spirv_common.hpp"),
  217. path.join(SPIRV_CROSS, "spirv_cpp.cpp"),
  218. path.join(SPIRV_CROSS, "spirv_cpp.hpp"),
  219. path.join(SPIRV_CROSS, "spirv_cross.cpp"),
  220. path.join(SPIRV_CROSS, "spirv_cross.hpp"),
  221. path.join(SPIRV_CROSS, "spirv_cross_parsed_ir.cpp"),
  222. path.join(SPIRV_CROSS, "spirv_cross_parsed_ir.hpp"),
  223. path.join(SPIRV_CROSS, "spirv_cross_util.cpp"),
  224. path.join(SPIRV_CROSS, "spirv_cross_util.hpp"),
  225. path.join(SPIRV_CROSS, "spirv_glsl.cpp"),
  226. path.join(SPIRV_CROSS, "spirv_glsl.hpp"),
  227. path.join(SPIRV_CROSS, "spirv_hlsl.cpp"),
  228. path.join(SPIRV_CROSS, "spirv_hlsl.hpp"),
  229. path.join(SPIRV_CROSS, "spirv_msl.cpp"),
  230. path.join(SPIRV_CROSS, "spirv_msl.hpp"),
  231. path.join(SPIRV_CROSS, "spirv_parser.cpp"),
  232. path.join(SPIRV_CROSS, "spirv_parser.hpp"),
  233. path.join(SPIRV_CROSS, "spirv_reflect.cpp"),
  234. path.join(SPIRV_CROSS, "spirv_reflect.hpp"),
  235. }
  236. configuration { "vs*" }
  237. buildoptions {
  238. "/wd4018", -- warning C4018: '<': signed/unsigned mismatch
  239. "/wd4245", -- warning C4245: 'return': conversion from 'int' to 'unsigned int', signed/unsigned mismatch
  240. "/wd4706", -- warning C4706: assignment within conditional expression
  241. "/wd4715", -- warning C4715: '': not all control paths return a value
  242. }
  243. configuration { "mingw* or linux* or osx*" }
  244. buildoptions {
  245. "-Wno-type-limits",
  246. }
  247. configuration {}
  248. project "glslang"
  249. kind "StaticLib"
  250. defines {
  251. "ENABLE_OPT=1", -- spirv-tools
  252. "ENABLE_HLSL=1",
  253. }
  254. includedirs {
  255. GLSLANG,
  256. path.join(GLSLANG, ".."),
  257. path.join(SPIRV_TOOLS, "include"),
  258. path.join(SPIRV_TOOLS, "source"),
  259. }
  260. files {
  261. path.join(GLSLANG, "glslang/**.cpp"),
  262. path.join(GLSLANG, "glslang/**.h"),
  263. path.join(GLSLANG, "hlsl/**.cpp"),
  264. path.join(GLSLANG, "hlsl/**.h"),
  265. path.join(GLSLANG, "SPIRV/**.cpp"),
  266. path.join(GLSLANG, "SPIRV/**.h"),
  267. path.join(GLSLANG, "OGLCompilersDLL/**.cpp"),
  268. path.join(GLSLANG, "OGLCompilersDLL/**.h"),
  269. }
  270. configuration { "windows" }
  271. removefiles {
  272. path.join(GLSLANG, "glslang/OSDependent/Unix/**.cpp"),
  273. path.join(GLSLANG, "glslang/OSDependent/Unix/**.h"),
  274. }
  275. configuration { "not windows" }
  276. removefiles {
  277. path.join(GLSLANG, "glslang/OSDependent/Windows/**.cpp"),
  278. path.join(GLSLANG, "glslang/OSDependent/Windows/**.h"),
  279. }
  280. configuration { "vs*" }
  281. buildoptions {
  282. "/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition
  283. "/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels
  284. "/wd4100", -- warning C4100: 'inclusionDepth' : unreferenced formal parameter
  285. "/wd4127", -- warning C4127: conditional expression is constant
  286. "/wd4189", -- warning C4189: 'isFloat': local variable is initialized but not referenced
  287. "/wd4244", -- warning C4244: '=': conversion from 'int' to 'char', possible loss of data
  288. "/wd4310", -- warning C4310: cast truncates constant value
  289. "/wd4389", -- warning C4389: '==': signed/unsigned mismatch
  290. "/wd4456", -- warning C4456: declaration of 'feature' hides previous local declaration
  291. "/wd4457", -- warning C4457: declaration of 'token' hides function parameter
  292. "/wd4458", -- warning C4458: declaration of 'language' hides class member
  293. "/wd4702", -- warning C4702: unreachable code
  294. "/wd4715", -- warning C4715: 'spv::Builder::makeFpConstant': not all control paths return a value
  295. "/wd4838", -- warning C4838: conversion from 'spv::GroupOperation' to 'unsigned int' requires a narrowing conversion
  296. }
  297. configuration { "mingw-gcc or linux-gcc" }
  298. buildoptions {
  299. "-Wno-logical-op",
  300. "-Wno-maybe-uninitialized",
  301. }
  302. configuration { "mingw* or linux* or osx*" }
  303. buildoptions {
  304. "-fno-strict-aliasing", -- glslang has bugs if strict aliasing is used.
  305. "-Wno-ignored-qualifiers",
  306. "-Wno-implicit-fallthrough",
  307. "-Wno-missing-field-initializers",
  308. "-Wno-reorder",
  309. "-Wno-return-type",
  310. "-Wno-shadow",
  311. "-Wno-sign-compare",
  312. "-Wno-switch",
  313. "-Wno-undef",
  314. "-Wno-unknown-pragmas",
  315. "-Wno-unused-function",
  316. "-Wno-unused-parameter",
  317. "-Wno-unused-variable",
  318. }
  319. configuration { "osx*" }
  320. buildoptions {
  321. "-Wno-c++11-extensions",
  322. "-Wno-unused-const-variable",
  323. "-Wno-deprecated-register",
  324. }
  325. configuration { "linux-gcc-*" }
  326. buildoptions {
  327. "-Wno-unused-but-set-variable",
  328. }
  329. configuration {}
  330. project "glsl-optimizer"
  331. kind "StaticLib"
  332. includedirs {
  333. path.join(GLSL_OPTIMIZER, "src"),
  334. path.join(GLSL_OPTIMIZER, "include"),
  335. path.join(GLSL_OPTIMIZER, "src/mesa"),
  336. path.join(GLSL_OPTIMIZER, "src/mapi"),
  337. path.join(GLSL_OPTIMIZER, "src/glsl"),
  338. }
  339. files {
  340. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.h"),
  341. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp-lex.c"),
  342. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp-parse.c"),
  343. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp-parse.h"),
  344. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/pp.c"),
  345. path.join(GLSL_OPTIMIZER, "src/glsl/ast.h"),
  346. path.join(GLSL_OPTIMIZER, "src/glsl/ast_array_index.cpp"),
  347. path.join(GLSL_OPTIMIZER, "src/glsl/ast_expr.cpp"),
  348. path.join(GLSL_OPTIMIZER, "src/glsl/ast_function.cpp"),
  349. path.join(GLSL_OPTIMIZER, "src/glsl/ast_to_hir.cpp"),
  350. path.join(GLSL_OPTIMIZER, "src/glsl/ast_type.cpp"),
  351. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_functions.cpp"),
  352. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_type_macros.h"),
  353. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_types.cpp"),
  354. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_variables.cpp"),
  355. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_lexer.cpp"),
  356. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_optimizer.cpp"),
  357. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_optimizer.h"),
  358. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_parser.cpp"),
  359. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_parser.h"),
  360. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_parser_extras.cpp"),
  361. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_parser_extras.h"),
  362. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_symbol_table.cpp"),
  363. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_symbol_table.h"),
  364. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_types.cpp"),
  365. path.join(GLSL_OPTIMIZER, "src/glsl/glsl_types.h"),
  366. path.join(GLSL_OPTIMIZER, "src/glsl/hir_field_selection.cpp"),
  367. path.join(GLSL_OPTIMIZER, "src/glsl/ir.cpp"),
  368. path.join(GLSL_OPTIMIZER, "src/glsl/ir.h"),
  369. path.join(GLSL_OPTIMIZER, "src/glsl/ir_basic_block.cpp"),
  370. path.join(GLSL_OPTIMIZER, "src/glsl/ir_basic_block.h"),
  371. path.join(GLSL_OPTIMIZER, "src/glsl/ir_builder.cpp"),
  372. path.join(GLSL_OPTIMIZER, "src/glsl/ir_builder.h"),
  373. path.join(GLSL_OPTIMIZER, "src/glsl/ir_clone.cpp"),
  374. path.join(GLSL_OPTIMIZER, "src/glsl/ir_constant_expression.cpp"),
  375. path.join(GLSL_OPTIMIZER, "src/glsl/ir_equals.cpp"),
  376. path.join(GLSL_OPTIMIZER, "src/glsl/ir_expression_flattening.cpp"),
  377. path.join(GLSL_OPTIMIZER, "src/glsl/ir_expression_flattening.h"),
  378. path.join(GLSL_OPTIMIZER, "src/glsl/ir_function.cpp"),
  379. path.join(GLSL_OPTIMIZER, "src/glsl/ir_function_can_inline.cpp"),
  380. path.join(GLSL_OPTIMIZER, "src/glsl/ir_function_detect_recursion.cpp"),
  381. path.join(GLSL_OPTIMIZER, "src/glsl/ir_function_inlining.h"),
  382. path.join(GLSL_OPTIMIZER, "src/glsl/ir_hierarchical_visitor.cpp"),
  383. path.join(GLSL_OPTIMIZER, "src/glsl/ir_hierarchical_visitor.h"),
  384. path.join(GLSL_OPTIMIZER, "src/glsl/ir_hv_accept.cpp"),
  385. path.join(GLSL_OPTIMIZER, "src/glsl/ir_import_prototypes.cpp"),
  386. path.join(GLSL_OPTIMIZER, "src/glsl/ir_optimization.h"),
  387. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_glsl_visitor.cpp"),
  388. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_glsl_visitor.h"),
  389. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_metal_visitor.cpp"),
  390. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_metal_visitor.h"),
  391. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_visitor.cpp"),
  392. path.join(GLSL_OPTIMIZER, "src/glsl/ir_print_visitor.h"),
  393. path.join(GLSL_OPTIMIZER, "src/glsl/ir_rvalue_visitor.cpp"),
  394. path.join(GLSL_OPTIMIZER, "src/glsl/ir_rvalue_visitor.h"),
  395. path.join(GLSL_OPTIMIZER, "src/glsl/ir_stats.cpp"),
  396. path.join(GLSL_OPTIMIZER, "src/glsl/ir_stats.h"),
  397. path.join(GLSL_OPTIMIZER, "src/glsl/ir_uniform.h"),
  398. path.join(GLSL_OPTIMIZER, "src/glsl/ir_unused_structs.cpp"),
  399. path.join(GLSL_OPTIMIZER, "src/glsl/ir_unused_structs.h"),
  400. path.join(GLSL_OPTIMIZER, "src/glsl/ir_validate.cpp"),
  401. path.join(GLSL_OPTIMIZER, "src/glsl/ir_variable_refcount.cpp"),
  402. path.join(GLSL_OPTIMIZER, "src/glsl/ir_variable_refcount.h"),
  403. path.join(GLSL_OPTIMIZER, "src/glsl/ir_visitor.h"),
  404. path.join(GLSL_OPTIMIZER, "src/glsl/link_atomics.cpp"),
  405. path.join(GLSL_OPTIMIZER, "src/glsl/link_functions.cpp"),
  406. path.join(GLSL_OPTIMIZER, "src/glsl/link_interface_blocks.cpp"),
  407. path.join(GLSL_OPTIMIZER, "src/glsl/link_uniform_block_active_visitor.cpp"),
  408. path.join(GLSL_OPTIMIZER, "src/glsl/link_uniform_block_active_visitor.h"),
  409. path.join(GLSL_OPTIMIZER, "src/glsl/link_uniform_blocks.cpp"),
  410. path.join(GLSL_OPTIMIZER, "src/glsl/link_uniform_initializers.cpp"),
  411. path.join(GLSL_OPTIMIZER, "src/glsl/link_uniforms.cpp"),
  412. path.join(GLSL_OPTIMIZER, "src/glsl/link_varyings.cpp"),
  413. path.join(GLSL_OPTIMIZER, "src/glsl/link_varyings.h"),
  414. path.join(GLSL_OPTIMIZER, "src/glsl/linker.cpp"),
  415. path.join(GLSL_OPTIMIZER, "src/glsl/linker.h"),
  416. path.join(GLSL_OPTIMIZER, "src/glsl/list.h"),
  417. path.join(GLSL_OPTIMIZER, "src/glsl/loop_analysis.cpp"),
  418. path.join(GLSL_OPTIMIZER, "src/glsl/loop_analysis.h"),
  419. path.join(GLSL_OPTIMIZER, "src/glsl/loop_controls.cpp"),
  420. path.join(GLSL_OPTIMIZER, "src/glsl/loop_unroll.cpp"),
  421. path.join(GLSL_OPTIMIZER, "src/glsl/lower_clip_distance.cpp"),
  422. path.join(GLSL_OPTIMIZER, "src/glsl/lower_discard.cpp"),
  423. path.join(GLSL_OPTIMIZER, "src/glsl/lower_discard_flow.cpp"),
  424. path.join(GLSL_OPTIMIZER, "src/glsl/lower_if_to_cond_assign.cpp"),
  425. path.join(GLSL_OPTIMIZER, "src/glsl/lower_instructions.cpp"),
  426. path.join(GLSL_OPTIMIZER, "src/glsl/lower_jumps.cpp"),
  427. path.join(GLSL_OPTIMIZER, "src/glsl/lower_mat_op_to_vec.cpp"),
  428. path.join(GLSL_OPTIMIZER, "src/glsl/lower_named_interface_blocks.cpp"),
  429. path.join(GLSL_OPTIMIZER, "src/glsl/lower_noise.cpp"),
  430. path.join(GLSL_OPTIMIZER, "src/glsl/lower_offset_array.cpp"),
  431. path.join(GLSL_OPTIMIZER, "src/glsl/lower_output_reads.cpp"),
  432. path.join(GLSL_OPTIMIZER, "src/glsl/lower_packed_varyings.cpp"),
  433. path.join(GLSL_OPTIMIZER, "src/glsl/lower_packing_builtins.cpp"),
  434. path.join(GLSL_OPTIMIZER, "src/glsl/lower_ubo_reference.cpp"),
  435. path.join(GLSL_OPTIMIZER, "src/glsl/lower_variable_index_to_cond_assign.cpp"),
  436. path.join(GLSL_OPTIMIZER, "src/glsl/lower_vec_index_to_cond_assign.cpp"),
  437. path.join(GLSL_OPTIMIZER, "src/glsl/lower_vec_index_to_swizzle.cpp"),
  438. path.join(GLSL_OPTIMIZER, "src/glsl/lower_vector.cpp"),
  439. path.join(GLSL_OPTIMIZER, "src/glsl/lower_vector_insert.cpp"),
  440. path.join(GLSL_OPTIMIZER, "src/glsl/lower_vertex_id.cpp"),
  441. path.join(GLSL_OPTIMIZER, "src/glsl/opt_algebraic.cpp"),
  442. path.join(GLSL_OPTIMIZER, "src/glsl/opt_array_splitting.cpp"),
  443. path.join(GLSL_OPTIMIZER, "src/glsl/opt_constant_folding.cpp"),
  444. path.join(GLSL_OPTIMIZER, "src/glsl/opt_constant_propagation.cpp"),
  445. path.join(GLSL_OPTIMIZER, "src/glsl/opt_constant_variable.cpp"),
  446. path.join(GLSL_OPTIMIZER, "src/glsl/opt_copy_propagation.cpp"),
  447. path.join(GLSL_OPTIMIZER, "src/glsl/opt_copy_propagation_elements.cpp"),
  448. path.join(GLSL_OPTIMIZER, "src/glsl/opt_cse.cpp"),
  449. path.join(GLSL_OPTIMIZER, "src/glsl/opt_dead_builtin_variables.cpp"),
  450. path.join(GLSL_OPTIMIZER, "src/glsl/opt_dead_builtin_varyings.cpp"),
  451. path.join(GLSL_OPTIMIZER, "src/glsl/opt_dead_code.cpp"),
  452. path.join(GLSL_OPTIMIZER, "src/glsl/opt_dead_code_local.cpp"),
  453. path.join(GLSL_OPTIMIZER, "src/glsl/opt_dead_functions.cpp"),
  454. path.join(GLSL_OPTIMIZER, "src/glsl/opt_flatten_nested_if_blocks.cpp"),
  455. path.join(GLSL_OPTIMIZER, "src/glsl/opt_flip_matrices.cpp"),
  456. path.join(GLSL_OPTIMIZER, "src/glsl/opt_function_inlining.cpp"),
  457. path.join(GLSL_OPTIMIZER, "src/glsl/opt_if_simplification.cpp"),
  458. path.join(GLSL_OPTIMIZER, "src/glsl/opt_minmax.cpp"),
  459. path.join(GLSL_OPTIMIZER, "src/glsl/opt_noop_swizzle.cpp"),
  460. path.join(GLSL_OPTIMIZER, "src/glsl/opt_rebalance_tree.cpp"),
  461. path.join(GLSL_OPTIMIZER, "src/glsl/opt_redundant_jumps.cpp"),
  462. path.join(GLSL_OPTIMIZER, "src/glsl/opt_structure_splitting.cpp"),
  463. path.join(GLSL_OPTIMIZER, "src/glsl/opt_swizzle_swizzle.cpp"),
  464. path.join(GLSL_OPTIMIZER, "src/glsl/opt_tree_grafting.cpp"),
  465. path.join(GLSL_OPTIMIZER, "src/glsl/opt_vectorize.cpp"),
  466. path.join(GLSL_OPTIMIZER, "src/glsl/program.h"),
  467. path.join(GLSL_OPTIMIZER, "src/glsl/s_expression.cpp"),
  468. path.join(GLSL_OPTIMIZER, "src/glsl/s_expression.h"),
  469. path.join(GLSL_OPTIMIZER, "src/glsl/standalone_scaffolding.cpp"),
  470. path.join(GLSL_OPTIMIZER, "src/glsl/standalone_scaffolding.h"),
  471. path.join(GLSL_OPTIMIZER, "src/glsl/strtod.c"),
  472. path.join(GLSL_OPTIMIZER, "src/glsl/strtod.h"),
  473. path.join(GLSL_OPTIMIZER, "src/mesa/main/compiler.h"),
  474. path.join(GLSL_OPTIMIZER, "src/mesa/main/config.h"),
  475. path.join(GLSL_OPTIMIZER, "src/mesa/main/context.h"),
  476. path.join(GLSL_OPTIMIZER, "src/mesa/main/core.h"),
  477. path.join(GLSL_OPTIMIZER, "src/mesa/main/dd.h"),
  478. path.join(GLSL_OPTIMIZER, "src/mesa/main/errors.h"),
  479. path.join(GLSL_OPTIMIZER, "src/mesa/main/glheader.h"),
  480. path.join(GLSL_OPTIMIZER, "src/mesa/main/glminimal.h"),
  481. path.join(GLSL_OPTIMIZER, "src/mesa/main/imports.c"),
  482. path.join(GLSL_OPTIMIZER, "src/mesa/main/imports.h"),
  483. path.join(GLSL_OPTIMIZER, "src/mesa/main/macros.h"),
  484. path.join(GLSL_OPTIMIZER, "src/mesa/main/mtypes.h"),
  485. path.join(GLSL_OPTIMIZER, "src/mesa/main/simple_list.h"),
  486. path.join(GLSL_OPTIMIZER, "src/mesa/program/hash_table.h"),
  487. path.join(GLSL_OPTIMIZER, "src/mesa/program/prog_hash_table.c"),
  488. path.join(GLSL_OPTIMIZER, "src/mesa/program/prog_instruction.h"),
  489. path.join(GLSL_OPTIMIZER, "src/mesa/program/prog_parameter.h"),
  490. path.join(GLSL_OPTIMIZER, "src/mesa/program/prog_statevars.h"),
  491. path.join(GLSL_OPTIMIZER, "src/mesa/program/symbol_table.c"),
  492. path.join(GLSL_OPTIMIZER, "src/mesa/program/symbol_table.h"),
  493. path.join(GLSL_OPTIMIZER, "src/util/hash_table.c"),
  494. path.join(GLSL_OPTIMIZER, "src/util/hash_table.h"),
  495. path.join(GLSL_OPTIMIZER, "src/util/macros.h"),
  496. path.join(GLSL_OPTIMIZER, "src/util/ralloc.c"),
  497. path.join(GLSL_OPTIMIZER, "src/util/ralloc.h"),
  498. }
  499. removefiles {
  500. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"),
  501. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"),
  502. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"),
  503. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"),
  504. path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"),
  505. path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"),
  506. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"),
  507. }
  508. removeflags {
  509. "FloatFast", -- clang 17 has issues errors originating in glsl-optimizer when float optimizations are enabled
  510. }
  511. configuration { "Release" }
  512. flags {
  513. "Optimize",
  514. }
  515. removeflags {
  516. -- GCC 4.9 -O2 + -fno-strict-aliasing don't work together...
  517. "OptimizeSpeed",
  518. }
  519. configuration { "vs*" }
  520. includedirs {
  521. path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
  522. }
  523. defines { -- glsl-optimizer
  524. "__STDC__",
  525. "__STDC_VERSION__=199901L",
  526. "strdup=_strdup",
  527. "alloca=_alloca",
  528. "isascii=__isascii",
  529. }
  530. buildoptions {
  531. "/wd4100", -- error C4100: '' : unreferenced formal parameter
  532. "/wd4127", -- warning C4127: conditional expression is constant
  533. "/wd4132", -- warning C4132: 'deleted_key_value': const object should be initialized
  534. "/wd4189", -- warning C4189: 'interface_type': local variable is initialized but not referenced
  535. "/wd4204", -- warning C4204: nonstandard extension used: non-constant aggregate initializer
  536. "/wd4244", -- warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data
  537. "/wd4389", -- warning C4389: '!=': signed/unsigned mismatch
  538. "/wd4245", -- warning C4245: 'return': conversion from 'int' to 'unsigned int', signed/unsigned mismatch
  539. "/wd4701", -- warning C4701: potentially uninitialized local variable 'lower' used
  540. "/wd4702", -- warning C4702: unreachable code
  541. "/wd4706", -- warning C4706: assignment within conditional expression
  542. "/wd4996", -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
  543. }
  544. configuration { "mingw* or linux* or osx*" }
  545. buildoptions {
  546. "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used.
  547. "-Wno-implicit-fallthrough",
  548. "-Wno-parentheses",
  549. "-Wno-sign-compare",
  550. "-Wno-unused-function",
  551. "-Wno-unused-parameter",
  552. }
  553. removebuildoptions {
  554. "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it.
  555. }
  556. configuration { "osx*" }
  557. buildoptions {
  558. "-Wno-deprecated-register",
  559. }
  560. configuration { "mingw* or linux-gcc-*" }
  561. buildoptions {
  562. "-Wno-misleading-indentation",
  563. }
  564. configuration {}
  565. project "fcpp"
  566. kind "StaticLib"
  567. defines { -- fcpp
  568. "NINCLUDE=64",
  569. "NWORK=65536",
  570. "NBUFF=65536",
  571. "OLD_PREPROCESSOR=0",
  572. -- "MSG_PREFIX=\"Preprocessor: \"",
  573. }
  574. files {
  575. path.join(FCPP_DIR, "**.h"),
  576. path.join(FCPP_DIR, "cpp1.c"),
  577. path.join(FCPP_DIR, "cpp2.c"),
  578. path.join(FCPP_DIR, "cpp3.c"),
  579. path.join(FCPP_DIR, "cpp4.c"),
  580. path.join(FCPP_DIR, "cpp5.c"),
  581. path.join(FCPP_DIR, "cpp6.c"),
  582. path.join(FCPP_DIR, "cpp6.c"),
  583. }
  584. configuration { "vs*" }
  585. buildoptions {
  586. "/wd4055", -- warning C4055: 'type cast': from data pointer 'void *' to function pointer 'void (__cdecl *)(char *,void *)'
  587. "/wd4244", -- warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data
  588. "/wd4701", -- warning C4701: potentially uninitialized local variable 'lower' used
  589. "/wd4706", -- warning C4706: assignment within conditional expression
  590. }
  591. configuration { "not vs*" }
  592. buildoptions {
  593. "-Wno-implicit-fallthrough",
  594. "-Wno-incompatible-pointer-types",
  595. "-Wno-parentheses-equality",
  596. }
  597. configuration {}
  598. project "shaderc"
  599. kind "ConsoleApp"
  600. includedirs {
  601. path.join(BIMG_DIR, "include"),
  602. path.join(BGFX_DIR, "include"),
  603. path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
  604. FCPP_DIR,
  605. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Public"),
  606. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Include"),
  607. path.join(BGFX_DIR, "3rdparty/glslang"),
  608. path.join(GLSL_OPTIMIZER, "include"),
  609. path.join(GLSL_OPTIMIZER, "src/glsl"),
  610. SPIRV_CROSS,
  611. path.join(SPIRV_TOOLS, "include"),
  612. path.join(TINT),
  613. path.join(TINT, "src"),
  614. }
  615. links {
  616. "fcpp",
  617. "glslang",
  618. "glsl-optimizer",
  619. "spirv-opt",
  620. "spirv-cross",
  621. "tint-api",
  622. "tint-lang",
  623. "tint-core",
  624. }
  625. using_bx()
  626. files {
  627. path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
  628. path.join(BGFX_DIR, "tools/shaderc/**.h"),
  629. path.join(BGFX_DIR, "src/vertexlayout.**"),
  630. path.join(BGFX_DIR, "src/shader**"),
  631. }
  632. configuration { "mingw-*" }
  633. targetextension ".exe"
  634. configuration { "osx*" }
  635. links {
  636. "Cocoa.framework",
  637. }
  638. configuration { "vs*" }
  639. includedirs {
  640. path.join(GLSL_OPTIMIZER, "include/c99"),
  641. }
  642. configuration { "vs20* or mingw*" }
  643. links {
  644. "psapi",
  645. }
  646. configuration { "osx* or linux*" }
  647. links {
  648. "pthread",
  649. }
  650. configuration {}
  651. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-gnm"), {
  652. path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then
  653. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-gnm"), {
  654. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then
  655. removefiles {
  656. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
  657. }
  658. end
  659. dofile(path.join(BGFX_DIR, "../bgfx-gnm/scripts/shaderc.lua") )
  660. end
  661. strip()
  662. group "tools"