Remove unnecessary flags from BUILD.gn

The GN build gets many default flags from //build/config. Remove flags that are redundant with the default flags. No intended behavior change (except for the hash style). Bug: chromium:1220175 Change-Id: Idcebc8f55165ae300632005f5cf527ec689a365f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55608Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
parent 43d3e0cc
......@@ -22,32 +22,13 @@ config("swiftshader_config") {
defines = []
if (is_win) {
cflags = [
"/GS", # Detects some buffer overruns
"/Zc:wchar_t",
"/EHs-c-", # Disable C++ exceptions
"/nologo",
"/Gd", # Default calling convention
# Disable MSVC warnings about std::aligned_storage being broken before VS 2017 15.8
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
]
if (!use_custom_libcxx) {
# Disable EH usage in STL headers.
# libc++ uses a predefined macro to control whether to use exceptions, so
# defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
# breaks libc++ because it depends on MSVC headers that only provide
# certain declarations if _HAS_EXCEPTIONS is 1.
defines += [
"_HAS_EXCEPTIONS=0",
]
}
defines += [
"_CRT_SECURE_NO_DEPRECATE",
"NOMINMAX",
"_WINDLL",
"NO_SANITIZE_FUNCTION=",
# Disable MSVC warnings about std::aligned_storage being broken before
# VS 2017 15.8
"_ENABLE_EXTENDED_ALIGNED_STORAGE",
]
if (!is_debug) {
......@@ -58,20 +39,19 @@ config("swiftshader_config") {
if (!is_clang) {
cflags += [
"/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4309", # Truncation of constant value. See PixelRoutine.cpp casts of signed shorts.
"/wd4309", # Truncation of constant value. See PixelRoutine.cpp casts
# of signed shorts.
]
}
cflags_cc = [ "/std:c++17" ]
} else {
cflags = [
"-fno-exceptions",
"-fno-operator-names",
]
cflags = [ "-fno-operator-names" ]
cflags_cc = [ "-std=c++17" ]
# On macOS for the ARM architecture, some C++17 features require version 10.14,
# while Chrome must support 10.11 (El Capitan). However, the first 'Apple Silicon'
# devices launched with macOS 11.0 (Big Sur).
# On macOS for the ARM architecture, some C++17 features require version
# 10.14, while Chrome must support 10.11 (El Capitan). However, the first
# 'Apple Silicon' devices launched with macOS 11.0 (Big Sur).
# TODO(b/174843857): Remove once Chrome demands macOS 10.14.
if (is_mac && current_cpu == "arm64") {
cflags += [
......@@ -81,30 +61,16 @@ config("swiftshader_config") {
]
}
defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
"NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
]
defines +=
[ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
if (is_debug) {
cflags += [
"-g",
"-g3",
]
} else { # Release
# All Release builds use function/data sections to make the shared libraries smaller
if (!is_debug) {
cflags += [
"-ffunction-sections",
"-fdata-sections",
"-fomit-frame-pointer",
"-Os",
]
defines += [
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
defines += [ "ANGLE_DISABLE_TRACE" ]
}
if (current_cpu == "x64") { # 64 bit version
......@@ -131,13 +97,9 @@ config("swiftshader_config") {
"-mxgot",
]
if (mips_arch_variant == "r1") {
cflags += [
"-march=mips32",
]
cflags += [ "-march=mips32" ]
} else {
cflags += [
"-march=mips32r2",
]
cflags += [ "-march=mips32r2" ]
}
} else if (target_cpu == "mips64el" && current_cpu == target_cpu) {
cflags += [
......@@ -150,28 +112,14 @@ config("swiftshader_config") {
}
if (is_linux || is_chromeos) {
ldflags = [ "-Wl,--gc-sections" ]
if (current_cpu == "mipsel") {
ldflags += [
"-Wl,--hash-style=sysv",
]
if (mips_arch_variant == "r1") {
ldflags += [
"-mips32",
]
ldflags += [ "-mips32" ]
} else {
ldflags += [
"-mips32r2",
]
ldflags += [ "-mips32r2" ]
}
} else if (current_cpu == "mips64el") {
ldflags += [
"-Wl,--hash-style=sysv",
"-mips64r2",
]
} else {
ldflags += [ "-Wl,--hash-style=both" ]
ldflags += [ "-mips64r2" ]
}
# A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
......@@ -183,9 +131,7 @@ config("swiftshader_config") {
}
source_set("vertex_routine_fuzzer") {
sources = [
"tests/fuzzers/VertexRoutineFuzzer.cpp"
]
sources = [ "tests/fuzzers/VertexRoutineFuzzer.cpp" ]
if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
......@@ -193,18 +139,14 @@ source_set("vertex_routine_fuzzer") {
"/wd5030", # attribute is not recognized
]
}
include_dirs = [
"src/",
]
deps = [
"src/OpenGL/libGLESv2:swiftshader_libGLESv2_static",
]
include_dirs = [ "src/" ]
deps = [ "src/OpenGL/libGLESv2:swiftshader_libGLESv2_static" ]
}
group("swiftshader") {
data_deps = [
"src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"src/OpenGL/libEGL:swiftshader_libEGL",
"src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
......@@ -218,11 +160,13 @@ if (build_with_chromium) {
]
if (supports_llvm) {
data_deps += [ "tests/ReactorUnitTests:swiftshader_reactor_llvm_unittests" ]
data_deps +=
[ "tests/ReactorUnitTests:swiftshader_reactor_llvm_unittests" ]
}
if (supports_subzero) {
data_deps += [ "tests/ReactorUnitTests:swiftshader_reactor_subzero_unittests" ]
data_deps +=
[ "tests/ReactorUnitTests:swiftshader_reactor_subzero_unittests" ]
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment