"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",
"-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" ]
}
}
}
# 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) {
}
}
-source_set("swiftshader_common") {
+swiftshader_source_set("swiftshader_common") {
sources = [
"CPUID.cpp",
"Configurator.cpp",
"Timer.cpp",
]
- configs += [ ":swiftshader_common_private_config" ]
+ configs = [ ":swiftshader_common_private_config" ]
}
# 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) {
}
} 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",
]
}
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 = [
"..",
# 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) {
}
}
-source_set("swiftshader_opengl_common") {
+swiftshader_source_set("swiftshader_opengl_common") {
sources = [
"Image.cpp",
"MatrixStack.cpp",
"debug.cpp",
]
- configs += [ ":swiftshader_opengl_common_private_config" ]
+ configs = [ ":swiftshader_opengl_common_private_config" ]
include_dirs = [
"..",
# 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) {
}
}
-source_set("swiftshader_opengl_compiler") {
+swiftshader_source_set("swiftshader_opengl_compiler") {
deps = [
"preprocessor:swiftshader_opengl_preprocessor",
]
sources += [ "ossource_win.cpp" ]
}
- configs += [ ":swiftshader_opengl_compiler_private_config" ]
+ configs = [ ":swiftshader_opengl_compiler_private_config" ]
include_dirs = [
"..",
# 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) {
}
}
-source_set("swiftshader_opengl_preprocessor") {
+swiftshader_source_set("swiftshader_opengl_preprocessor") {
sources = [
"Diagnostics.cpp",
"DirectiveHandler.cpp",
"Tokenizer.cpp",
]
- configs += [ ":swiftshader_opengl_preprocessor_private_config" ]
+ configs = [ ":swiftshader_opengl_preprocessor_private_config" ]
}
# 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" ]
"/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"
"resource.h",
]
- if (is_debug) {
- sources += [ "../common/debug.cpp" ]
- }
-
if (is_mac) {
sources += [ "OSXUtils.mm" ]
libs = [
]
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" ]
[ "-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",
# 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 = [
"/wd5030", # attribute is not recognized
]
- defines += [
- "GL_APICALL=",
- ]
+ defines += [ "GL_APICALL=" ]
if (is_clang) {
defines += [
}
}
-shared_library("swiftshader_libGLESv2") {
+swiftshader_shared_library("swiftshader_libGLESv2") {
if (!is_mac) {
output_name = "libGLESv2"
output_dir = "$root_out_dir/swiftshader"
]
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" ]
[ "-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",
# 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
}
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"
]
}
- 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",
]
"SubzeroReactor.cpp",
]
- configs += [
+ configs = [
":swiftshader_subzero_common_private_config",
":swiftshader_reactor_with_subzero_private_config",
]
"LLVMRoutineManager.cpp",
]
- configs += [ ":swiftshader_reactor_private_config" ]
+ configs = [ ":swiftshader_reactor_private_config" ]
include_dirs = [
"..",
"../../third_party/LLVM/include/",
]
}
-
- if (is_win) {
- configs -= [ "//build/config/win:unicode" ]
- }
}
# 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) {
}
}
-source_set("swiftshader_renderer") {
+swiftshader_source_set("swiftshader_renderer") {
deps = [
"../Shader:swiftshader_shader",
]
"VertexProcessor.cpp",
]
- if (is_win) {
- configs -= [ "//build/config/win:unicode" ]
- }
-
- configs += [ ":swiftshader_renderer_private_config" ]
+ configs = [ ":swiftshader_renderer_private_config" ]
include_dirs = [
".",
# 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) {
}
}
-source_set("swiftshader_shader") {
+swiftshader_source_set("swiftshader_shader") {
deps = [
"../Main:swiftshader_main",
]
"VertexShader.cpp",
]
- configs += [ ":swiftshader_shader_private_config" ]
+ configs = [ ":swiftshader_shader_private_config" ]
include_dirs = [
".",
--- /dev/null
+# 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
+ }
+}
# 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 = []
]
}
-source_set("swiftshader_llvm") {
+swiftshader_source_set("swiftshader_llvm") {
sources = [
"lib/Analysis/AliasAnalysis.cpp",
"lib/Analysis/AliasSetTracker.cpp",
"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" ]