Home | History | Annotate | Download | only in compiler
      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 
     15 import("../../swiftshader.gni")
     16 import("//testing/libfuzzer/fuzzer_test.gni")
     17 
     18 # Need a separate config to ensure the warnings are added to the end.
     19 config("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 referenced (variables only used in ASSERTS)
     31     }
     32   } else {
     33     cflags = [ "-Wno-sign-compare" ]
     34 
     35     if (!is_debug) {
     36       cflags += [ "-Wno-unused-variable" ]  # local variable is initialized but not referenced (variables only used in ASSERTS)
     37     }
     38   }
     39 }
     40 
     41 config("swiftshader_translator_disable_pool_alloc") {
     42     defines = [ "SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC" ]
     43 }
     44 
     45 swiftshader_source_set("swiftshader_opengl_compiler") {
     46   deps = [
     47     "preprocessor:swiftshader_opengl_preprocessor",
     48   ]
     49 
     50   sources = [
     51     "AnalyzeCallDepth.cpp",
     52     "Compiler.cpp",
     53     "Diagnostics.cpp",
     54     "DirectiveHandler.cpp",
     55     "InfoSink.cpp",
     56     "Initialize.cpp",
     57     "InitializeParseContext.cpp",
     58     "IntermTraverse.cpp",
     59     "Intermediate.cpp",
     60     "OutputASM.cpp",
     61     "ParseHelper.cpp",
     62     "PoolAlloc.cpp",
     63     "SymbolTable.cpp",
     64     "TranslatorASM.cpp",
     65     "ValidateLimitations.cpp",
     66     "ValidateSwitch.cpp",
     67     "debug.cpp",
     68     "glslang_lex.cpp",
     69     "glslang_tab.cpp",
     70     "intermOut.cpp",
     71     "parseConst.cpp",
     72     "util.cpp",
     73   ]
     74 
     75   if (use_fuzzing_engine) {
     76     all_dependent_configs = [ ":swiftshader_translator_disable_pool_alloc" ]
     77   }
     78 
     79   if (is_linux || is_mac || is_fuchsia) {
     80     sources += [ "ossource_posix.cpp" ]
     81   } else if (is_win) {
     82     sources += [ "ossource_win.cpp" ]
     83   }
     84 
     85   configs = [ ":swiftshader_opengl_compiler_private_config" ]
     86 
     87   include_dirs = [
     88     "..",
     89     "../..",
     90     "../../../include",
     91   ]
     92 }
     93