Skip to content

Commit

Permalink
Move rtti configs from compiler/BUILD.gn to config/BUILD.gn. (flutter#65
Browse files Browse the repository at this point in the history
)
  • Loading branch information
chinmaygarde authored May 10, 2017
1 parent 49dc17e commit daeaaf5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
20 changes: 20 additions & 0 deletions build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,23 @@ config("precompiled_headers") {
cflags = [ "/FI$precompiled_header" ]
}
}

# rtti ------------------------------------------------------------------------
#
# Allows turning Run-Time Type Identification on or off.

config("rtti") {
if (is_win) {
cflags_cc = [ "/GR" ]
}
}

config("no_rtti") {
if (is_win) {
cflags_cc = [ "/GR-" ]
} else {
rtti_flags = [ "-fno-rtti" ]
cflags_cc = rtti_flags
cflags_objcc = rtti_flags
}
}
8 changes: 3 additions & 5 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
# duplication in each target below.
_native_compiler_configs = [
"//build/config:feature_flags",
"//build/config:no_rtti",
"//build/config/compiler:compiler",
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
]
if (is_win) {
Expand Down Expand Up @@ -448,9 +448,7 @@ if (is_fnl) {
}

if (is_clang) {
_native_compiler_configs += [
"//build/config/clang:extra_warnings",
]
_native_compiler_configs += [ "//build/config/clang:extra_warnings" ]
}

# Optimizations and debug checking.
Expand Down Expand Up @@ -617,7 +615,7 @@ if (is_win) {
host_toolchain = "//build/toolchain/mac:clang_x64"
set_default_toolchain(host_toolchain)
} else if (is_ios) {
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
host_toolchain = "//build/toolchain/mac:clang_x64"
if (use_ios_simulator) {
set_default_toolchain("//build/toolchain/mac:ios_clang_x64")
Expand Down
34 changes: 9 additions & 25 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ config("compiler") {
defines += [ "HAVE_SYS_UIO_H" ]

# Use gold for Android for most CPU architectures.
if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || current_cpu == "arm64") {
if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" ||
current_cpu == "arm64") {
ldflags += [ "-fuse-ld=gold" ]
if (is_clang) {
# Let clang find the ld.gold in the NDK.
Expand All @@ -434,7 +435,7 @@ config("compiler") {

ldflags += [
"-Wl,--no-undefined",
"-Wl,--exclude-libs,ALL"
"-Wl,--exclude-libs,ALL",
]
if (current_cpu == "arm") {
ldflags += [
Expand Down Expand Up @@ -573,15 +574,16 @@ config("runtime_library") {
# also require C++14.
# Tracked in https://fuchsia.atlassian.net/browse/TO-61
if (is_linux && current_cpu != "x86") {
cflags_cc += [
"-stdlib=libc++"
]
cflags_cc += [ "-stdlib=libc++" ]
ldflags += [
"-stdlib=libc++",
"-static-libstdc++",

# Remove one the toolchain distribution is fixed
# https://github.com/flutter/flutter/issues/6145
"-Wl,-Bstatic", "-lc++abi", "-Wl,-Bdynamic",
"-Wl,-Bstatic",
"-lc++abi",
"-Wl,-Bdynamic",
"-fuse-ld=lld",
]
}
Expand All @@ -602,6 +604,7 @@ if (is_win) {
default_warning_flags += [
# Permanent.
"/wd4091", # typedef warning from dbghelp.h

# Investigate.
"/wd4312", # int to pointer of greater size conversion.
"/wd4838", # Narrowing conversion required.
Expand Down Expand Up @@ -797,25 +800,6 @@ config("no_chromium_code") {
cflags_cc += default_warning_flags_cc
}

# rtti ------------------------------------------------------------------------
#
# Allows turning Run-Time Type Identification on or off.

config("rtti") {
if (is_win) {
cflags_cc = [ "/GR" ]
}
}
config("no_rtti") {
if (is_win) {
cflags_cc = [ "/GR-" ]
} else {
rtti_flags = [ "-fno-rtti" ]
cflags_cc = rtti_flags
cflags_objcc = rtti_flags
}
}

# Warnings ---------------------------------------------------------------------

# This will generate warnings when using Clang if code generates exit-time
Expand Down

0 comments on commit daeaaf5

Please sign in to comment.