BUILD.gn 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. }
  38. source_set("glslang_sources") {
  39. public_configs = [ ":glslang_public" ]
  40. sources = [
  41. "OGLCompilersDLL/InitializeDll.cpp",
  42. "OGLCompilersDLL/InitializeDll.h",
  43. "SPIRV/GLSL.ext.EXT.h",
  44. "SPIRV/GLSL.ext.KHR.h",
  45. "SPIRV/GLSL.std.450.h",
  46. "SPIRV/GlslangToSpv.cpp",
  47. "SPIRV/GlslangToSpv.h",
  48. "SPIRV/InReadableOrder.cpp",
  49. "SPIRV/Logger.cpp",
  50. "SPIRV/Logger.h",
  51. "SPIRV/SPVRemapper.cpp",
  52. "SPIRV/SPVRemapper.h",
  53. "SPIRV/SpvBuilder.cpp",
  54. "SPIRV/SpvBuilder.h",
  55. "SPIRV/SpvPostProcess.cpp",
  56. "SPIRV/SpvTools.cpp",
  57. "SPIRV/SpvTools.h",
  58. "SPIRV/bitutils.h",
  59. "SPIRV/disassemble.cpp",
  60. "SPIRV/disassemble.h",
  61. "SPIRV/doc.cpp",
  62. "SPIRV/doc.h",
  63. "SPIRV/hex_float.h",
  64. "SPIRV/spirv.hpp",
  65. "SPIRV/spvIR.h",
  66. "glslang/GenericCodeGen/CodeGen.cpp",
  67. "glslang/GenericCodeGen/Link.cpp",
  68. "glslang/Include/BaseTypes.h",
  69. "glslang/Include/Common.h",
  70. "glslang/Include/ConstantUnion.h",
  71. "glslang/Include/InfoSink.h",
  72. "glslang/Include/InitializeGlobals.h",
  73. "glslang/Include/PoolAlloc.h",
  74. "glslang/Include/ResourceLimits.h",
  75. "glslang/Include/ShHandle.h",
  76. "glslang/Include/Types.h",
  77. "glslang/Include/arrays.h",
  78. "glslang/Include/intermediate.h",
  79. "glslang/Include/revision.h",
  80. "glslang/MachineIndependent/Constant.cpp",
  81. "glslang/MachineIndependent/InfoSink.cpp",
  82. "glslang/MachineIndependent/Initialize.cpp",
  83. "glslang/MachineIndependent/Initialize.h",
  84. "glslang/MachineIndependent/IntermTraverse.cpp",
  85. "glslang/MachineIndependent/Intermediate.cpp",
  86. "glslang/MachineIndependent/LiveTraverser.h",
  87. "glslang/MachineIndependent/ParseContextBase.cpp",
  88. "glslang/MachineIndependent/ParseHelper.cpp",
  89. "glslang/MachineIndependent/ParseHelper.h",
  90. "glslang/MachineIndependent/PoolAlloc.cpp",
  91. "glslang/MachineIndependent/RemoveTree.cpp",
  92. "glslang/MachineIndependent/RemoveTree.h",
  93. "glslang/MachineIndependent/Scan.cpp",
  94. "glslang/MachineIndependent/Scan.h",
  95. "glslang/MachineIndependent/ScanContext.h",
  96. "glslang/MachineIndependent/ShaderLang.cpp",
  97. "glslang/MachineIndependent/SymbolTable.cpp",
  98. "glslang/MachineIndependent/SymbolTable.h",
  99. "glslang/MachineIndependent/Versions.cpp",
  100. "glslang/MachineIndependent/Versions.h",
  101. "glslang/MachineIndependent/attribute.cpp",
  102. "glslang/MachineIndependent/attribute.h",
  103. "glslang/MachineIndependent/gl_types.h",
  104. "glslang/MachineIndependent/glslang_tab.cpp",
  105. "glslang/MachineIndependent/glslang_tab.cpp.h",
  106. "glslang/MachineIndependent/intermOut.cpp",
  107. "glslang/MachineIndependent/iomapper.cpp",
  108. "glslang/MachineIndependent/iomapper.h",
  109. "glslang/MachineIndependent/limits.cpp",
  110. "glslang/MachineIndependent/linkValidate.cpp",
  111. "glslang/MachineIndependent/localintermediate.h",
  112. "glslang/MachineIndependent/parseConst.cpp",
  113. "glslang/MachineIndependent/parseVersions.h",
  114. "glslang/MachineIndependent/preprocessor/Pp.cpp",
  115. "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
  116. "glslang/MachineIndependent/preprocessor/PpContext.cpp",
  117. "glslang/MachineIndependent/preprocessor/PpContext.h",
  118. "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
  119. "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
  120. "glslang/MachineIndependent/preprocessor/PpTokens.h",
  121. "glslang/MachineIndependent/propagateNoContraction.cpp",
  122. "glslang/MachineIndependent/propagateNoContraction.h",
  123. "glslang/MachineIndependent/reflection.cpp",
  124. "glslang/MachineIndependent/reflection.h",
  125. "glslang/OSDependent/osinclude.h",
  126. "glslang/Public/ShaderLang.h",
  127. ]
  128. defines = [ "ENABLE_OPT=1" ]
  129. if (is_win) {
  130. sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
  131. defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
  132. } else {
  133. sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
  134. defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
  135. }
  136. if (is_clang) {
  137. cflags_cc = [
  138. "-Wno-extra-semi",
  139. "-Wno-ignored-qualifiers",
  140. "-Wno-implicit-fallthrough",
  141. "-Wno-inconsistent-missing-override",
  142. "-Wno-sign-compare",
  143. "-Wno-unused-variable",
  144. "-Wno-missing-field-initializers",
  145. ]
  146. }
  147. if (is_win && !is_clang) {
  148. cflags = [
  149. "/wd4018", # signed/unsigned mismatch
  150. "/wd4189", # local variable is initialized but not referenced
  151. ]
  152. }
  153. deps = [
  154. "${spirv_tools_dir}:spvtools_opt",
  155. "${spirv_tools_dir}:spvtools_val",
  156. ]
  157. }
  158. source_set("glslang_default_resource_limits_sources") {
  159. sources = [
  160. "StandAlone/ResourceLimits.cpp",
  161. "StandAlone/ResourceLimits.h",
  162. ]
  163. deps = [ ":glslang_sources" ]
  164. public_configs = [ ":glslang_public" ]
  165. }
  166. executable("glslang_validator") {
  167. sources = [
  168. "StandAlone/DirStackFileIncluder.h",
  169. "StandAlone/StandAlone.cpp",
  170. ]
  171. if (!is_win) {
  172. cflags = [ "-Woverflow" ]
  173. }
  174. defines = [ "ENABLE_OPT=1" ]
  175. deps = [
  176. ":glslang_default_resource_limits_sources",
  177. ":glslang_sources",
  178. ]
  179. }
  180. executable("spirv-remap") {
  181. sources = [
  182. "StandAlone/spirv-remap.cpp",
  183. ]
  184. defines = [ "ENABLE_OPT=1" ]
  185. deps = [
  186. ":glslang_sources",
  187. ]
  188. }