Commit 9441b072 by Alexis Hetu Committed by Alexis Hétu

SwiftShader always builds its release version in Chromium

SwiftShader's debug version was too slow for Chromium's debug trybots. To solve this issue, SwiftShader now always builds its release version in Chromium. 'git cl format' was ran in Chromium to ensure proper formatting of the gn files. Change-Id: I346045b68b566813ab6ab739aaa6eeb243d51853 Reviewed-on: https://swiftshader-review.googlesource.com/11188Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 5790c95e
......@@ -31,47 +31,28 @@ config("swiftshader_config") {
"NOMINMAX",
"_WINDLL",
"NO_SANITIZE_FUNCTION=",
"ANGLE_DISABLE_TRACE",
]
if (is_debug) {
cflags += [ "/RTC1" ] # Run-Time Error Checks
} else {
defines += [ "ANGLE_DISABLE_TRACE" ]
}
} else {
cflags = [
"-std=c++11",
"-Wall",
"-fno-exceptions",
"-fno-operator-names",
"-ffunction-sections",
"-fdata-sections",
"-fomit-frame-pointer",
"-Os",
]
defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
"NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
if (is_debug) {
cflags += [
"-g",
"-g3",
]
} else { # Release
# All Release builds use function/data sections to make the shared libraries smaller
cflags += [
"-ffunction-sections",
"-fdata-sections",
"-fomit-frame-pointer",
"-Os",
]
defines += [
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
}
if (target_cpu == "x64") { # 64 bit version
cflags += [
"-m64",
......@@ -91,11 +72,10 @@ config("swiftshader_config") {
"-Wl,--hash-style=both",
"-Wl,--gc-sections",
]
# A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
if (use_gold && target_cpu == "x86") {
ldflags += [
"-Wl,--icf=none",
]
ldflags += [ "-Wl,--icf=none" ]
}
}
}
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_common_private_config") {
if (is_win) {
......@@ -24,7 +26,7 @@ config("swiftshader_common_private_config") {
}
}
source_set("swiftshader_common") {
swiftshader_source_set("swiftshader_common") {
sources = [
"CPUID.cpp",
"Configurator.cpp",
......@@ -38,5 +40,5 @@ source_set("swiftshader_common") {
"Timer.cpp",
]
configs += [ ":swiftshader_common_private_config" ]
configs = [ ":swiftshader_common_private_config" ]
}
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_main_private_config") {
if (is_win) {
......@@ -28,11 +30,12 @@ config("swiftshader_main_private_config") {
}
} else {
cflags = [ "-msse2" ]
defines = [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
defines =
[ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
}
}
source_set("swiftshader_main") {
swiftshader_source_set("swiftshader_main") {
deps = [
"../Common:swiftshader_common",
]
......@@ -59,11 +62,10 @@ source_set("swiftshader_main") {
}
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
libs = [ "dxguid.lib" ] # For FrameBufferDD
}
configs += [ ":swiftshader_main_private_config" ]
configs = [ ":swiftshader_main_private_config" ]
include_dirs = [
"..",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_common_private_config") {
if (is_win) {
......@@ -23,7 +25,7 @@ config("swiftshader_opengl_common_private_config") {
}
}
source_set("swiftshader_opengl_common") {
swiftshader_source_set("swiftshader_opengl_common") {
sources = [
"Image.cpp",
"MatrixStack.cpp",
......@@ -31,7 +33,7 @@ source_set("swiftshader_opengl_common") {
"debug.cpp",
]
configs += [ ":swiftshader_opengl_common_private_config" ]
configs = [ ":swiftshader_opengl_common_private_config" ]
include_dirs = [
"..",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_compiler_private_config") {
if (is_win) {
......@@ -35,7 +37,7 @@ config("swiftshader_opengl_compiler_private_config") {
}
}
source_set("swiftshader_opengl_compiler") {
swiftshader_source_set("swiftshader_opengl_compiler") {
deps = [
"preprocessor:swiftshader_opengl_preprocessor",
]
......@@ -72,7 +74,7 @@ source_set("swiftshader_opengl_compiler") {
sources += [ "ossource_win.cpp" ]
}
configs += [ ":swiftshader_opengl_compiler_private_config" ]
configs = [ ":swiftshader_opengl_compiler_private_config" ]
include_dirs = [
"..",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_preprocessor_private_config") {
if (is_win) {
......@@ -23,7 +25,7 @@ config("swiftshader_opengl_preprocessor_private_config") {
}
}
source_set("swiftshader_opengl_preprocessor") {
swiftshader_source_set("swiftshader_opengl_preprocessor") {
sources = [
"Diagnostics.cpp",
"DirectiveHandler.cpp",
......@@ -38,5 +40,5 @@ source_set("swiftshader_opengl_preprocessor") {
"Tokenizer.cpp",
]
configs += [ ":swiftshader_opengl_preprocessor_private_config" ]
configs = [ ":swiftshader_opengl_preprocessor_private_config" ]
}
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libEGL_private_config") {
defines = [ "EGL_EGLEXT_PROTOTYPES" ]
......@@ -23,22 +25,18 @@ config("swiftshader_libEGL_private_config") {
"/wd5030", # attribute is not recognized
]
defines += [
"EGLAPI=",
]
defines += [ "EGLAPI=" ]
} else {
cflags = [ "-Wno-sign-compare" ]
if (!is_clang) {
cflags += [ "-Wno-unused-but-set-variable" ]
}
defines += [
"EGLAPI=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))",
]
defines += [ "EGLAPI=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))" ]
}
}
shared_library("swiftshader_libEGL") {
swiftshader_shared_library("swiftshader_libEGL") {
if (!is_mac) {
output_name = "libEGL"
output_dir = "$root_out_dir/swiftshader"
......@@ -60,10 +58,6 @@ shared_library("swiftshader_libEGL") {
"resource.h",
]
if (is_debug) {
sources += [ "../common/debug.cpp" ]
}
if (is_mac) {
sources += [ "OSXUtils.mm" ]
libs = [
......@@ -72,7 +66,6 @@ shared_library("swiftshader_libEGL") {
]
ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib" ]
} else if (is_win) {
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) {
sources += [ "../../Main/libX11.cpp" ]
......@@ -80,12 +73,7 @@ shared_library("swiftshader_libEGL") {
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libEGL_private_config",
]
configs = [ ":swiftshader_libEGL_private_config" ]
include_dirs = [
"../../../include",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libGLESv2_private_config") {
defines = [
......@@ -26,9 +28,7 @@ config("swiftshader_libGLESv2_private_config") {
"/wd5030", # attribute is not recognized
]
defines += [
"GL_APICALL=",
]
defines += [ "GL_APICALL=" ]
if (is_clang) {
defines += [
......@@ -50,7 +50,7 @@ config("swiftshader_libGLESv2_private_config") {
}
}
shared_library("swiftshader_libGLESv2") {
swiftshader_shared_library("swiftshader_libGLESv2") {
if (!is_mac) {
output_name = "libGLESv2"
output_dir = "$root_out_dir/swiftshader"
......@@ -89,7 +89,6 @@ shared_library("swiftshader_libGLESv2") {
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_mac) {
ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib" ]
......@@ -98,12 +97,7 @@ shared_library("swiftshader_libGLESv2") {
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libGLESv2_private_config",
]
configs = [ ":swiftshader_libGLESv2_private_config" ]
include_dirs = [
"../../../include",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
declare_args() {
# Currently, Subzero is not used by default
# LLVM is still the default backend
......@@ -153,7 +155,7 @@ config("swiftshader_reactor_private_config") {
}
if (use_swiftshader_with_subzero) {
source_set("swiftshader_subzero") {
swiftshader_source_set("swiftshader_subzero") {
subzero_dir = "../../third_party/subzero"
subzero_llvm_dir = "../../third_party/llvm-subzero"
......@@ -240,17 +242,14 @@ if (use_swiftshader_with_subzero) {
]
}
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
configs += [
configs = [
":swiftshader_subzero_common_private_config",
":swiftshader_subzero_private_config",
]
}
}
source_set("swiftshader_reactor") {
swiftshader_source_set("swiftshader_reactor") {
deps = [
"../OpenGL/common:swiftshader_opengl_common",
]
......@@ -267,7 +266,7 @@ source_set("swiftshader_reactor") {
"SubzeroReactor.cpp",
]
configs += [
configs = [
":swiftshader_subzero_common_private_config",
":swiftshader_reactor_with_subzero_private_config",
]
......@@ -280,7 +279,7 @@ source_set("swiftshader_reactor") {
"LLVMRoutineManager.cpp",
]
configs += [ ":swiftshader_reactor_private_config" ]
configs = [ ":swiftshader_reactor_private_config" ]
include_dirs = [
"..",
......@@ -288,8 +287,4 @@ source_set("swiftshader_reactor") {
"../../third_party/LLVM/include/",
]
}
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
}
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_renderer_private_config") {
if (is_win) {
......@@ -28,7 +30,7 @@ config("swiftshader_renderer_private_config") {
}
}
source_set("swiftshader_renderer") {
swiftshader_source_set("swiftshader_renderer") {
deps = [
"../Shader:swiftshader_shader",
]
......@@ -53,11 +55,7 @@ source_set("swiftshader_renderer") {
"VertexProcessor.cpp",
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
configs += [ ":swiftshader_renderer_private_config" ]
configs = [ ":swiftshader_renderer_private_config" ]
include_dirs = [
".",
......
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_shader_private_config") {
if (is_win) {
......@@ -27,7 +29,7 @@ config("swiftshader_shader_private_config") {
}
}
source_set("swiftshader_shader") {
swiftshader_source_set("swiftshader_shader") {
deps = [
"../Main:swiftshader_main",
]
......@@ -48,7 +50,7 @@ source_set("swiftshader_shader") {
"VertexShader.cpp",
]
configs += [ ":swiftshader_shader_private_config" ]
configs = [ ":swiftshader_shader_private_config" ]
include_dirs = [
".",
......
# Copyright (c) 2017 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.
# This file contains configs that need to be added or removed to all
# SwiftShader libraries
configs_to_add = []
configs_to_delete = []
if (is_win) {
configs_to_delete += [ "//build/config/win:unicode" ]
}
if (is_debug) {
# always build release version of SwiftShader for performance reasons
configs_to_delete += [
"//build/config:debug",
"//build/config/compiler:default_optimization",
]
configs_to_add += [
"//build/config:release",
"//build/config/compiler:optimize_max",
]
if (is_win) {
configs_to_delete += [ "//build/config/win:default_crt" ]
configs_to_add += [ "//build/config/win:release_crt" ]
}
}
configs_to_delete += [ "//build/config/compiler:chromium_code" ]
configs_to_add += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
]
template("swiftshader_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= configs_to_delete
configs += configs_to_add
}
}
template("swiftshader_shared_library") {
shared_library(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= configs_to_delete
configs += configs_to_add
}
}
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../src/swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_llvm_private_config") {
cflags = []
......@@ -73,7 +75,7 @@ config("swiftshader_llvm_private_config") {
]
}
source_set("swiftshader_llvm") {
swiftshader_source_set("swiftshader_llvm") {
sources = [
"lib/Analysis/AliasAnalysis.cpp",
"lib/Analysis/AliasSetTracker.cpp",
......@@ -449,10 +451,7 @@ source_set("swiftshader_llvm") {
"lib/VMCore/Verifier.cpp",
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
configs += [ ":swiftshader_llvm_private_config" ]
configs = [ ":swiftshader_llvm_private_config" ]
include_dirs = [ "lib/Target/X86" ]
......
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