shaderc.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. --
  2. -- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. --
  5. project "glslang"
  6. kind "StaticLib"
  7. local GLSLANG = path.join(BGFX_DIR, "3rdparty/glslang")
  8. configuration { "vs2012" }
  9. defines {
  10. "atoll=_atoi64",
  11. "strtoll=_strtoi64",
  12. "strtoull=_strtoui64",
  13. }
  14. configuration { "vs*" }
  15. buildoptions {
  16. "/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition
  17. "/wd4100", -- error C4100: 'inclusionDepth' : unreferenced formal parameter
  18. }
  19. configuration { "not vs*" }
  20. buildoptions {
  21. "-Wno-ignored-qualifiers",
  22. "-Wno-inconsistent-missing-override",
  23. "-Wno-missing-field-initializers",
  24. "-Wno-reorder",
  25. "-Wno-shadow",
  26. "-Wno-sign-compare",
  27. "-Wno-undef",
  28. "-Wno-unknown-pragmas",
  29. "-Wno-unused-parameter",
  30. "-Wno-unused-variable",
  31. }
  32. configuration { "osx" }
  33. buildoptions {
  34. "-Wno-c++11-extensions",
  35. "-Wno-unused-const-variable",
  36. }
  37. configuration { "linux-*" }
  38. buildoptions {
  39. "-Wno-unused-but-set-variable",
  40. }
  41. configuration {}
  42. includedirs {
  43. GLSLANG,
  44. }
  45. files {
  46. path.join(GLSLANG, "glslang/**.cpp"),
  47. path.join(GLSLANG, "glslang/**.h"),
  48. path.join(GLSLANG, "hlsl/**.cpp"),
  49. path.join(GLSLANG, "hlsl/**.h"),
  50. path.join(GLSLANG, "SPIRV/**.cpp"),
  51. path.join(GLSLANG, "SPIRV/**.h"),
  52. path.join(GLSLANG, "OGLCompilersDLL/**.cpp"),
  53. path.join(GLSLANG, "OGLCompilersDLL/**.h"),
  54. }
  55. removefiles {
  56. path.join(GLSLANG, "glslang/OSDependent/Unix/main.cpp"),
  57. path.join(GLSLANG, "glslang/OSDependent/Windows/main.cpp"),
  58. }
  59. configuration { "windows" }
  60. removefiles {
  61. path.join(GLSLANG, "glslang/OSDependent/Unix/**.cpp"),
  62. path.join(GLSLANG, "glslang/OSDependent/Unix/**.h"),
  63. }
  64. configuration { "not windows" }
  65. removefiles {
  66. path.join(GLSLANG, "glslang/OSDependent/Windows/**.cpp"),
  67. path.join(GLSLANG, "glslang/OSDependent/Windows/**.h"),
  68. }
  69. configuration {}
  70. project "shaderc"
  71. kind "ConsoleApp"
  72. local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
  73. local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
  74. includedirs {
  75. path.join(GLSL_OPTIMIZER, "src"),
  76. }
  77. links {
  78. "bx",
  79. }
  80. configuration { "Release" }
  81. flags {
  82. "Optimize",
  83. }
  84. removeflags {
  85. -- GCC 4.9 -O2 + -fno-strict-aliasing don't work together...
  86. "OptimizeSpeed",
  87. }
  88. configuration { "vs*" }
  89. includedirs {
  90. path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
  91. }
  92. defines { -- glsl-optimizer
  93. "__STDC__",
  94. "__STDC_VERSION__=199901L",
  95. "strdup=_strdup",
  96. "alloca=_alloca",
  97. "isascii=__isascii",
  98. }
  99. buildoptions {
  100. "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
  101. }
  102. configuration { "mingw-*" }
  103. targetextension ".exe"
  104. configuration { "mingw* or linux or osx" }
  105. buildoptions {
  106. "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used.
  107. "-Wno-unused-parameter",
  108. }
  109. removebuildoptions {
  110. "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it.
  111. }
  112. configuration { "osx" }
  113. links {
  114. "Cocoa.framework",
  115. }
  116. configuration { "vs*" }
  117. includedirs {
  118. path.join(GLSL_OPTIMIZER, "include/c99"),
  119. }
  120. configuration { "vs20* or mingw*" }
  121. links {
  122. "psapi",
  123. }
  124. configuration {}
  125. defines { -- fcpp
  126. "NINCLUDE=64",
  127. "NWORK=65536",
  128. "NBUFF=65536",
  129. "OLD_PREPROCESSOR=0",
  130. }
  131. includedirs {
  132. path.join(BX_DIR, "include"),
  133. path.join(BGFX_DIR, "include"),
  134. path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
  135. FCPP_DIR,
  136. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Public"),
  137. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Include"),
  138. path.join(BGFX_DIR, "3rdparty/glslang"),
  139. -- path.join(BGFX_DIR, "3rdparty/spirv-tools/include"),
  140. path.join(GLSL_OPTIMIZER, "include"),
  141. path.join(GLSL_OPTIMIZER, "src/mesa"),
  142. path.join(GLSL_OPTIMIZER, "src/mapi"),
  143. path.join(GLSL_OPTIMIZER, "src/glsl"),
  144. }
  145. files {
  146. path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
  147. path.join(BGFX_DIR, "tools/shaderc/**.h"),
  148. path.join(BGFX_DIR, "src/vertexdecl.**"),
  149. path.join(BGFX_DIR, "src/shader_spirv.**"),
  150. path.join(FCPP_DIR, "**.h"),
  151. path.join(FCPP_DIR, "cpp1.c"),
  152. path.join(FCPP_DIR, "cpp2.c"),
  153. path.join(FCPP_DIR, "cpp3.c"),
  154. path.join(FCPP_DIR, "cpp4.c"),
  155. path.join(FCPP_DIR, "cpp5.c"),
  156. path.join(FCPP_DIR, "cpp6.c"),
  157. path.join(FCPP_DIR, "cpp6.c"),
  158. path.join(GLSL_OPTIMIZER, "src/mesa/**.c"),
  159. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  160. path.join(GLSL_OPTIMIZER, "src/mesa/**.h"),
  161. path.join(GLSL_OPTIMIZER, "src/glsl/**.c"),
  162. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  163. path.join(GLSL_OPTIMIZER, "src/glsl/**.h"),
  164. path.join(GLSL_OPTIMIZER, "src/util/**.c"),
  165. path.join(GLSL_OPTIMIZER, "src/util/**.h"),
  166. }
  167. removefiles {
  168. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"),
  169. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"),
  170. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"),
  171. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"),
  172. path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"),
  173. path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"),
  174. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"),
  175. }
  176. links {
  177. "glslang",
  178. }
  179. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  180. path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then
  181. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  182. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then
  183. removefiles {
  184. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
  185. }
  186. end
  187. dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") )
  188. end
  189. configuration { "osx or linux*" }
  190. links {
  191. "pthread",
  192. }
  193. configuration {}
  194. strip()