Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 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 = [ "." ] |
Corentin Wallez | 9757da4 | 2019-08-26 14:13:54 +0200 | [diff] [blame] | 40 | |
| 41 | defines = [ "ENABLE_HLSL=1" ] |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 42 | } |
| 43 | |
Dan Sinclair | b29c58e | 2018-09-24 18:40:38 -0400 | [diff] [blame] | 44 | source_set("glslang_sources") { |
Corentin Wallez | 6857c23 | 2018-10-03 13:15:23 -0400 | [diff] [blame] | 45 | public_configs = [ ":glslang_public" ] |
| 46 | |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 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", |
Corentin Wallez | 873734d | 2018-09-26 14:51:19 -0700 | [diff] [blame] | 62 | "SPIRV/SpvPostProcess.cpp", |
Shahbaz Youssefi | 741fc4a | 2019-05-16 23:53:15 -0400 | [diff] [blame] | 63 | "SPIRV/SpvTools.cpp", |
| 64 | "SPIRV/SpvTools.h", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 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", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 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", |
Corentin Wallez | 5442b4f | 2019-08-27 15:24:31 +0200 | [diff] [blame] | 134 | "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 Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 149 | ] |
| 150 | |
Corentin Wallez | 9757da4 | 2019-08-26 14:13:54 +0200 | [diff] [blame] | 151 | defines = [ "ENABLE_OPT=1" ] |
David Neto | 96bec34 | 2019-08-23 14:34:29 -0400 | [diff] [blame] | 152 | |
Dan Sinclair | b29c58e | 2018-09-24 18:40:38 -0400 | [diff] [blame] | 153 | 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 Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 161 | if (is_clang) { |
| 162 | cflags_cc = [ |
Jamie Madill | 1a1651c | 2019-01-30 11:37:15 -0500 | [diff] [blame] | 163 | "-Wno-extra-semi", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 164 | "-Wno-ignored-qualifiers", |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 165 | "-Wno-implicit-fallthrough", |
Jamie Madill | 9706106 | 2019-01-23 18:56:43 -0500 | [diff] [blame] | 166 | "-Wno-inconsistent-missing-override", |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 167 | "-Wno-sign-compare", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 168 | "-Wno-unused-variable", |
David 'Digit' Turner | 1f5799c | 2019-06-21 14:58:30 +0200 | [diff] [blame] | 169 | "-Wno-missing-field-initializers", |
David 'Digit' Turner | 9d43c7f | 2019-09-16 19:13:16 +0200 | [diff] [blame] | 170 | "-Wno-newline-eof", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 171 | ] |
| 172 | } |
Jamie Madill | 08fe88a | 2019-01-24 10:55:41 -0500 | [diff] [blame] | 173 | if (is_win && !is_clang) { |
| 174 | cflags = [ |
Corentin Wallez | 9757da4 | 2019-08-26 14:13:54 +0200 | [diff] [blame] | 175 | "/wd4018", # signed/unsigned mismatch |
| 176 | "/wd4189", # local variable is initialized but not referenced |
Jamie Madill | 08fe88a | 2019-01-24 10:55:41 -0500 | [diff] [blame] | 177 | ] |
| 178 | } |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 179 | |
| 180 | deps = [ |
| 181 | "${spirv_tools_dir}:spvtools_opt", |
Shahbaz Youssefi | 741fc4a | 2019-05-16 23:53:15 -0400 | [diff] [blame] | 182 | "${spirv_tools_dir}:spvtools_val", |
Dan Sinclair | 257b25c | 2018-09-24 16:35:44 -0400 | [diff] [blame] | 183 | ] |
Dan Sinclair | b29c58e | 2018-09-24 18:40:38 -0400 | [diff] [blame] | 184 | } |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 185 | |
| 186 | source_set("glslang_default_resource_limits_sources") { |
| 187 | sources = [ |
| 188 | "StandAlone/ResourceLimits.cpp", |
| 189 | "StandAlone/ResourceLimits.h", |
| 190 | ] |
Corentin Wallez | 9757da4 | 2019-08-26 14:13:54 +0200 | [diff] [blame] | 191 | deps = [ |
| 192 | ":glslang_sources", |
| 193 | ] |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 194 | public_configs = [ ":glslang_public" ] |
| 195 | } |
| 196 | |
Jamie Madill | e880e96 | 2019-03-11 15:45:31 -0400 | [diff] [blame] | 197 | executable("glslang_validator") { |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 198 | sources = [ |
| 199 | "StandAlone/DirStackFileIncluder.h", |
| 200 | "StandAlone/StandAlone.cpp", |
| 201 | ] |
| 202 | if (!is_win) { |
| 203 | cflags = [ "-Woverflow" ] |
| 204 | } |
Shahbaz Youssefi | 741fc4a | 2019-05-16 23:53:15 -0400 | [diff] [blame] | 205 | defines = [ "ENABLE_OPT=1" ] |
Jamie Madill | 0ceaebc | 2019-01-18 14:53:31 -0500 | [diff] [blame] | 206 | deps = [ |
| 207 | ":glslang_default_resource_limits_sources", |
| 208 | ":glslang_sources", |
| 209 | ] |
| 210 | } |
David 'Digit' Turner | 1f5799c | 2019-06-21 14:58:30 +0200 | [diff] [blame] | 211 | |
| 212 | executable("spirv-remap") { |
| 213 | sources = [ |
| 214 | "StandAlone/spirv-remap.cpp", |
| 215 | ] |
| 216 | defines = [ "ENABLE_OPT=1" ] |
| 217 | deps = [ |
| 218 | ":glslang_sources", |
| 219 | ] |
| 220 | } |