blob: 55f21ad01adf1c030de283b92c58af93ea83010d [file] [log] [blame]
Dan Sinclair257b25c2018-09-24 16:35:44 -04001# 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
34import("//build_overrides/glslang.gni")
35
36spirv_tools_dir = glslang_spirv_tools_dir
37
38config("glslang_public") {
39 include_dirs = [ "." ]
Corentin Wallez9757da42019-08-26 14:13:54 +020040
41 defines = [ "ENABLE_HLSL=1" ]
Dan Sinclair257b25c2018-09-24 16:35:44 -040042}
43
Dan Sinclairb29c58e2018-09-24 18:40:38 -040044source_set("glslang_sources") {
Corentin Wallez6857c232018-10-03 13:15:23 -040045 public_configs = [ ":glslang_public" ]
46
Dan Sinclair257b25c2018-09-24 16:35:44 -040047 sources = [
48 "OGLCompilersDLL/InitializeDll.cpp",
49 "OGLCompilersDLL/InitializeDll.h",
50 "SPIRV/GLSL.ext.EXT.h",
51 "SPIRV/GLSL.ext.KHR.h",
52 "SPIRV/GLSL.std.450.h",
53 "SPIRV/GlslangToSpv.cpp",
54 "SPIRV/GlslangToSpv.h",
55 "SPIRV/InReadableOrder.cpp",
56 "SPIRV/Logger.cpp",
57 "SPIRV/Logger.h",
58 "SPIRV/SPVRemapper.cpp",
59 "SPIRV/SPVRemapper.h",
60 "SPIRV/SpvBuilder.cpp",
61 "SPIRV/SpvBuilder.h",
Corentin Wallez873734d2018-09-26 14:51:19 -070062 "SPIRV/SpvPostProcess.cpp",
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -040063 "SPIRV/SpvTools.cpp",
64 "SPIRV/SpvTools.h",
Dan Sinclair257b25c2018-09-24 16:35:44 -040065 "SPIRV/bitutils.h",
66 "SPIRV/disassemble.cpp",
67 "SPIRV/disassemble.h",
68 "SPIRV/doc.cpp",
69 "SPIRV/doc.h",
70 "SPIRV/hex_float.h",
71 "SPIRV/spirv.hpp",
72 "SPIRV/spvIR.h",
73 "glslang/GenericCodeGen/CodeGen.cpp",
74 "glslang/GenericCodeGen/Link.cpp",
75 "glslang/Include/BaseTypes.h",
76 "glslang/Include/Common.h",
77 "glslang/Include/ConstantUnion.h",
78 "glslang/Include/InfoSink.h",
79 "glslang/Include/InitializeGlobals.h",
80 "glslang/Include/PoolAlloc.h",
81 "glslang/Include/ResourceLimits.h",
82 "glslang/Include/ShHandle.h",
83 "glslang/Include/Types.h",
84 "glslang/Include/arrays.h",
85 "glslang/Include/intermediate.h",
86 "glslang/Include/revision.h",
87 "glslang/MachineIndependent/Constant.cpp",
88 "glslang/MachineIndependent/InfoSink.cpp",
89 "glslang/MachineIndependent/Initialize.cpp",
90 "glslang/MachineIndependent/Initialize.h",
91 "glslang/MachineIndependent/IntermTraverse.cpp",
92 "glslang/MachineIndependent/Intermediate.cpp",
93 "glslang/MachineIndependent/LiveTraverser.h",
94 "glslang/MachineIndependent/ParseContextBase.cpp",
95 "glslang/MachineIndependent/ParseHelper.cpp",
96 "glslang/MachineIndependent/ParseHelper.h",
97 "glslang/MachineIndependent/PoolAlloc.cpp",
98 "glslang/MachineIndependent/RemoveTree.cpp",
99 "glslang/MachineIndependent/RemoveTree.h",
100 "glslang/MachineIndependent/Scan.cpp",
101 "glslang/MachineIndependent/Scan.h",
102 "glslang/MachineIndependent/ScanContext.h",
103 "glslang/MachineIndependent/ShaderLang.cpp",
104 "glslang/MachineIndependent/SymbolTable.cpp",
105 "glslang/MachineIndependent/SymbolTable.h",
106 "glslang/MachineIndependent/Versions.cpp",
107 "glslang/MachineIndependent/Versions.h",
108 "glslang/MachineIndependent/attribute.cpp",
109 "glslang/MachineIndependent/attribute.h",
110 "glslang/MachineIndependent/gl_types.h",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400111 "glslang/MachineIndependent/glslang_tab.cpp",
112 "glslang/MachineIndependent/glslang_tab.cpp.h",
113 "glslang/MachineIndependent/intermOut.cpp",
114 "glslang/MachineIndependent/iomapper.cpp",
115 "glslang/MachineIndependent/iomapper.h",
116 "glslang/MachineIndependent/limits.cpp",
117 "glslang/MachineIndependent/linkValidate.cpp",
118 "glslang/MachineIndependent/localintermediate.h",
119 "glslang/MachineIndependent/parseConst.cpp",
120 "glslang/MachineIndependent/parseVersions.h",
121 "glslang/MachineIndependent/preprocessor/Pp.cpp",
122 "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
123 "glslang/MachineIndependent/preprocessor/PpContext.cpp",
124 "glslang/MachineIndependent/preprocessor/PpContext.h",
125 "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
126 "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
127 "glslang/MachineIndependent/preprocessor/PpTokens.h",
128 "glslang/MachineIndependent/propagateNoContraction.cpp",
129 "glslang/MachineIndependent/propagateNoContraction.h",
130 "glslang/MachineIndependent/reflection.cpp",
131 "glslang/MachineIndependent/reflection.h",
132 "glslang/OSDependent/osinclude.h",
133 "glslang/Public/ShaderLang.h",
Corentin Wallez5442b4f2019-08-27 15:24:31 +0200134 "hlsl/hlslAttributes.cpp",
135 "hlsl/hlslAttributes.h",
136 "hlsl/hlslGrammar.cpp",
137 "hlsl/hlslGrammar.h",
138 "hlsl/hlslOpMap.cpp",
139 "hlsl/hlslOpMap.h",
140 "hlsl/hlslParseHelper.cpp",
141 "hlsl/hlslParseHelper.h",
142 "hlsl/hlslParseables.cpp",
143 "hlsl/hlslParseables.h",
144 "hlsl/hlslScanContext.cpp",
145 "hlsl/hlslScanContext.h",
146 "hlsl/hlslTokenStream.cpp",
147 "hlsl/hlslTokenStream.h",
148 "hlsl/hlslTokens.h",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400149 ]
150
Corentin Wallez9757da42019-08-26 14:13:54 +0200151 defines = [ "ENABLE_OPT=1" ]
David Neto96bec342019-08-23 14:34:29 -0400152
Dan Sinclairb29c58e2018-09-24 18:40:38 -0400153 if (is_win) {
154 sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
155 defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
156 } else {
157 sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
158 defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
159 }
160
Dan Sinclair257b25c2018-09-24 16:35:44 -0400161 if (is_clang) {
162 cflags_cc = [
Jamie Madill1a1651c2019-01-30 11:37:15 -0500163 "-Wno-extra-semi",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400164 "-Wno-ignored-qualifiers",
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500165 "-Wno-implicit-fallthrough",
Jamie Madill97061062019-01-23 18:56:43 -0500166 "-Wno-inconsistent-missing-override",
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500167 "-Wno-sign-compare",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400168 "-Wno-unused-variable",
David 'Digit' Turner1f5799c2019-06-21 14:58:30 +0200169 "-Wno-missing-field-initializers",
David 'Digit' Turner9d43c7f2019-09-16 19:13:16 +0200170 "-Wno-newline-eof",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400171 ]
172 }
Jamie Madill08fe88a2019-01-24 10:55:41 -0500173 if (is_win && !is_clang) {
174 cflags = [
Corentin Wallez9757da42019-08-26 14:13:54 +0200175 "/wd4018", # signed/unsigned mismatch
176 "/wd4189", # local variable is initialized but not referenced
Jamie Madill08fe88a2019-01-24 10:55:41 -0500177 ]
178 }
Dan Sinclair257b25c2018-09-24 16:35:44 -0400179
180 deps = [
181 "${spirv_tools_dir}:spvtools_opt",
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -0400182 "${spirv_tools_dir}:spvtools_val",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400183 ]
Dan Sinclairb29c58e2018-09-24 18:40:38 -0400184}
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500185
186source_set("glslang_default_resource_limits_sources") {
187 sources = [
188 "StandAlone/ResourceLimits.cpp",
189 "StandAlone/ResourceLimits.h",
190 ]
Corentin Wallez9757da42019-08-26 14:13:54 +0200191 deps = [
192 ":glslang_sources",
193 ]
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500194 public_configs = [ ":glslang_public" ]
195}
196
Jamie Madille880e962019-03-11 15:45:31 -0400197executable("glslang_validator") {
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500198 sources = [
199 "StandAlone/DirStackFileIncluder.h",
200 "StandAlone/StandAlone.cpp",
201 ]
202 if (!is_win) {
203 cflags = [ "-Woverflow" ]
204 }
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -0400205 defines = [ "ENABLE_OPT=1" ]
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500206 deps = [
207 ":glslang_default_resource_limits_sources",
208 ":glslang_sources",
209 ]
210}
David 'Digit' Turner1f5799c2019-06-21 14:58:30 +0200211
212executable("spirv-remap") {
213 sources = [
214 "StandAlone/spirv-remap.cpp",
215 ]
216 defines = [ "ENABLE_OPT=1" ]
217 deps = [
218 ":glslang_sources",
219 ]
220}