blob: e38e78a4003a469fd3adfacc85fc007fff26b5ca [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 = [ "." ]
40}
41
Dan Sinclairb29c58e2018-09-24 18:40:38 -040042source_set("glslang_sources") {
Corentin Wallez6857c232018-10-03 13:15:23 -040043 public_configs = [ ":glslang_public" ]
44
Dan Sinclair257b25c2018-09-24 16:35:44 -040045 sources = [
46 "OGLCompilersDLL/InitializeDll.cpp",
47 "OGLCompilersDLL/InitializeDll.h",
48 "SPIRV/GLSL.ext.EXT.h",
49 "SPIRV/GLSL.ext.KHR.h",
50 "SPIRV/GLSL.std.450.h",
51 "SPIRV/GlslangToSpv.cpp",
52 "SPIRV/GlslangToSpv.h",
53 "SPIRV/InReadableOrder.cpp",
54 "SPIRV/Logger.cpp",
55 "SPIRV/Logger.h",
56 "SPIRV/SPVRemapper.cpp",
57 "SPIRV/SPVRemapper.h",
58 "SPIRV/SpvBuilder.cpp",
59 "SPIRV/SpvBuilder.h",
Corentin Wallez873734d2018-09-26 14:51:19 -070060 "SPIRV/SpvPostProcess.cpp",
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -040061 "SPIRV/SpvTools.cpp",
62 "SPIRV/SpvTools.h",
Dan Sinclair257b25c2018-09-24 16:35:44 -040063 "SPIRV/bitutils.h",
64 "SPIRV/disassemble.cpp",
65 "SPIRV/disassemble.h",
66 "SPIRV/doc.cpp",
67 "SPIRV/doc.h",
68 "SPIRV/hex_float.h",
69 "SPIRV/spirv.hpp",
70 "SPIRV/spvIR.h",
71 "glslang/GenericCodeGen/CodeGen.cpp",
72 "glslang/GenericCodeGen/Link.cpp",
73 "glslang/Include/BaseTypes.h",
74 "glslang/Include/Common.h",
75 "glslang/Include/ConstantUnion.h",
76 "glslang/Include/InfoSink.h",
77 "glslang/Include/InitializeGlobals.h",
78 "glslang/Include/PoolAlloc.h",
79 "glslang/Include/ResourceLimits.h",
80 "glslang/Include/ShHandle.h",
81 "glslang/Include/Types.h",
82 "glslang/Include/arrays.h",
83 "glslang/Include/intermediate.h",
84 "glslang/Include/revision.h",
85 "glslang/MachineIndependent/Constant.cpp",
86 "glslang/MachineIndependent/InfoSink.cpp",
87 "glslang/MachineIndependent/Initialize.cpp",
88 "glslang/MachineIndependent/Initialize.h",
89 "glslang/MachineIndependent/IntermTraverse.cpp",
90 "glslang/MachineIndependent/Intermediate.cpp",
91 "glslang/MachineIndependent/LiveTraverser.h",
92 "glslang/MachineIndependent/ParseContextBase.cpp",
93 "glslang/MachineIndependent/ParseHelper.cpp",
94 "glslang/MachineIndependent/ParseHelper.h",
95 "glslang/MachineIndependent/PoolAlloc.cpp",
96 "glslang/MachineIndependent/RemoveTree.cpp",
97 "glslang/MachineIndependent/RemoveTree.h",
98 "glslang/MachineIndependent/Scan.cpp",
99 "glslang/MachineIndependent/Scan.h",
100 "glslang/MachineIndependent/ScanContext.h",
101 "glslang/MachineIndependent/ShaderLang.cpp",
102 "glslang/MachineIndependent/SymbolTable.cpp",
103 "glslang/MachineIndependent/SymbolTable.h",
104 "glslang/MachineIndependent/Versions.cpp",
105 "glslang/MachineIndependent/Versions.h",
106 "glslang/MachineIndependent/attribute.cpp",
107 "glslang/MachineIndependent/attribute.h",
108 "glslang/MachineIndependent/gl_types.h",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400109 "glslang/MachineIndependent/glslang_tab.cpp",
110 "glslang/MachineIndependent/glslang_tab.cpp.h",
111 "glslang/MachineIndependent/intermOut.cpp",
112 "glslang/MachineIndependent/iomapper.cpp",
113 "glslang/MachineIndependent/iomapper.h",
114 "glslang/MachineIndependent/limits.cpp",
115 "glslang/MachineIndependent/linkValidate.cpp",
116 "glslang/MachineIndependent/localintermediate.h",
117 "glslang/MachineIndependent/parseConst.cpp",
118 "glslang/MachineIndependent/parseVersions.h",
119 "glslang/MachineIndependent/preprocessor/Pp.cpp",
120 "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
121 "glslang/MachineIndependent/preprocessor/PpContext.cpp",
122 "glslang/MachineIndependent/preprocessor/PpContext.h",
123 "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
124 "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
125 "glslang/MachineIndependent/preprocessor/PpTokens.h",
126 "glslang/MachineIndependent/propagateNoContraction.cpp",
127 "glslang/MachineIndependent/propagateNoContraction.h",
128 "glslang/MachineIndependent/reflection.cpp",
129 "glslang/MachineIndependent/reflection.h",
130 "glslang/OSDependent/osinclude.h",
131 "glslang/Public/ShaderLang.h",
132 ]
133
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -0400134 defines = [ "ENABLE_OPT=1" ]
Dan Sinclairb29c58e2018-09-24 18:40:38 -0400135 if (is_win) {
136 sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
137 defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
138 } else {
139 sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
140 defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
141 }
142
Dan Sinclair257b25c2018-09-24 16:35:44 -0400143 if (is_clang) {
144 cflags_cc = [
Jamie Madill1a1651c2019-01-30 11:37:15 -0500145 "-Wno-extra-semi",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400146 "-Wno-ignored-qualifiers",
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500147 "-Wno-implicit-fallthrough",
Jamie Madill97061062019-01-23 18:56:43 -0500148 "-Wno-inconsistent-missing-override",
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500149 "-Wno-sign-compare",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400150 "-Wno-unused-variable",
David 'Digit' Turner1f5799c2019-06-21 14:58:30 +0200151 "-Wno-missing-field-initializers",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400152 ]
153 }
Jamie Madill08fe88a2019-01-24 10:55:41 -0500154 if (is_win && !is_clang) {
155 cflags = [
156 "/wd4018", # signed/unsigned mismatch
Jamie Madill099a80d2019-03-18 11:38:53 -0400157 "/wd4189", # local variable is initialized but not referenced
Jamie Madill08fe88a2019-01-24 10:55:41 -0500158 ]
159 }
Dan Sinclair257b25c2018-09-24 16:35:44 -0400160
161 deps = [
162 "${spirv_tools_dir}:spvtools_opt",
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -0400163 "${spirv_tools_dir}:spvtools_val",
Dan Sinclair257b25c2018-09-24 16:35:44 -0400164 ]
Dan Sinclairb29c58e2018-09-24 18:40:38 -0400165}
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500166
167source_set("glslang_default_resource_limits_sources") {
168 sources = [
169 "StandAlone/ResourceLimits.cpp",
170 "StandAlone/ResourceLimits.h",
171 ]
172 deps = [ ":glslang_sources" ]
173 public_configs = [ ":glslang_public" ]
174}
175
Jamie Madille880e962019-03-11 15:45:31 -0400176executable("glslang_validator") {
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500177 sources = [
178 "StandAlone/DirStackFileIncluder.h",
179 "StandAlone/StandAlone.cpp",
180 ]
181 if (!is_win) {
182 cflags = [ "-Woverflow" ]
183 }
Shahbaz Youssefi741fc4a2019-05-16 23:53:15 -0400184 defines = [ "ENABLE_OPT=1" ]
Jamie Madill0ceaebc2019-01-18 14:53:31 -0500185 deps = [
186 ":glslang_default_resource_limits_sources",
187 ":glslang_sources",
188 ]
189}
David 'Digit' Turner1f5799c2019-06-21 14:58:30 +0200190
191executable("spirv-remap") {
192 sources = [
193 "StandAlone/spirv-remap.cpp",
194 ]
195 defines = [ "ENABLE_OPT=1" ]
196 deps = [
197 ":glslang_sources",
198 ]
199}