diff --git a/BUILD.gn b/BUILD.gn index 77d596e1..3351fd3e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -33,6 +33,19 @@ import("//build_overrides/glslang.gni") +# Both Chromium and Fuchsia use by default a set of warning errors +# that is far too strict to compile this project. These are also +# typically appended after |cflags|, overriding target-specific +# definitions. To work around this, determine which configs to +# add and remove in order to succesfully build the project. +if (defined(is_fuchsia_tree) && is_fuchsia_tree) { + _configs_to_remove = [ "//build/config:default_warnings" ] + _configs_to_add = [] +} else { + _configs_to_remove = [ "//build/config/compiler:chromium_code" ] + _configs_to_add = [ "//build/config/compiler:no_chromium_code" ] +} + spirv_tools_dir = glslang_spirv_tools_dir config("glslang_public") { @@ -182,8 +195,8 @@ source_set("glslang_sources") { "${spirv_tools_dir}:spvtools_val", ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= _configs_to_remove + configs += _configs_to_add } source_set("glslang_default_resource_limits_sources") { @@ -196,8 +209,8 @@ source_set("glslang_default_resource_limits_sources") { ] public_configs = [ ":glslang_public" ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= _configs_to_remove + configs += _configs_to_add } executable("glslang_validator") { @@ -214,8 +227,8 @@ executable("glslang_validator") { ":glslang_sources", ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= _configs_to_remove + configs += _configs_to_add } executable("spirv-remap") { @@ -227,6 +240,6 @@ executable("spirv-remap") { ":glslang_sources", ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= _configs_to_remove + configs += _configs_to_add }