shaderc.lua 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. --
  2. -- Copyright 2010-2016 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. configuration { "vs*" }
  87. includedirs {
  88. path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
  89. }
  90. defines { -- glsl-optimizer
  91. "__STDC__",
  92. "__STDC_VERSION__=199901L",
  93. "strdup=_strdup",
  94. "alloca=_alloca",
  95. "isascii=__isascii",
  96. }
  97. buildoptions {
  98. "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
  99. }
  100. configuration { "mingw-*" }
  101. targetextension ".exe"
  102. configuration { "mingw* or linux or osx" }
  103. buildoptions {
  104. "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used.
  105. "-Wno-unused-parameter",
  106. }
  107. removebuildoptions {
  108. "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it.
  109. }
  110. configuration { "osx" }
  111. links {
  112. "Cocoa.framework",
  113. }
  114. configuration { "vs*" }
  115. includedirs {
  116. path.join(GLSL_OPTIMIZER, "include/c99"),
  117. }
  118. configuration {}
  119. defines { -- fcpp
  120. "NINCLUDE=64",
  121. "NWORK=65536",
  122. "NBUFF=65536",
  123. "OLD_PREPROCESSOR=0",
  124. }
  125. includedirs {
  126. path.join(BX_DIR, "include"),
  127. path.join(BGFX_DIR, "include"),
  128. path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
  129. FCPP_DIR,
  130. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Public"),
  131. path.join(BGFX_DIR, "3rdparty/glslang/glslang/Include"),
  132. path.join(BGFX_DIR, "3rdparty/glslang"),
  133. -- path.join(BGFX_DIR, "3rdparty/spirv-tools/include"),
  134. path.join(GLSL_OPTIMIZER, "include"),
  135. path.join(GLSL_OPTIMIZER, "src/mesa"),
  136. path.join(GLSL_OPTIMIZER, "src/mapi"),
  137. path.join(GLSL_OPTIMIZER, "src/glsl"),
  138. }
  139. files {
  140. path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
  141. path.join(BGFX_DIR, "tools/shaderc/**.h"),
  142. path.join(BGFX_DIR, "src/vertexdecl.**"),
  143. path.join(BGFX_DIR, "src/shader_spirv.**"),
  144. path.join(FCPP_DIR, "**.h"),
  145. path.join(FCPP_DIR, "cpp1.c"),
  146. path.join(FCPP_DIR, "cpp2.c"),
  147. path.join(FCPP_DIR, "cpp3.c"),
  148. path.join(FCPP_DIR, "cpp4.c"),
  149. path.join(FCPP_DIR, "cpp5.c"),
  150. path.join(FCPP_DIR, "cpp6.c"),
  151. path.join(FCPP_DIR, "cpp6.c"),
  152. path.join(GLSL_OPTIMIZER, "src/mesa/**.c"),
  153. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  154. path.join(GLSL_OPTIMIZER, "src/mesa/**.h"),
  155. path.join(GLSL_OPTIMIZER, "src/glsl/**.c"),
  156. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  157. path.join(GLSL_OPTIMIZER, "src/glsl/**.h"),
  158. path.join(GLSL_OPTIMIZER, "src/util/**.c"),
  159. path.join(GLSL_OPTIMIZER, "src/util/**.h"),
  160. }
  161. removefiles {
  162. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"),
  163. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"),
  164. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"),
  165. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"),
  166. path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"),
  167. path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"),
  168. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"),
  169. }
  170. links {
  171. "glslang",
  172. }
  173. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  174. path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then
  175. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  176. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then
  177. removefiles {
  178. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
  179. }
  180. end
  181. dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") )
  182. end
  183. configuration { "osx or linux-*" }
  184. links {
  185. "pthread",
  186. }
  187. configuration {}
  188. strip()