mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
GN: Fix MSVC compilation
third_party/BUILD.gn was adding compile flags to suppress failures that were GCC/Clang specific and caused MSVC to error out. Replace them by suppression using MSVC's flags. Change-Id: Ia25ae315dcf8904dbfd8eff877065a24e8c88769
This commit is contained in:
parent
a715469b5a
commit
ec72443bf1
22
third_party/BUILD.gn
vendored
22
third_party/BUILD.gn
vendored
@ -15,6 +15,8 @@
|
|||||||
import("../scripts/dawn_overrides_with_defaults.gni")
|
import("../scripts/dawn_overrides_with_defaults.gni")
|
||||||
import("../scripts/dawn_features.gni")
|
import("../scripts/dawn_features.gni")
|
||||||
|
|
||||||
|
is_msvc = is_win && !is_clang
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Third-party dependencies needed by libdawn_native
|
# Third-party dependencies needed by libdawn_native
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -45,11 +47,13 @@ config("spirv_cross_public") {
|
|||||||
static_library("spirv_cross") {
|
static_library("spirv_cross") {
|
||||||
public_configs = [ ":spirv_cross_public" ]
|
public_configs = [ ":spirv_cross_public" ]
|
||||||
|
|
||||||
|
if (!is_msvc) {
|
||||||
cflags_cc = [
|
cflags_cc = [
|
||||||
"-Wno-implicit-fallthrough",
|
"-Wno-implicit-fallthrough",
|
||||||
"-Wno-return-type",
|
"-Wno-return-type",
|
||||||
"-Wno-sign-compare",
|
"-Wno-sign-compare",
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"${spirv_cross_dir}/GLSL.std.450.h",
|
"${spirv_cross_dir}/GLSL.std.450.h",
|
||||||
@ -243,10 +247,20 @@ static_library("glslang_static") {
|
|||||||
"${glslang_dir}/glslang/Public/ShaderLang.h",
|
"${glslang_dir}/glslang/Public/ShaderLang.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (is_msvc) {
|
||||||
|
cflags_cc = [
|
||||||
|
# switch statement contains 'default' but no 'case' labels
|
||||||
|
"/wd4065",
|
||||||
|
|
||||||
|
# local variable is initialized but not referenced
|
||||||
|
"/wd4189",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
cflags_cc = [
|
cflags_cc = [
|
||||||
"-Wno-ignored-qualifiers",
|
"-Wno-ignored-qualifiers",
|
||||||
"-Wno-unused-variable",
|
"-Wno-unused-variable",
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"${spirv_tools_dir}:spvtools_opt",
|
"${spirv_tools_dir}:spvtools_opt",
|
||||||
@ -365,7 +379,12 @@ config("glfw_public") {
|
|||||||
static_library("glfw") {
|
static_library("glfw") {
|
||||||
public_configs = [ ":glfw_public" ]
|
public_configs = [ ":glfw_public" ]
|
||||||
|
|
||||||
|
if (is_msvc) {
|
||||||
|
# nonstandard extension, function/data pointer conversion in expression
|
||||||
|
cflags_c = [ "/wd4152" ]
|
||||||
|
} else {
|
||||||
cflags_c = [ "-Wno-sign-compare" ]
|
cflags_c = [ "-Wno-sign-compare" ]
|
||||||
|
}
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"${glfw_dir}/include/GLFW/glfw3.h",
|
"${glfw_dir}/include/GLFW/glfw3.h",
|
||||||
@ -474,8 +493,11 @@ if (dawn_standalone) {
|
|||||||
# STB
|
# STB
|
||||||
config("stb_public_config") {
|
config("stb_public_config") {
|
||||||
include_dirs = [ "stb" ]
|
include_dirs = [ "stb" ]
|
||||||
|
|
||||||
|
if (!is_msvc) {
|
||||||
cflags_cc = [ "-Wno-implicit-fallthrough" ]
|
cflags_cc = [ "-Wno-implicit-fallthrough" ]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
source_set("stb") {
|
source_set("stb") {
|
||||||
public_configs = [ ":stb_public_config" ]
|
public_configs = [ ":stb_public_config" ]
|
||||||
sources = [
|
sources = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user