# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//testing/test.gni") config("glslang_config") { include_dirs = [ "src" ] defines = [] if (is_linux || is_android) { defines += [ "GLSLANG_OSINCLUDE_UNIX" ] } else if (is_win) { defines += [ "GLSLANG_OSINCLUDE_WIN32" ] } else { assert(false, "Unsupported platform.") } } config("glslang_local_config") { if (is_clang) { cflags = [ "-Wno-logical-op-parentheses", "-Wno-reorder", "-Wno-sign-compare", "-Wno-tautological-constant-out-of-range-compare", ] } } static_library("OGLCompiler") { sources = [ "src/OGLCompilersDLL/InitializeDll.cpp", "src/OGLCompilersDLL/InitializeDll.h", ] all_dependent_configs = [ ":glslang_config" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":glslang_local_config" ] } static_library("SPIRV") { sources = [ "src/SPIRV/GLSL.std.450.h", "src/SPIRV/GlslangToSpv.cpp", "src/SPIRV/GlslangToSpv.h", "src/SPIRV/InReadableOrder.cpp", "src/SPIRV/Logger.cpp", "src/SPIRV/Logger.h", "src/SPIRV/SPVRemapper.cpp", "src/SPIRV/SPVRemapper.h", "src/SPIRV/SpvBuilder.cpp", "src/SPIRV/SpvBuilder.h", "src/SPIRV/disassemble.cpp", "src/SPIRV/disassemble.h", "src/SPIRV/doc.cpp", "src/SPIRV/doc.h", "src/SPIRV/spirv.hpp", "src/SPIRV/spvIR.h", ] all_dependent_configs = [ ":glslang_config" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":glslang_local_config" ] } static_library("glslang-default-resource-limits") { sources = [ "src/StandAlone/ResourceLimits.cpp", ] all_dependent_configs = [ ":glslang_config" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":glslang_local_config" ] } static_library("glslang") { sources = [ "src/glslang/GenericCodeGen/CodeGen.cpp", "src/glslang/GenericCodeGen/Link.cpp", "src/glslang/Include/BaseTypes.h", "src/glslang/Include/Common.h", "src/glslang/Include/ConstantUnion.h", "src/glslang/Include/InfoSink.h", "src/glslang/Include/InitializeGlobals.h", "src/glslang/Include/PoolAlloc.h", "src/glslang/Include/ResourceLimits.h", "src/glslang/Include/ShHandle.h", "src/glslang/Include/Types.h", "src/glslang/Include/arrays.h", "src/glslang/Include/intermediate.h", "src/glslang/Include/revision.h", "src/glslang/MachineIndependent/Constant.cpp", "src/glslang/MachineIndependent/InfoSink.cpp", "src/glslang/MachineIndependent/Initialize.cpp", "src/glslang/MachineIndependent/Initialize.h", "src/glslang/MachineIndependent/IntermTraverse.cpp", "src/glslang/MachineIndependent/Intermediate.cpp", "src/glslang/MachineIndependent/ParseHelper.cpp", "src/glslang/MachineIndependent/ParseHelper.h", "src/glslang/MachineIndependent/PoolAlloc.cpp", "src/glslang/MachineIndependent/RemoveTree.cpp", "src/glslang/MachineIndependent/RemoveTree.h", "src/glslang/MachineIndependent/Scan.cpp", "src/glslang/MachineIndependent/Scan.h", "src/glslang/MachineIndependent/ScanContext.h", "src/glslang/MachineIndependent/ShaderLang.cpp", "src/glslang/MachineIndependent/SymbolTable.cpp", "src/glslang/MachineIndependent/SymbolTable.h", "src/glslang/MachineIndependent/Versions.cpp", "src/glslang/MachineIndependent/Versions.h", "src/glslang/MachineIndependent/gl_types.h", "src/glslang/MachineIndependent/glslang.y", "src/glslang/MachineIndependent/glslang_tab.cpp", "src/glslang/MachineIndependent/glslang_tab.cpp.h", "src/glslang/MachineIndependent/intermOut.cpp", "src/glslang/MachineIndependent/limits.cpp", "src/glslang/MachineIndependent/linkValidate.cpp", "src/glslang/MachineIndependent/localintermediate.h", "src/glslang/MachineIndependent/parseConst.cpp", "src/glslang/MachineIndependent/parseVersions.h", "src/glslang/MachineIndependent/preprocessor/Pp.cpp", "src/glslang/MachineIndependent/preprocessor/PpAtom.cpp", "src/glslang/MachineIndependent/preprocessor/PpContext.cpp", "src/glslang/MachineIndependent/preprocessor/PpContext.h", "src/glslang/MachineIndependent/preprocessor/PpMemory.cpp", "src/glslang/MachineIndependent/preprocessor/PpScanner.cpp", "src/glslang/MachineIndependent/preprocessor/PpSymbols.cpp", "src/glslang/MachineIndependent/preprocessor/PpTokens.cpp", "src/glslang/MachineIndependent/preprocessor/PpTokens.h", "src/glslang/MachineIndependent/propagateNoContraction.cpp", "src/glslang/MachineIndependent/propagateNoContraction.h", "src/glslang/MachineIndependent/reflection.cpp", "src/glslang/MachineIndependent/reflection.h", "src/glslang/Public/ShaderLang.h", ] if (is_linux || is_android) { sources += [ "src/glslang/OSDependent/Unix/ossource.cpp" ] } else if (is_win) { sources += [ "src/glslang/OSDependent/Windows/main.cpp", "src/glslang/OSDependent/Windows/ossource.cpp", ] } else { assert(false, "Unsupported platform.") } all_dependent_configs = [ ":glslang_config" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":glslang_local_config" ] } static_library("HLSL") { sources = [ "src/hlsl/hlslGrammar.cpp", "src/hlsl/hlslGrammar.h", "src/hlsl/hlslOpMap.cpp", "src/hlsl/hlslOpMap.h", "src/hlsl/hlslParseHelper.cpp", "src/hlsl/hlslParseHelper.h", "src/hlsl/hlslParseables.cpp", "src/hlsl/hlslParseables.h", "src/hlsl/hlslScanContext.cpp", "src/hlsl/hlslScanContext.h", "src/hlsl/hlslTokenStream.cpp", "src/hlsl/hlslTokenStream.h", "src/hlsl/hlslTokens.h", ] all_dependent_configs = [ ":glslang_config" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":glslang_local_config" ] } test("glslang_test") { sources = [ "src/gtests/AST.FromFile.cpp", "src/gtests/BuiltInResource.FromFile.cpp", "src/gtests/Initializer.h", "src/gtests/Pp.FromFile.cpp", "src/gtests/Settings.cpp", "src/gtests/Settings.h", "src/gtests/Spv.FromFile.cpp", "src/gtests/TestFixture.cpp", "src/gtests/TestFixture.h", "src/gtests/main.cpp", ] defines = [ "GLSLANG_TEST_DIRECTORY=\"" + rebase_path("src/Test") + "\"" ] deps = [ ":HLSL", ":OGLCompiler", ":SPIRV", ":glslang", ":glslang-default-resource-limits", "//base/test:test_support", "//testing/gmock", "//testing/gtest", ] }