Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
_native_compiler_configs = [
"//build/config:feature_flags",
"//build/config/compiler:compiler",
"//build/config/compiler:cxx_version_default",
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
Expand Down
49 changes: 40 additions & 9 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,6 @@ config("compiler") {

# C++ compiler flags setup.
# -------------------------
if (is_win) {
cc_std = [ "/std:c++14" ]
} else if (is_fuchsia) {
cc_std = [ "-std=c++17" ]
} else {
cc_std = [ "-std=c++14" ]
}
cflags_cc += cc_std
cflags_objcc += cc_std

# Android-specific flags setup.
# -----------------------------
Expand Down Expand Up @@ -459,6 +450,46 @@ config("compiler") {
asmflags = cflags
}

config("cxx_version_default") {
if (is_win) {
cc_std = [ "/std:c++17" ]
} else {
cc_std = [ "-std=c++17" ]
}
cflags_cc = cc_std
cflags_objcc = cc_std
}

config("cxx_version_11") {
if (is_win) {
cc_std = [ "/std:c++11" ]
} else {
cc_std = [ "-std=c++11" ]
}
cflags_cc = cc_std
cflags_objcc = cc_std
}

config("cxx_version_14") {
if (is_win) {
cc_std = [ "/std:c++14" ]
} else {
cc_std = [ "-std=c++14" ]
}
cflags_cc = cc_std
cflags_objcc = cc_std
}

config("cxx_version_17") {
if (is_win) {
cc_std = [ "/std:c++17" ]
} else {
cc_std = [ "-std=c++17" ]
}
cflags_cc = cc_std
cflags_objcc = cc_std
}

config("compiler_arm_fpu") {
if (current_cpu == "arm" && !is_ios) {
cflags = [ "-mfpu=$arm_fpu" ]
Expand Down
5 changes: 5 additions & 0 deletions build/secondary/third_party/libcxxabi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ source_set("libcxxabi") {
# https://github.com/flutter/flutter/issues/24535.
configs -= [ "//build/config/compiler:no_rtti" ]

# Compile libcxx ABI using an older standard. This replicates the rule in the
# CMakeLists on the "cxx_abiobjects" target.
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_11" ]

configs += [
"//build/config/compiler:rtti",
"//third_party/libcxx:libcxx_config",
Expand Down
30 changes: 30 additions & 0 deletions build/secondary/third_party/swiftshader_flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ source_set("compiler") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -87,6 +89,8 @@ source_set("subzero") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -236,6 +240,8 @@ source_set("subzero") {

source_set("reactor") {
configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand All @@ -257,6 +263,8 @@ source_set("renderer") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -291,6 +299,8 @@ source_set("opengl_common") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand All @@ -309,6 +319,8 @@ source_set("common") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand All @@ -332,6 +344,8 @@ source_set("preprocessor") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand All @@ -350,6 +364,8 @@ source_set("opengl_preprocessor") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand All @@ -374,6 +390,8 @@ source_set("opengl_compiler") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -419,6 +437,8 @@ source_set("shader") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -449,6 +469,8 @@ source_set("system") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -481,6 +503,8 @@ source_set("device") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -528,6 +552,8 @@ source_set("main") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -569,6 +595,8 @@ shared_library("egl") {
public = []

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down Expand Up @@ -623,6 +651,8 @@ shared_library("gles") {
}

configs += [ ":internal_config" ]
configs -= [ "//build/config/compiler:cxx_version_default" ]
configs += [ "//build/config/compiler:cxx_version_14" ]

if (is_win) {
configs -= [ "//build/config/win:unicode" ]
Expand Down