shaderc.lua 5.4 KB

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