1# Copyright 2016 The SwiftShader Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("${skia_root_dir}/testing/libfuzzer/fuzzer_test.gni") 16import("../../swiftshader.gni") 17 18# Need a separate config to ensure the warnings are added to the end. 19config("swiftshader_opengl_compiler_private_config") { 20 if (is_win) { 21 cflags = [ 22 "/wd4005", # macro redefinition (in autogenerated code) 23 "/wd4201", # nameless struct/union 24 "/wd4267", # conversion from size_t to int/unsigned int 25 "/wd4702", # unreachable code (in autogenerated code) 26 "/wd5030", # attribute is not recognized 27 ] 28 29 if (!is_debug) { 30 cflags += [ "/wd4189" ] # local variable is initialized but not 31 # referenced (variables only used in ASSERTS) 32 } 33 } else { 34 cflags = [ "-Wno-sign-compare" ] 35 36 if (!is_debug) { 37 cflags += [ "-Wno-unused-variable" ] # local variable is initialized but 38 # not referenced (variables only 39 # used in ASSERTS) 40 } 41 } 42} 43 44config("swiftshader_translator_disable_pool_alloc") { 45 defines = [ "SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC" ] 46} 47 48swiftshader_source_set("swiftshader_opengl_compiler") { 49 deps = [ "preprocessor:swiftshader_opengl_preprocessor" ] 50 51 sources = [ 52 "AnalyzeCallDepth.cpp", 53 "Compiler.cpp", 54 "Diagnostics.cpp", 55 "DirectiveHandler.cpp", 56 "InfoSink.cpp", 57 "Initialize.cpp", 58 "InitializeParseContext.cpp", 59 "IntermTraverse.cpp", 60 "Intermediate.cpp", 61 "OutputASM.cpp", 62 "ParseHelper.cpp", 63 "PoolAlloc.cpp", 64 "SymbolTable.cpp", 65 "TranslatorASM.cpp", 66 "ValidateLimitations.cpp", 67 "ValidateSwitch.cpp", 68 "debug.cpp", 69 "glslang_lex.cpp", 70 "glslang_tab.cpp", 71 "intermOut.cpp", 72 "parseConst.cpp", 73 "util.cpp", 74 ] 75 76 if (use_fuzzing_engine) { 77 all_dependent_configs = [ ":swiftshader_translator_disable_pool_alloc" ] 78 public_configs = [ ":swiftshader_translator_disable_pool_alloc" ] 79 } 80 81 if (is_linux || is_chromeos || is_mac || is_fuchsia) { 82 sources += [ "ossource_posix.cpp" ] 83 } else if (is_win) { 84 sources += [ "ossource_win.cpp" ] 85 } 86 87 configs = [ ":swiftshader_opengl_compiler_private_config" ] 88 89 include_dirs = [ 90 "..", 91 "../..", 92 "../../../include", 93 ] 94} 95