Merge pull request #1882 from Kangz/fix-chrome
[platform/upstream/glslang.git] / BUILD.gn
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
34 import("//build_overrides/glslang.gni")
35
36 spirv_tools_dir = glslang_spirv_tools_dir
37
38 config("glslang_public") {
39   include_dirs = [ "." ]
40
41   defines = [ "ENABLE_HLSL=1" ]
42 }
43
44 source_set("glslang_sources") {
45   public_configs = [ ":glslang_public" ]
46
47   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",
62     "SPIRV/SpvPostProcess.cpp",
63     "SPIRV/SpvTools.cpp",
64     "SPIRV/SpvTools.h",
65     "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",
111     "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",
134   ]
135
136   defines = [ "ENABLE_OPT=1" ]
137
138   if (is_win) {
139     sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
140     defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
141   } else {
142     sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
143     defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
144   }
145
146   if (is_clang) {
147     cflags_cc = [
148       "-Wno-extra-semi",
149       "-Wno-ignored-qualifiers",
150       "-Wno-implicit-fallthrough",
151       "-Wno-inconsistent-missing-override",
152       "-Wno-sign-compare",
153       "-Wno-unused-variable",
154       "-Wno-missing-field-initializers",
155     ]
156   }
157   if (is_win && !is_clang) {
158     cflags = [
159       "/wd4018",  # signed/unsigned mismatch
160       "/wd4189",  # local variable is initialized but not referenced
161     ]
162   }
163
164   deps = [
165     "${spirv_tools_dir}:spvtools_opt",
166     "${spirv_tools_dir}:spvtools_val",
167   ]
168 }
169
170 source_set("glslang_default_resource_limits_sources") {
171   sources = [
172     "StandAlone/ResourceLimits.cpp",
173     "StandAlone/ResourceLimits.h",
174   ]
175   deps = [
176     ":glslang_sources",
177   ]
178   public_configs = [ ":glslang_public" ]
179 }
180
181 executable("glslang_validator") {
182   sources = [
183     "StandAlone/DirStackFileIncluder.h",
184     "StandAlone/StandAlone.cpp",
185   ]
186   if (!is_win) {
187     cflags = [ "-Woverflow" ]
188   }
189   defines = [ "ENABLE_OPT=1" ]
190   deps = [
191     ":glslang_default_resource_limits_sources",
192     ":glslang_sources",
193   ]
194 }
195
196 executable("spirv-remap") {
197   sources = [
198     "StandAlone/spirv-remap.cpp",
199   ]
200   defines = [ "ENABLE_OPT=1" ]
201   deps = [
202     ":glslang_sources",
203   ]
204 }