Fix GN/Chromium build.
This fixes the GN header check with Yarn. Enables further ANGLE
integration. Also fixes a number of MSVC build errors and changes
the output name of the Vulkan ICD on Windows to "vk_swiftshader"
so that it matches the .def file used in CMake.
Bug: angleproject:3876
Bug: b/140251624
Change-Id: Ie23ba965a2ee7f8b678499db22d6614f0a6666fa
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/36009
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 329ad01..212afb2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -51,6 +51,13 @@
if (!is_debug) {
defines += [ "ANGLE_DISABLE_TRACE" ]
}
+
+ # Diable some MSVC warnings.
+ if (!is_clang) {
+ cflags += [
+ "/wd4309", # Truncation of constant value. See PixelRoutine.cpp casts of signed shorts.
+ ]
+ }
} else {
cflags = [
"-std=c++11",
diff --git a/src/Reactor/BUILD.gn b/src/Reactor/BUILD.gn
index ccde7db..b472d81 100644
--- a/src/Reactor/BUILD.gn
+++ b/src/Reactor/BUILD.gn
@@ -25,8 +25,11 @@
config("swiftshader_reactor_private_config") {
if (is_win) {
cflags = [
+ "/wd4141", # 'inline' used more than once. (LLVM 7.0)
+ "/wd4146", # unary minus operator applied to unsigned type. (LLVM 7.0)
"/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm)
+ "/wd4624", # destructor was implicitly defined as deleted (LLVM 7.0)
]
} else {
cflags = [ "-Wno-unused-local-typedef" ]
diff --git a/src/Vulkan/BUILD.gn b/src/Vulkan/BUILD.gn
index 23d0f03..673bf8d 100644
--- a/src/Vulkan/BUILD.gn
+++ b/src/Vulkan/BUILD.gn
@@ -36,10 +36,12 @@
defines = [ "VK_EXPORT=" ]
}
- cflags = [
- "-Wno-unused-private-field",
- "-Wno-switch",
- ]
+ if (is_clang) {
+ cflags = [
+ "-Wno-unused-private-field",
+ "-Wno-switch",
+ ]
+ }
}
swiftshader_source_set("swiftshader_libvulkan_headers") {
@@ -120,7 +122,12 @@
configs = [ ":swiftshader_libvulkan_private_config" ]
- output_name = "libvk_swiftshader"
+ # TODO(capn): Use the same ICD name on both Windows and non-Windows.
+ if (is_win) {
+ output_name = "vk_swiftshader"
+ } else {
+ output_name = "libvk_swiftshader"
+ }
if (!is_fuchsia) {
# NOTE: Work-around for http://crbug.com/1000668
output_dir = "$root_out_dir/swiftshader"
diff --git a/src/Yarn/BUILD.gn b/src/Yarn/BUILD.gn
index fa7388a..2718ad1 100644
--- a/src/Yarn/BUILD.gn
+++ b/src/Yarn/BUILD.gn
@@ -42,6 +42,14 @@
if (is_win) {
sources += [ "OSFiber_windows.hpp" ]
+ } else {
+ sources += [
+ "OSFiber_asm.hpp",
+ "OSFiber_asm_aarch64.h",
+ "OSFiber_asm_arm.h",
+ "OSFiber_asm_x64.h",
+ "OSFiber_asm_x86.h",
+ ]
}
public_configs = [
@@ -61,15 +69,10 @@
sources += [
"OSFiber_aarch64.c",
"OSFiber_arm.c",
- "OSFiber_asm.hpp",
"OSFiber_asm_aarch64.S",
- "OSFiber_asm_aarch64.h",
"OSFiber_asm_arm.S",
- "OSFiber_asm_arm.h",
"OSFiber_asm_x64.S",
- "OSFiber_asm_x64.h",
"OSFiber_asm_x86.S",
- "OSFiber_asm_x86.h",
"OSFiber_x64.c",
"OSFiber_x86.c",
]
@@ -97,4 +100,11 @@
"//testing/gtest",
"//testing/gmock",
]
+
+ if (!swiftshader_standalone) {
+ deps += [
+ "//third_party/googletest:gmock",
+ "//third_party/googletest:gtest",
+ ]
+ }
}
diff --git a/third_party/llvm-7.0/BUILD.gn b/third_party/llvm-7.0/BUILD.gn
index b51e2cf..08ec2b0 100644
--- a/third_party/llvm-7.0/BUILD.gn
+++ b/third_party/llvm-7.0/BUILD.gn
@@ -22,6 +22,7 @@
cflags += [
"/wd4005",
"/wd4065",
+ "/wd4141",
"/wd4146",
"/wd4245",
"/wd4267",
@@ -35,6 +36,8 @@
"/wd4703",
"/wd4706",
"/wd4800",
+ "/wd4805",
+ "/wd4828",
]
if (!is_debug) {
@@ -55,23 +58,22 @@
}
if (is_clang) {
- cflags += [ "-Wno-header-hygiene" ]
+ cflags += [
+ "-Wno-attributes",
+ "-Wno-deprecated-declarations",
+ "-Wno-enum-compare",
+ "-Wno-header-hygiene",
+ "-Wno-unused-function",
+ "-Wno-unused-local-typedef",
+ "-Wno-unused-private-field",
+ "-Wno-unused-result",
+ "-Wno-unused-variable",
+ ]
if (target_cpu == "x86" || target_cpu == "x64") {
cflags += [ "-msse2" ]
}
}
- cflags += [
- "-Wno-attributes",
- "-Wno-deprecated-declarations",
- "-Wno-enum-compare",
- "-Wno-unused-function",
- "-Wno-unused-local-typedef",
- "-Wno-unused-private-field",
- "-Wno-unused-result",
- "-Wno-unused-variable",
- ]
-
defines = [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",