Fix our GN files to build pure objcc targets correctly
This looks like a no-op, because we're just moving flags from cflags_cc to cflags_objcc, and then removing cflags_cc from the compiler command. However: GN is very specific about which flags it expects to be used by the toolchain for each file type. It ONLY emits cflags_cc into ninja files if there is at least one C++ source file in the target. If we had a target that only contained .mm source files, cflags_cc would be empty and the various flags it contains would be missing. Note that ninja silently leaves undefined variables as empty, making this not obvious. Bug: skia:13272 Change-Id: I8d729699b1bd34b677ec1b657bc34111fa8db2a4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534763 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
a02b226410
commit
b58792947c
@ -52,6 +52,7 @@ config("default") {
|
||||
cflags = []
|
||||
cflags_c = []
|
||||
cflags_cc = []
|
||||
cflags_objcc = []
|
||||
defines = []
|
||||
ldflags = []
|
||||
libs = []
|
||||
@ -335,6 +336,8 @@ config("default") {
|
||||
cflags_cc += [ "-fno-aligned-allocation" ]
|
||||
}
|
||||
}
|
||||
|
||||
cflags_objcc += cflags_cc
|
||||
}
|
||||
|
||||
# See skia:9731.
|
||||
@ -346,6 +349,7 @@ config("no_exceptions") {
|
||||
# Exceptions are disabled by default on Windows. (Use /EHsc to enable them.)
|
||||
if (!is_win) {
|
||||
cflags_cc = [ "-fno-exceptions" ]
|
||||
cflags_objcc = cflags_cc
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,6 +543,8 @@ config("warnings") {
|
||||
"-Wdeprecated-writable-str",
|
||||
]
|
||||
}
|
||||
|
||||
cflags_objcc += cflags_cc
|
||||
}
|
||||
config("warnings_for_public_headers") {
|
||||
if (is_clang) {
|
||||
@ -584,6 +590,7 @@ config("no_rtti") {
|
||||
cflags_cc = [ "/GR-" ]
|
||||
} else {
|
||||
cflags_cc = [ "-fno-rtti" ]
|
||||
cflags_objcc = cflags_cc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ template("gcc_like_toolchain") {
|
||||
|
||||
tool("objcxx") {
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc_wrapper $cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
||||
command = "$cc_wrapper $cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
outputs =
|
||||
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
||||
|
Loading…
Reference in New Issue
Block a user