From 07292efd31986a9063f58dfcca234c831f213687 Mon Sep 17 00:00:00 2001 From: Niranjan YArdi Date: Mon, 25 Mar 2024 11:25:49 -0700 Subject: [PATCH] Refactor tvos config, cpp20 config Change-Id: I898f97286bc15229b8c8ce0f9670614ff0d4d274 --- starboard/build/config/BUILD.gn | 21 +++++++++++++++++++++ starboard/build/config/mac/BUILD.gn | 2 -- starboard/nplb/compiler_compliance/BUILD.gn | 11 +---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/starboard/build/config/BUILD.gn b/starboard/build/config/BUILD.gn index 42d6c08b2e12..7315bff6e738 100644 --- a/starboard/build/config/BUILD.gn +++ b/starboard/build/config/BUILD.gn @@ -252,4 +252,25 @@ config("default_cpp_standard") { if (is_host_win && !sb_is_modular) { cflags = [ "/std:c++17" ] } + + if (is_apple) { + cflags_cc = [ "-std=gnu++17" ] + cflags_objcc = [ "-std=gnu++17" ] + } +} + +config("cpp20_supported_config") { + if ((sb_is_modular && current_toolchain == cobalt_toolchain) || is_android) { + cflags_cc = [ "-std=c++20" ] + } + + # These flags apply to non-modular windows platforms which includes win32, xb1. + if (is_host_win && !sb_is_modular) { + cflags = [ "/std:c++20" ] + } + + if (is_apple) { + cflags_cc = [ "-std=gnu++20" ] + cflags_objcc = [ "-std=gnu++20" ] + } } diff --git a/starboard/build/config/mac/BUILD.gn b/starboard/build/config/mac/BUILD.gn index c69eaf2a32f4..6bf4ccfcf191 100644 --- a/starboard/build/config/mac/BUILD.gn +++ b/starboard/build/config/mac/BUILD.gn @@ -43,8 +43,6 @@ config("host") { config("common") { arflags = [ "-no_warning_for_no_symbols" ] - cflags_cc = [ "-std=gnu++17" ] - cflags_objcc = [ "-std=gnu++17" ] cflags = [ "-fno-common" ] asmflags = [ "-fno-common" ] ldflags = [ "-fno-common" ] diff --git a/starboard/nplb/compiler_compliance/BUILD.gn b/starboard/nplb/compiler_compliance/BUILD.gn index 63375ccaeb08..38dcd9fea97a 100644 --- a/starboard/nplb/compiler_compliance/BUILD.gn +++ b/starboard/nplb/compiler_compliance/BUILD.gn @@ -54,15 +54,6 @@ if (sb_enable_cpp20_audit) { # We do this to ensure the -std=c++20 flag is added after any other -std flag # so it overrides any other one. group("cpp20_supported_config_shim") { - public_configs = [ ":cpp20_supported_config" ] - } - - config("cpp20_supported_config") { - # These flags apply to non-modular windows platforms which includes win32, xb1. - if (is_host_win && !sb_is_modular) { - cflags_cc = [ "/std:c++20" ] - } else { - cflags_cc = [ "-std=c++20" ] - } + public_configs = [ "//starboard/build/config:cpp20_supported_config" ] } }