1 # Copyright (C) 2018 Google, Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
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.
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.
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.
34 import("//build_overrides/glslang.gni")
36 # Both Chromium and Fuchsia use by default a set of warning errors
37 # that is far too strict to compile this project. These are also
38 # typically appended after |cflags|, overriding target-specific
39 # definitions. To work around this, determine which configs to
40 # add and remove in order to succesfully build the project.
41 if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
42 _configs_to_remove = [ "//build/config:default_warnings" ]
45 _configs_to_remove = [ "//build/config/compiler:chromium_code" ]
46 _configs_to_add = [ "//build/config/compiler:no_chromium_code" ]
49 spirv_tools_dir = glslang_spirv_tools_dir
51 config("glslang_public") {
52 include_dirs = [ "." ]
54 defines = [ "ENABLE_HLSL=1" ]
57 source_set("glslang_sources") {
58 public_configs = [ ":glslang_public" ]
61 "OGLCompilersDLL/InitializeDll.cpp",
62 "OGLCompilersDLL/InitializeDll.h",
63 "SPIRV/GLSL.ext.AMD.h",
64 "SPIRV/GLSL.ext.EXT.h",
65 "SPIRV/GLSL.ext.KHR.h",
66 "SPIRV/GLSL.ext.NV.h",
67 "SPIRV/GLSL.std.450.h",
68 "SPIRV/GlslangToSpv.cpp",
69 "SPIRV/GlslangToSpv.h",
70 "SPIRV/InReadableOrder.cpp",
73 "SPIRV/NonSemanticDebugPrintf.h",
\r
74 "SPIRV/SPVRemapper.cpp",
75 "SPIRV/SPVRemapper.h",
76 "SPIRV/SpvBuilder.cpp",
78 "SPIRV/SpvPostProcess.cpp",
82 "SPIRV/disassemble.cpp",
83 "SPIRV/disassemble.h",
89 "glslang/GenericCodeGen/CodeGen.cpp",
90 "glslang/GenericCodeGen/Link.cpp",
91 "glslang/Include/BaseTypes.h",
92 "glslang/Include/Common.h",
93 "glslang/Include/ConstantUnion.h",
94 "glslang/Include/InfoSink.h",
95 "glslang/Include/InitializeGlobals.h",
96 "glslang/Include/PoolAlloc.h",
97 "glslang/Include/ResourceLimits.h",
98 "glslang/Include/ShHandle.h",
99 "glslang/Include/Types.h",
100 "glslang/Include/arrays.h",
101 "glslang/Include/intermediate.h",
102 "glslang/Include/revision.h",
103 "glslang/MachineIndependent/Constant.cpp",
104 "glslang/MachineIndependent/InfoSink.cpp",
105 "glslang/MachineIndependent/Initialize.cpp",
106 "glslang/MachineIndependent/Initialize.h",
107 "glslang/MachineIndependent/IntermTraverse.cpp",
108 "glslang/MachineIndependent/Intermediate.cpp",
109 "glslang/MachineIndependent/LiveTraverser.h",
110 "glslang/MachineIndependent/ParseContextBase.cpp",
111 "glslang/MachineIndependent/ParseHelper.cpp",
112 "glslang/MachineIndependent/ParseHelper.h",
113 "glslang/MachineIndependent/PoolAlloc.cpp",
114 "glslang/MachineIndependent/RemoveTree.cpp",
115 "glslang/MachineIndependent/RemoveTree.h",
116 "glslang/MachineIndependent/Scan.cpp",
117 "glslang/MachineIndependent/Scan.h",
118 "glslang/MachineIndependent/ScanContext.h",
119 "glslang/MachineIndependent/ShaderLang.cpp",
120 "glslang/MachineIndependent/SymbolTable.cpp",
121 "glslang/MachineIndependent/SymbolTable.h",
122 "glslang/MachineIndependent/Versions.cpp",
123 "glslang/MachineIndependent/Versions.h",
124 "glslang/MachineIndependent/attribute.cpp",
125 "glslang/MachineIndependent/attribute.h",
126 "glslang/MachineIndependent/gl_types.h",
127 "glslang/MachineIndependent/glslang_tab.cpp",
128 "glslang/MachineIndependent/glslang_tab.cpp.h",
129 "glslang/MachineIndependent/intermOut.cpp",
130 "glslang/MachineIndependent/iomapper.cpp",
131 "glslang/MachineIndependent/iomapper.h",
132 "glslang/MachineIndependent/limits.cpp",
133 "glslang/MachineIndependent/linkValidate.cpp",
134 "glslang/MachineIndependent/localintermediate.h",
135 "glslang/MachineIndependent/parseConst.cpp",
136 "glslang/MachineIndependent/parseVersions.h",
137 "glslang/MachineIndependent/preprocessor/Pp.cpp",
138 "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
139 "glslang/MachineIndependent/preprocessor/PpContext.cpp",
140 "glslang/MachineIndependent/preprocessor/PpContext.h",
141 "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
142 "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
143 "glslang/MachineIndependent/preprocessor/PpTokens.h",
144 "glslang/MachineIndependent/propagateNoContraction.cpp",
145 "glslang/MachineIndependent/propagateNoContraction.h",
146 "glslang/MachineIndependent/reflection.cpp",
147 "glslang/MachineIndependent/reflection.h",
148 "glslang/OSDependent/osinclude.h",
149 "glslang/Public/ShaderLang.h",
150 "hlsl/hlslAttributes.cpp",
151 "hlsl/hlslAttributes.h",
152 "hlsl/hlslGrammar.cpp",
153 "hlsl/hlslGrammar.h",
154 "hlsl/hlslOpMap.cpp",
156 "hlsl/hlslParseHelper.cpp",
157 "hlsl/hlslParseHelper.h",
158 "hlsl/hlslParseables.cpp",
159 "hlsl/hlslParseables.h",
160 "hlsl/hlslScanContext.cpp",
161 "hlsl/hlslScanContext.h",
162 "hlsl/hlslTokenStream.cpp",
163 "hlsl/hlslTokenStream.h",
167 defines = [ "ENABLE_OPT=1" ]
170 sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
171 defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
173 sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
174 defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
180 "-Wno-ignored-qualifiers",
181 "-Wno-implicit-fallthrough",
182 "-Wno-inconsistent-missing-override",
184 "-Wno-unused-variable",
185 "-Wno-missing-field-initializers",
189 if (is_win && !is_clang) {
191 "/wd4018", # signed/unsigned mismatch
192 "/wd4189", # local variable is initialized but not referenced
197 "${spirv_tools_dir}:spvtools_opt",
198 "${spirv_tools_dir}:spvtools_val",
201 configs -= _configs_to_remove
202 configs += _configs_to_add
205 source_set("glslang_default_resource_limits_sources") {
207 "StandAlone/ResourceLimits.cpp",
208 "StandAlone/ResourceLimits.h",
213 public_configs = [ ":glslang_public" ]
215 configs -= _configs_to_remove
216 configs += _configs_to_add
219 executable("glslang_validator") {
221 "StandAlone/DirStackFileIncluder.h",
222 "StandAlone/StandAlone.cpp",
225 cflags = [ "-Woverflow" ]
227 defines = [ "ENABLE_OPT=1" ]
229 ":glslang_default_resource_limits_sources",
233 configs -= _configs_to_remove
234 configs += _configs_to_add
237 executable("spirv-remap") {
239 "StandAlone/spirv-remap.cpp",
241 defines = [ "ENABLE_OPT=1" ]
246 configs -= _configs_to_remove
247 configs += _configs_to_add