1 # Copyright 2016 The SwiftShader Authors. All Rights Reserved.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 import("//build/config/c++/c++.gni")
16 import("//build/config/compiler/compiler.gni")
17 import("//build/config/mips.gni")
19 config("swiftshader_config") {
24 "/GS", # Detects some buffer overruns
26 "/EHs-c-", # Disable C++ exceptions
28 "/Gd", # Default calling convention
31 if (!use_custom_libcxx) {
32 # Disable EH usage in STL headers.
33 # libc++ uses a predefined macro to control whether to use exceptions, so
34 # defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
35 # breaks libc++ because it depends on MSVC headers that only provide
36 # certain declarations if _HAS_EXCEPTIONS is 1.
43 "_CRT_SECURE_NO_DEPRECATE",
46 "NO_SANITIZE_FUNCTION=",
50 defines += [ "ANGLE_DISABLE_TRACE" ]
56 "-fno-operator-names",
60 "__STDC_CONSTANT_MACROS",
61 "__STDC_LIMIT_MACROS",
62 "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
71 # All Release builds use function/data sections to make the shared libraries smaller
73 "-ffunction-sections",
75 "-fomit-frame-pointer",
80 "ANGLE_DISABLE_TRACE",
85 if (target_cpu == "x64") { # 64 bit version
92 } else if (target_cpu == "x86") { # 32 bit version
100 } else if (target_cpu == "mipsel" && current_cpu == target_cpu) {
107 if (mips_arch_variant == "r1") {
116 } else if (target_cpu == "mips64el" && current_cpu == target_cpu) {
126 ldflags = [ "-Wl,--gc-sections" ]
128 if (target_cpu == "mipsel") {
130 "-Wl,--hash-style=sysv",
132 if (mips_arch_variant == "r1") {
141 } else if (target_cpu == "mips64el") {
143 "-Wl,--hash-style=sysv",
147 ldflags += [ "-Wl,--hash-style=both" ]
150 # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
151 if (use_gold && (target_cpu == "x86" || target_cpu == "mipsel")) {
152 ldflags += [ "-Wl,--icf=none" ]
158 source_set("vertex_routine_fuzzer") {
160 "tests/fuzzers/VertexRoutineFuzzer.cpp"
164 "/wd4201", # nameless struct/union
165 "/wd4065", # switch statement contains 'default' but no 'case' labels
166 "/wd5030", # attribute is not recognized
173 "src/OpenGL/libGLESv2:swiftshader_libGLESv2_static",
177 group("swiftshader") {
179 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
180 "src/OpenGL/libEGL:swiftshader_libEGL",
184 group("swiftshader_tests") {
188 "tests/GLESUnitTests:swiftshader_unittests",