BUILD.gn: make the static_lib complete to fix the build on OSX
[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
42 source_set("glslang_sources") {
43   sources = [
44     "OGLCompilersDLL/InitializeDll.cpp",
45     "OGLCompilersDLL/InitializeDll.h",
46     "SPIRV/GLSL.ext.EXT.h",
47     "SPIRV/GLSL.ext.KHR.h",
48     "SPIRV/GLSL.std.450.h",
49     "SPIRV/GlslangToSpv.cpp",
50     "SPIRV/GlslangToSpv.h",
51     "SPIRV/InReadableOrder.cpp",
52     "SPIRV/Logger.cpp",
53     "SPIRV/Logger.h",
54     "SPIRV/SPVRemapper.cpp",
55     "SPIRV/SPVRemapper.h",
56     "SPIRV/SpvBuilder.cpp",
57     "SPIRV/SpvBuilder.h",
58     "SPIRV/SpvPostProcess.cpp",
59     "SPIRV/SpvPostProcess.h",
60     "SPIRV/bitutils.h",
61     "SPIRV/disassemble.cpp",
62     "SPIRV/disassemble.h",
63     "SPIRV/doc.cpp",
64     "SPIRV/doc.h",
65     "SPIRV/hex_float.h",
66     "SPIRV/spirv.hpp",
67     "SPIRV/spvIR.h",
68     "glslang/GenericCodeGen/CodeGen.cpp",
69     "glslang/GenericCodeGen/Link.cpp",
70     "glslang/Include/BaseTypes.h",
71     "glslang/Include/Common.h",
72     "glslang/Include/ConstantUnion.h",
73     "glslang/Include/InfoSink.h",
74     "glslang/Include/InitializeGlobals.h",
75     "glslang/Include/PoolAlloc.h",
76     "glslang/Include/ResourceLimits.h",
77     "glslang/Include/ShHandle.h",
78     "glslang/Include/Types.h",
79     "glslang/Include/arrays.h",
80     "glslang/Include/intermediate.h",
81     "glslang/Include/revision.h",
82     "glslang/MachineIndependent/Constant.cpp",
83     "glslang/MachineIndependent/InfoSink.cpp",
84     "glslang/MachineIndependent/Initialize.cpp",
85     "glslang/MachineIndependent/Initialize.h",
86     "glslang/MachineIndependent/IntermTraverse.cpp",
87     "glslang/MachineIndependent/Intermediate.cpp",
88     "glslang/MachineIndependent/LiveTraverser.h",
89     "glslang/MachineIndependent/ParseContextBase.cpp",
90     "glslang/MachineIndependent/ParseHelper.cpp",
91     "glslang/MachineIndependent/ParseHelper.h",
92     "glslang/MachineIndependent/PoolAlloc.cpp",
93     "glslang/MachineIndependent/RemoveTree.cpp",
94     "glslang/MachineIndependent/RemoveTree.h",
95     "glslang/MachineIndependent/Scan.cpp",
96     "glslang/MachineIndependent/Scan.h",
97     "glslang/MachineIndependent/ScanContext.h",
98     "glslang/MachineIndependent/ShaderLang.cpp",
99     "glslang/MachineIndependent/SymbolTable.cpp",
100     "glslang/MachineIndependent/SymbolTable.h",
101     "glslang/MachineIndependent/Versions.cpp",
102     "glslang/MachineIndependent/Versions.h",
103     "glslang/MachineIndependent/attribute.cpp",
104     "glslang/MachineIndependent/attribute.h",
105     "glslang/MachineIndependent/gl_types.h",
106     "glslang/MachineIndependent/glslang.y",
107     "glslang/MachineIndependent/glslang_tab.cpp",
108     "glslang/MachineIndependent/glslang_tab.cpp.h",
109     "glslang/MachineIndependent/intermOut.cpp",
110     "glslang/MachineIndependent/iomapper.cpp",
111     "glslang/MachineIndependent/iomapper.h",
112     "glslang/MachineIndependent/limits.cpp",
113     "glslang/MachineIndependent/linkValidate.cpp",
114     "glslang/MachineIndependent/localintermediate.h",
115     "glslang/MachineIndependent/parseConst.cpp",
116     "glslang/MachineIndependent/parseVersions.h",
117     "glslang/MachineIndependent/preprocessor/Pp.cpp",
118     "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
119     "glslang/MachineIndependent/preprocessor/PpContext.cpp",
120     "glslang/MachineIndependent/preprocessor/PpContext.h",
121     "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
122     "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
123     "glslang/MachineIndependent/preprocessor/PpTokens.h",
124     "glslang/MachineIndependent/propagateNoContraction.cpp",
125     "glslang/MachineIndependent/propagateNoContraction.h",
126     "glslang/MachineIndependent/reflection.cpp",
127     "glslang/MachineIndependent/reflection.h",
128     "glslang/OSDependent/osinclude.h",
129     "glslang/Public/ShaderLang.h",
130   ]
131
132   defines = []
133   if (is_win) {
134     sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
135     defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
136   } else {
137     sources += [ "glslang/OSDependent/Unix/ossource.cpp" ]
138     defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
139   }
140
141   if (is_clang) {
142     cflags_cc = [
143       "-Wno-implicit-fallthrough",
144       "-Wno-ignored-qualifiers",
145       "-Wno-unused-variable",
146     ]
147   }
148
149   deps = [
150     "${spirv_tools_dir}:spvtools_opt",
151   ]
152 }
153
154 static_library("glslang_static") {
155   public_configs = [ ":glslang_public" ]
156
157   deps = [
158     ":glslang_sources",
159   ]
160   complete_static_lib = true
161
162   configs -= [ "//build/config/compiler:chromium_code" ]
163   configs += [ "//build/config/compiler:no_chromium_code" ]
164 }
165