BUILD.gn 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # Copyright (C) 2018 Google, Inc.
  2. #
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. #
  9. # Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # Redistributions in binary form must reproduce the above
  13. # copyright notice, this list of conditions and the following
  14. # disclaimer in the documentation and/or other materials provided
  15. # with the distribution.
  16. #
  17. # Neither the name of Google Inc. nor the names of its
  18. # contributors may be used to endorse or promote products derived
  19. # from this software without specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. # POSSIBILITY OF SUCH DAMAGE.
  33. import("//build_overrides/glslang.gni")
  34. spirv_tools_dir = glslang_spirv_tools_dir
  35. config("glslang_public") {
  36. include_dirs = [ "." ]
  37. defines = [ "ENABLE_HLSL=1" ]
  38. }
  39. source_set("glslang_sources") {
  40. public_configs = [ ":glslang_public" ]
  41. sources = [
  42. "OGLCompilersDLL/InitializeDll.cpp",
  43. "OGLCompilersDLL/InitializeDll.h",
  44. "SPIRV/GLSL.ext.EXT.h",
  45. "SPIRV/GLSL.ext.KHR.h",
  46. "SPIRV/GLSL.std.450.h",
  47. "SPIRV/GlslangToSpv.cpp",
  48. "SPIRV/GlslangToSpv.h",
  49. "SPIRV/InReadableOrder.cpp",
  50. "SPIRV/Logger.cpp",
  51. "SPIRV/Logger.h",
  52. "SPIRV/SPVRemapper.cpp",
  53. "SPIRV/SPVRemapper.h",
  54. "SPIRV/SpvBuilder.cpp",
  55. "SPIRV/SpvBuilder.h",
  56. "SPIRV/SpvPostProcess.cpp",
  57. "SPIRV/SpvTools.cpp",
  58. "SPIRV/SpvTools.h",
  59. "SPIRV/bitutils.h",
  60. "SPIRV/disassemble.cpp",
  61. "SPIRV/disassemble.h",
  62. "SPIRV/doc.cpp",
  63. "SPIRV/doc.h",
  64. "SPIRV/hex_float.h",
  65. "SPIRV/spirv.hpp",
  66. "SPIRV/spvIR.h",
  67. "glslang/GenericCodeGen/CodeGen.cpp",
  68. "glslang/GenericCodeGen/Link.cpp",
  69. "glslang/Include/BaseTypes.h",
  70. "glslang/Include/Common.h",
  71. "glslang/Include/ConstantUnion.h",
  72. "glslang/Include/InfoSink.h",
  73. "glslang/Include/InitializeGlobals.h",
  74. "glslang/Include/PoolAlloc.h",
  75. "glslang/Include/ResourceLimits.h",
  76. "glslang/Include/ShHandle.h",
  77. "glslang/Include/Types.h",
  78. "glslang/Include/arrays.h",
  79. "glslang/Include/intermediate.h",
  80. "glslang/Include/revision.h",
  81. "glslang/MachineIndependent/Constant.cpp",
  82. "glslang/MachineIndependent/InfoSink.cpp",
  83. "glslang/MachineIndependent/Initialize.cpp",
  84. "glslang/MachineIndependent/Initialize.h",
  85. "glslang/MachineIndependent/IntermTraverse.cpp",
  86. "glslang/MachineIndependent/Intermediate.cpp",
  87. "glslang/MachineIndependent/LiveTraverser.h",
  88. "glslang/MachineIndependent/ParseContextBase.cpp",
  89. "glslang/MachineIndependent/ParseHelper.cpp",
  90. "glslang/MachineIndependent/ParseHelper.h",
  91. "glslang/MachineIndependent/PoolAlloc.cpp",
  92. "glslang/MachineIndependent/RemoveTree.cpp",
  93. "glslang/MachineIndependent/RemoveTree.h",
  94. "glslang/MachineIndependent/Scan.cpp",
  95. "glslang/MachineIndependent/Scan.h",
  96. "glslang/MachineIndependent/ScanContext.h",
  97. "glslang/MachineIndependent/ShaderLang.cpp",
  98. "glslang/MachineIndependent/SymbolTable.cpp",
  99. "glslang/MachineIndependent/SymbolTable.h",
  100. "glslang/MachineIndependent/Versions.cpp",
  101. "glslang/MachineIndependent/Versions.h",
  102. "glslang/MachineIndependent/attribute.cpp",
  103. "glslang/MachineIndependent/attribute.h",
  104. "glslang/MachineIndependent/gl_types.h",
  105. "glslang/MachineIndependent/glslang_tab.cpp",
  106. "glslang/MachineIndependent/glslang_tab.cpp.h",
  107. "glslang/MachineIndependent/intermOut.cpp",
  108. "glslang/MachineIndependent/iomapper.cpp",
  109. "glslang/MachineIndependent/iomapper.h",
  110. "glslang/MachineIndependent/limits.cpp",
  111. "glslang/MachineIndependent/linkValidate.cpp",
  112. "glslang/MachineIndependent/localintermediate.h",
  113. "glslang/MachineIndependent/parseConst.cpp",
  114. "glslang/MachineIndependent/parseVersions.h",
  115. "glslang/MachineIndependent/preprocessor/Pp.cpp",
  116. "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
  117. "glslang/MachineIndependent/preprocessor/PpContext.cpp",
  118. "glslang/MachineIndependent/preprocessor/PpContext.h",
  119. "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
  120. "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
  121. "glslang/MachineIndependent/preprocessor/PpTokens.h",
  122. "glslang/MachineIndependent/propagateNoContraction.cpp",
  123. "glslang/MachineIndependent/propagateNoContraction.h",
  124. "glslang/MachineIndependent/reflection.cpp",
  125. "glslang/MachineIndependent/reflection.h",
  126. "glslang/OSDependent/osinclude.h",
  127. "glslang/Public/ShaderLang.h",
  128. "hlsl/hlslAttributes.cpp",
  129. "hlsl/hlslAttributes.h",
  130. "hlsl/hlslGrammar.cpp",
  131. "hlsl/hlslGrammar.h",
  132. "hlsl/hlslOpMap.cpp",
  133. "hlsl/hlslOpMap.h",
  134. "hlsl/hlslParseHelper.cpp",
  135. "hlsl/hlslParseHelper.h",
  136. "hlsl/hlslParseables.cpp",
  137. "hlsl/hlslParseables.h",
  138. "hlsl/hlslScanContext.cpp",
  139. "hlsl/hlslScanContext.h",
  140. "hlsl/hlslTokenStream.cpp",
  141. "hlsl/hlslTokenStream.h",
  142. "hlsl/hlslTokens.h",
  143. ]
  144. defines = [ "ENABLE_OPT=1" ]
  145. if (is_win) {
  146. sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
  147. defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
  148. } else {
  149. sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
  150. defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
  151. }
  152. if (is_clang) {
  153. cflags_cc = [
  154. "-Wno-extra-semi",
  155. "-Wno-ignored-qualifiers",
  156. "-Wno-implicit-fallthrough",
  157. "-Wno-inconsistent-missing-override",
  158. "-Wno-sign-compare",
  159. "-Wno-unused-variable",
  160. "-Wno-missing-field-initializers",
  161. ]
  162. }
  163. if (is_win && !is_clang) {
  164. cflags = [
  165. "/wd4018", # signed/unsigned mismatch
  166. "/wd4189", # local variable is initialized but not referenced
  167. ]
  168. }
  169. deps = [
  170. "${spirv_tools_dir}:spvtools_opt",
  171. "${spirv_tools_dir}:spvtools_val",
  172. ]
  173. }
  174. source_set("glslang_default_resource_limits_sources") {
  175. sources = [
  176. "StandAlone/ResourceLimits.cpp",
  177. "StandAlone/ResourceLimits.h",
  178. ]
  179. deps = [
  180. ":glslang_sources",
  181. ]
  182. public_configs = [ ":glslang_public" ]
  183. }
  184. executable("glslang_validator") {
  185. sources = [
  186. "StandAlone/DirStackFileIncluder.h",
  187. "StandAlone/StandAlone.cpp",
  188. ]
  189. if (!is_win) {
  190. cflags = [ "-Woverflow" ]
  191. }
  192. defines = [ "ENABLE_OPT=1" ]
  193. deps = [
  194. ":glslang_default_resource_limits_sources",
  195. ":glslang_sources",
  196. ]
  197. }
  198. executable("spirv-remap") {
  199. sources = [
  200. "StandAlone/spirv-remap.cpp",
  201. ]
  202. defines = [ "ENABLE_OPT=1" ]
  203. deps = [
  204. ":glslang_sources",
  205. ]
  206. }