2016-07-21 19:25:45 +00:00
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
declare_args() {
|
2017-03-28 19:45:41 +00:00
|
|
|
extra_asmflags = []
|
2016-10-04 21:09:13 +00:00
|
|
|
extra_cflags = []
|
|
|
|
extra_cflags_c = []
|
|
|
|
extra_cflags_cc = []
|
|
|
|
extra_ldflags = []
|
2016-08-26 20:43:19 +00:00
|
|
|
|
2016-12-09 00:00:40 +00:00
|
|
|
malloc = ""
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
2016-10-24 20:49:15 +00:00
|
|
|
|
2016-11-03 18:06:31 +00:00
|
|
|
if (is_ios) {
|
2017-03-14 20:22:32 +00:00
|
|
|
if (is_tvos) {
|
|
|
|
sdk = "appletvos"
|
|
|
|
if (target_cpu == "x86" || target_cpu == "x64") {
|
|
|
|
sdk = "appletvsimulator"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sdk = "iphoneos"
|
|
|
|
if (target_cpu == "x86" || target_cpu == "x64") {
|
|
|
|
sdk = "iphonesimulator"
|
|
|
|
}
|
2017-03-13 16:25:33 +00:00
|
|
|
}
|
|
|
|
ios_sysroot = exec_script("find_ios_sysroot.py", [ sdk ], "trim string")
|
2016-11-03 18:06:31 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("default") {
|
|
|
|
asmflags = []
|
|
|
|
cflags = []
|
|
|
|
cflags_c = []
|
|
|
|
cflags_cc = []
|
|
|
|
defines = []
|
|
|
|
ldflags = []
|
2016-12-09 00:00:40 +00:00
|
|
|
libs = []
|
2016-09-16 21:44:18 +00:00
|
|
|
|
|
|
|
if (is_win) {
|
|
|
|
cflags += [
|
2016-09-16 20:29:57 +00:00
|
|
|
"/bigobj", # Some of our files are bigger than the regular limits.
|
2016-10-13 03:58:06 +00:00
|
|
|
"/WX", # Treat warnings as errors.
|
2017-01-03 22:09:59 +00:00
|
|
|
"/utf-8", # Set Source and Executable character sets to UTF-8.
|
2016-09-16 20:29:57 +00:00
|
|
|
]
|
2017-07-31 20:35:17 +00:00
|
|
|
if (is_clang) {
|
|
|
|
cflags += [ "-fms-compatibility-version=19" ] # 2015
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
defines += [
|
2016-10-13 03:58:06 +00:00
|
|
|
"_CRT_SECURE_NO_WARNINGS", # Disables warnings about sscanf().
|
|
|
|
"_HAS_EXCEPTIONS=0", # Disables exceptions in MSVC STL.
|
2016-09-16 21:44:18 +00:00
|
|
|
"WIN32_LEAN_AND_MEAN",
|
|
|
|
"NOMINMAX",
|
2016-09-16 20:29:57 +00:00
|
|
|
]
|
2017-07-31 19:46:47 +00:00
|
|
|
|
2017-12-06 18:26:38 +00:00
|
|
|
if (msvc == 2015) {
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
_include_dirs = [ "$win_vc/include" ]
|
2017-12-06 20:21:44 +00:00
|
|
|
} else { # 2017
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
_include_dirs = [ "$win_vc/Tools/MSVC/$win_toolchain_version/include" ]
|
2017-12-06 21:51:23 +00:00
|
|
|
}
|
2017-12-06 20:21:44 +00:00
|
|
|
_include_dirs += [
|
|
|
|
"$win_sdk/Include/$win_sdk_version/shared",
|
|
|
|
"$win_sdk/Include/$win_sdk_version/ucrt",
|
|
|
|
"$win_sdk/Include/$win_sdk_version/um",
|
|
|
|
"$win_sdk/Include/$win_sdk_version/winrt",
|
|
|
|
]
|
|
|
|
|
2017-07-31 19:46:47 +00:00
|
|
|
if (is_clang) {
|
|
|
|
foreach(dir, _include_dirs) {
|
|
|
|
cflags += [
|
|
|
|
"-imsvc",
|
|
|
|
dir,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
include_dirs = _include_dirs
|
|
|
|
}
|
|
|
|
|
2017-12-06 20:21:44 +00:00
|
|
|
lib_dirs = [
|
|
|
|
"$win_sdk/Lib/$win_sdk_version/ucrt/$target_cpu",
|
|
|
|
"$win_sdk/Lib/$win_sdk_version/um/$target_cpu",
|
|
|
|
]
|
2017-12-06 18:26:38 +00:00
|
|
|
if (msvc == 2015) {
|
|
|
|
if (target_cpu == "x86") {
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
lib_dirs += [ "$win_vc/lib" ]
|
2017-12-06 18:26:38 +00:00
|
|
|
} else {
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
lib_dirs += [ "$win_vc/lib/amd64" ]
|
2017-12-06 18:26:38 +00:00
|
|
|
}
|
2017-12-06 20:21:44 +00:00
|
|
|
} else { # 2017
|
|
|
|
lib_dirs +=
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
[ "$win_vc/Tools/MSVC/$win_toolchain_version/lib/$target_cpu" ]
|
2016-10-13 02:42:55 +00:00
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
} else {
|
|
|
|
cflags += [
|
2016-09-16 20:29:57 +00:00
|
|
|
"-fstrict-aliasing",
|
|
|
|
"-fPIC",
|
|
|
|
"-Werror",
|
2016-08-25 21:50:44 +00:00
|
|
|
]
|
2017-04-07 03:04:42 +00:00
|
|
|
cflags_cc += [ "-std=c++11" ]
|
2017-03-27 00:11:48 +00:00
|
|
|
|
|
|
|
# The main idea is to slim the exported API, but these flags also improve link time on Mac.
|
|
|
|
# These would make stack traces worse on Linux, so we don't just set them willy-nilly.
|
2017-03-28 18:16:22 +00:00
|
|
|
if (is_component_build || is_ios || is_mac) {
|
2017-03-27 00:11:48 +00:00
|
|
|
cflags += [ "-fvisibility=hidden" ]
|
|
|
|
cflags_cc += [ "-fvisibility-inlines-hidden" ]
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (current_cpu == "arm") {
|
|
|
|
cflags += [
|
|
|
|
"-march=armv7-a",
|
|
|
|
"-mfpu=neon",
|
|
|
|
"-mthumb",
|
|
|
|
]
|
2016-10-12 23:36:09 +00:00
|
|
|
} else if (current_cpu == "x86" && !is_win) {
|
2016-09-16 21:44:18 +00:00
|
|
|
asmflags += [ "-m32" ]
|
|
|
|
cflags += [
|
|
|
|
"-m32",
|
|
|
|
"-msse2",
|
|
|
|
"-mfpmath=sse",
|
|
|
|
]
|
|
|
|
ldflags += [ "-m32" ]
|
|
|
|
}
|
|
|
|
|
2016-12-09 00:00:40 +00:00
|
|
|
if (malloc != "" && !is_win) {
|
|
|
|
cflags += [
|
|
|
|
"-fno-builtin-malloc",
|
|
|
|
"-fno-builtin-calloc",
|
|
|
|
"-fno-builtin-realloc",
|
|
|
|
"-fno-builtin-free",
|
|
|
|
]
|
|
|
|
libs += [ malloc ]
|
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
if (is_android) {
|
2017-06-27 15:55:05 +00:00
|
|
|
asmflags += [ "--target=$ndk_target" ]
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags += [
|
2017-06-27 15:55:05 +00:00
|
|
|
"--sysroot=$ndk/sysroot",
|
|
|
|
"-isystem$ndk/sysroot/usr/include/$ndk_target",
|
|
|
|
"-D__ANDROID_API__=$ndk_api",
|
2016-09-16 21:44:18 +00:00
|
|
|
"--target=$ndk_target",
|
|
|
|
]
|
|
|
|
cflags_cc += [
|
2018-01-08 22:16:00 +00:00
|
|
|
"-isystem$ndk/sources/cxx-stl/llvm-libc++/include",
|
|
|
|
"-isystem$ndk/sources/cxx-stl/llvm-libc++abi/include",
|
2016-09-16 21:44:18 +00:00
|
|
|
"-isystem$ndk/sources/android/support/include",
|
|
|
|
]
|
|
|
|
ldflags += [
|
|
|
|
"--sysroot=$ndk/platforms/$ndk_platform",
|
|
|
|
"--target=$ndk_target",
|
|
|
|
"-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
|
|
|
|
]
|
|
|
|
lib_dirs = [
|
2018-01-08 22:16:00 +00:00
|
|
|
"$ndk/sources/cxx-stl/llvm-libc++/libs/$ndk_stdlib",
|
2016-09-16 21:44:18 +00:00
|
|
|
"$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.9.x",
|
|
|
|
]
|
|
|
|
|
2018-01-08 22:16:00 +00:00
|
|
|
libs += [
|
|
|
|
"c++_static",
|
|
|
|
"c++abi",
|
|
|
|
"android_support",
|
|
|
|
]
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
2016-11-03 18:06:31 +00:00
|
|
|
if (is_ios) {
|
2017-01-23 16:58:53 +00:00
|
|
|
_target = target_cpu
|
|
|
|
if (target_cpu == "arm") {
|
|
|
|
_target = "armv7"
|
2017-03-13 16:25:33 +00:00
|
|
|
} else if (target_cpu == "x86") {
|
|
|
|
_target = "i386"
|
|
|
|
} else if (target_cpu == "x64") {
|
|
|
|
_target = "x86_64"
|
2017-01-23 16:58:53 +00:00
|
|
|
}
|
2017-02-17 20:36:01 +00:00
|
|
|
asmflags += [
|
|
|
|
"-isysroot",
|
|
|
|
ios_sysroot,
|
|
|
|
"-arch",
|
|
|
|
_target,
|
|
|
|
]
|
2016-11-03 18:06:31 +00:00
|
|
|
cflags += [
|
2016-11-07 20:38:48 +00:00
|
|
|
"-isysroot",
|
|
|
|
ios_sysroot,
|
|
|
|
"-arch",
|
2017-01-23 16:58:53 +00:00
|
|
|
_target,
|
2016-11-03 18:06:31 +00:00
|
|
|
]
|
|
|
|
cflags_cc += [ "-stdlib=libc++" ]
|
|
|
|
ldflags += [
|
2016-11-07 20:38:48 +00:00
|
|
|
"-isysroot",
|
|
|
|
ios_sysroot,
|
|
|
|
"-arch",
|
2017-01-23 16:58:53 +00:00
|
|
|
_target,
|
2016-11-03 18:06:31 +00:00
|
|
|
"-stdlib=libc++",
|
|
|
|
]
|
2016-12-09 00:00:40 +00:00
|
|
|
libs += [ "objc" ]
|
2016-11-03 18:06:31 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
if (is_linux) {
|
2016-12-09 00:00:40 +00:00
|
|
|
libs += [ "pthread" ]
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
2017-12-07 17:48:57 +00:00
|
|
|
if (is_mac) {
|
|
|
|
# Disable linker warnings. They're usually just annoyances like,
|
|
|
|
# ld: warning: text-based stub file
|
|
|
|
# /System/Library/Frameworks/foo.framework/foo.tbd and library file
|
|
|
|
# /System/Library/Frameworks/foo.framework/foo are out of sync.
|
|
|
|
# Falling back to library file for linking.
|
|
|
|
ldflags += [ "-Wl,-w" ]
|
|
|
|
}
|
2016-08-25 21:50:44 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
if (sanitize != "") {
|
|
|
|
# You can either pass the sanitizers directly, e.g. "address,undefined",
|
|
|
|
# or pass one of the couple common aliases used by the bots.
|
|
|
|
sanitizers = sanitize
|
2018-01-03 16:04:30 +00:00
|
|
|
if (sanitize == "ASAN" || sanitize == "UBSAN") {
|
|
|
|
# ASAN implicitly runs all UBSAN checks also.
|
|
|
|
sanitizers = "bool,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound"
|
|
|
|
if (!is_mac && !is_win) {
|
|
|
|
sanitizers += ",function" # Not supported on Mac or Win.
|
2017-10-05 15:22:09 +00:00
|
|
|
}
|
2018-01-03 16:04:30 +00:00
|
|
|
if (!is_win) {
|
|
|
|
sanitizers += ",vptr" # Not supported on Win.
|
|
|
|
}
|
|
|
|
if (!is_debug && !is_win) {
|
|
|
|
# No-op with somewhat annoying warning at -O0.
|
|
|
|
# Seems to be broken on Win.
|
|
|
|
sanitizers += ",object-size"
|
|
|
|
}
|
|
|
|
if (sanitize == "ASAN") {
|
|
|
|
sanitizers += ",address"
|
2017-09-28 15:42:28 +00:00
|
|
|
}
|
2018-01-12 19:31:48 +00:00
|
|
|
if (is_android) {
|
|
|
|
# Android only easily supports address for now
|
|
|
|
# UBSAN runs into linking errors
|
|
|
|
sanitizers = "address"
|
|
|
|
|
|
|
|
# recommended by
|
|
|
|
# https://github.com/google/sanitizers/wiki/AddressSanitizerOnAndroid
|
|
|
|
cflags += [ "-fno-omit-frame-pointer" ]
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
} else if (sanitize == "TSAN") {
|
|
|
|
sanitizers = "thread"
|
|
|
|
} else if (sanitize == "MSAN") {
|
|
|
|
sanitizers = "memory"
|
2016-09-08 15:39:34 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags += [
|
|
|
|
"-fsanitize=$sanitizers",
|
|
|
|
"-fno-sanitize-recover=$sanitizers",
|
|
|
|
"-fsanitize-blacklist=" + rebase_path("../tools/xsan.blacklist"),
|
|
|
|
]
|
|
|
|
ldflags += [ "-fsanitize=$sanitizers" ]
|
|
|
|
if (sanitizers == "memory") {
|
|
|
|
cflags += [ "-fsanitize-memory-track-origins" ]
|
|
|
|
cflags_cc += [ "-stdlib=libc++" ]
|
|
|
|
ldflags += [ "-stdlib=libc++" ]
|
2016-09-16 20:29:57 +00:00
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-26 15:41:47 +00:00
|
|
|
config("no_exceptions") {
|
2017-08-16 13:20:20 +00:00
|
|
|
# Exceptions are disabled by default on Windows. (Use /EHsc to enable them.)
|
2016-10-26 15:41:47 +00:00
|
|
|
if (!is_win) {
|
|
|
|
cflags_cc = [ "-fno-exceptions" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-13 03:58:06 +00:00
|
|
|
config("warnings") {
|
|
|
|
cflags = []
|
|
|
|
cflags_cc = []
|
2016-10-20 14:17:47 +00:00
|
|
|
cflags_objc = []
|
2017-07-12 20:21:09 +00:00
|
|
|
cflags_objcc = []
|
2016-10-13 03:58:06 +00:00
|
|
|
if (is_win) {
|
|
|
|
cflags += [
|
|
|
|
"/W3", # Turn on lots of warnings.
|
|
|
|
|
|
|
|
# Disable a bunch of warnings:
|
|
|
|
"/wd4244", # conversion from 'float' to 'int', possible loss of data
|
|
|
|
"/wd4267", # conversion from 'size_t' to 'int', possible loss of data
|
|
|
|
"/wd4800", # forcing value to bool 'true' or 'false' (performance warning)
|
|
|
|
|
|
|
|
# Probably only triggers when /EHsc is enabled.
|
|
|
|
"/wd4291", # no matching operator delete found;
|
|
|
|
# memory will not be freed if initialization throws an exception
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
cflags += [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Winit-self",
|
|
|
|
"-Wpointer-arith",
|
|
|
|
"-Wsign-compare",
|
|
|
|
"-Wvla",
|
|
|
|
|
|
|
|
"-Wno-deprecated-declarations",
|
2016-12-13 17:46:05 +00:00
|
|
|
"-Wno-maybe-uninitialized",
|
2016-10-13 03:58:06 +00:00
|
|
|
]
|
|
|
|
cflags_cc += [ "-Wnon-virtual-dtor" ]
|
2017-12-04 19:01:30 +00:00
|
|
|
}
|
2016-10-13 03:58:06 +00:00
|
|
|
|
2017-12-04 19:01:30 +00:00
|
|
|
if (is_clang) {
|
|
|
|
cflags += [
|
|
|
|
"-Weverything",
|
|
|
|
"-Wno-unknown-warning-option", # Let older Clangs ignore newer Clangs' warnings.
|
|
|
|
]
|
2016-10-13 03:58:06 +00:00
|
|
|
|
2017-12-04 19:01:30 +00:00
|
|
|
if (target_cpu == "arm" && is_ios) {
|
|
|
|
# Clang seems to think new/malloc will only be 4-byte aligned on 32-bit iOS.
|
|
|
|
# We're pretty sure it's actually 8-byte alignment.
|
|
|
|
cflags += [ "-Wno-over-aligned" ]
|
2016-10-13 03:58:06 +00:00
|
|
|
}
|
2018-01-08 23:23:32 +00:00
|
|
|
if (target_cpu == "x86" && is_android) {
|
|
|
|
# Clang seems to think new/malloc will only be 4-byte aligned on 32-bit x86 Android builds.
|
|
|
|
# We're pretty sure it's actually 8-byte alignment. See OverAlignedTest.cpp for more info.
|
|
|
|
cflags += [ "-Wno-over-aligned" ]
|
|
|
|
}
|
2017-12-04 19:01:30 +00:00
|
|
|
|
|
|
|
# Shouldn't be necessary for local builds. With distributed Windows builds, files may lose
|
|
|
|
# their case during copy, causing case-sensitivity mismatch on remote machines.
|
|
|
|
cflags += [
|
|
|
|
"-Wno-nonportable-include-path",
|
|
|
|
"-Wno-nonportable-system-include-path",
|
|
|
|
]
|
|
|
|
|
|
|
|
# TODO: These would all be really great warnings to turn on.
|
|
|
|
cflags += [
|
|
|
|
"-Wno-cast-align",
|
|
|
|
"-Wno-cast-qual",
|
|
|
|
"-Wno-conversion",
|
|
|
|
"-Wno-disabled-macro-expansion",
|
|
|
|
"-Wno-documentation",
|
|
|
|
"-Wno-documentation-unknown-command",
|
|
|
|
"-Wno-double-promotion",
|
|
|
|
"-Wno-exit-time-destructors", # TODO: OK outside libskia
|
|
|
|
"-Wno-float-equal",
|
|
|
|
"-Wno-format-nonliteral",
|
|
|
|
"-Wno-global-constructors", # TODO: OK outside libskia
|
|
|
|
"-Wno-missing-prototypes",
|
|
|
|
"-Wno-missing-variable-declarations",
|
|
|
|
"-Wno-pedantic",
|
|
|
|
"-Wno-reserved-id-macro",
|
|
|
|
"-Wno-shadow",
|
|
|
|
"-Wno-shift-sign-overflow",
|
|
|
|
"-Wno-signed-enum-bitfield",
|
|
|
|
"-Wno-switch-enum",
|
|
|
|
"-Wno-undef",
|
|
|
|
"-Wno-unreachable-code",
|
|
|
|
"-Wno-unreachable-code-break",
|
|
|
|
"-Wno-unreachable-code-return",
|
|
|
|
"-Wno-unused-macros",
|
|
|
|
"-Wno-unused-member-function",
|
|
|
|
"-Wno-unused-template",
|
|
|
|
"-Wno-zero-as-null-pointer-constant",
|
|
|
|
]
|
|
|
|
cflags_cc += [
|
|
|
|
"-Wno-abstract-vbase-init",
|
|
|
|
"-Wno-weak-vtables",
|
|
|
|
]
|
|
|
|
|
|
|
|
# We are unlikely to want to fix these.
|
|
|
|
cflags += [
|
|
|
|
"-Wno-covered-switch-default",
|
|
|
|
"-Wno-deprecated",
|
|
|
|
"-Wno-implicit-fallthrough",
|
|
|
|
"-Wno-missing-noreturn",
|
|
|
|
"-Wno-old-style-cast",
|
|
|
|
"-Wno-padded",
|
2017-12-04 20:31:21 +00:00
|
|
|
"-Wno-newline-eof",
|
2017-12-04 19:01:30 +00:00
|
|
|
]
|
|
|
|
cflags_cc += [
|
|
|
|
"-Wno-c++98-compat",
|
|
|
|
"-Wno-c++98-compat-pedantic",
|
|
|
|
"-Wno-undefined-func-template",
|
|
|
|
]
|
|
|
|
cflags_objc += [
|
|
|
|
"-Wno-direct-ivar-access",
|
|
|
|
"-Wno-objc-interface-ivars",
|
|
|
|
]
|
|
|
|
cflags_objcc += [
|
|
|
|
"-Wno-direct-ivar-access",
|
|
|
|
"-Wno-objcc-interface-ivars",
|
|
|
|
]
|
2016-10-13 03:58:06 +00:00
|
|
|
}
|
|
|
|
}
|
2016-11-16 17:13:44 +00:00
|
|
|
config("warnings_except_public_headers") {
|
2017-12-04 19:01:30 +00:00
|
|
|
if (!is_win || is_clang) {
|
2016-11-16 17:13:44 +00:00
|
|
|
cflags = [ "-Wno-unused-parameter" ]
|
|
|
|
}
|
|
|
|
}
|
2016-10-13 03:58:06 +00:00
|
|
|
|
2016-10-04 21:09:13 +00:00
|
|
|
config("extra_flags") {
|
2017-03-28 19:45:41 +00:00
|
|
|
asmflags = extra_asmflags
|
2016-10-04 21:09:13 +00:00
|
|
|
cflags = extra_cflags
|
|
|
|
cflags_c = extra_cflags_c
|
|
|
|
cflags_cc = extra_cflags_cc
|
|
|
|
ldflags = extra_ldflags
|
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("debug_symbols") {
|
|
|
|
# It's annoying to wait for full debug symbols to push over
|
|
|
|
# to Android devices. -gline-tables-only is a lot slimmer.
|
|
|
|
if (is_android) {
|
2017-08-30 14:23:01 +00:00
|
|
|
cflags = [
|
|
|
|
"-gline-tables-only",
|
|
|
|
"-funwind-tables", # Helps make in-process backtraces fuller.
|
|
|
|
]
|
2016-10-12 20:25:27 +00:00
|
|
|
} else if (is_win) {
|
2017-12-15 12:34:27 +00:00
|
|
|
cflags = [ "/Z7" ]
|
2017-12-28 19:53:10 +00:00
|
|
|
ldflags = [ "/DEBUG:FASTLINK" ]
|
2016-10-12 20:25:27 +00:00
|
|
|
} else {
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags = [ "-g" ]
|
|
|
|
}
|
|
|
|
}
|
2016-09-16 20:29:57 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("no_rtti") {
|
|
|
|
if (sanitize != "ASAN") { # -fsanitize=vptr requires RTTI
|
2016-10-12 20:25:27 +00:00
|
|
|
if (is_win) {
|
|
|
|
cflags_cc = [ "/GR-" ]
|
|
|
|
} else {
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags_cc = [ "-fno-rtti" ]
|
2016-09-08 15:39:34 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("release") {
|
2016-10-12 20:25:27 +00:00
|
|
|
if (is_win) {
|
2016-10-20 17:34:18 +00:00
|
|
|
cflags = [
|
|
|
|
"/O2",
|
|
|
|
"/Zc:inline",
|
|
|
|
]
|
2016-10-20 17:52:38 +00:00
|
|
|
ldflags = [
|
|
|
|
"/OPT:ICF",
|
|
|
|
"/OPT:REF",
|
|
|
|
]
|
2016-10-12 20:25:27 +00:00
|
|
|
} else {
|
2016-10-20 02:24:10 +00:00
|
|
|
cflags = [
|
|
|
|
"-O3",
|
2017-02-10 12:59:39 +00:00
|
|
|
"-fdata-sections",
|
|
|
|
"-ffunction-sections",
|
2016-10-20 02:24:10 +00:00
|
|
|
]
|
2017-02-10 12:59:39 +00:00
|
|
|
if (is_mac || is_ios) {
|
|
|
|
ldflags = [ "-dead_strip" ]
|
|
|
|
} else {
|
|
|
|
ldflags = [ "-Wl,--gc-sections" ]
|
|
|
|
}
|
2017-09-21 17:45:16 +00:00
|
|
|
if (target_cpu == "wasm") {
|
|
|
|
# The compiler asks us to add an optimization flag to both cflags
|
|
|
|
# and ldflags to cut down on the local variables,
|
|
|
|
# for performance reasons.
|
|
|
|
# The "linking" step is the conversion to javascript.
|
|
|
|
ldflags += [ "-O3" ]
|
|
|
|
}
|
2016-09-16 20:29:57 +00:00
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
defines = [ "NDEBUG" ]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("executable") {
|
2016-12-06 15:46:02 +00:00
|
|
|
if (is_android) {
|
2017-08-30 14:23:01 +00:00
|
|
|
ldflags = [
|
|
|
|
"-pie",
|
|
|
|
"-rdynamic",
|
|
|
|
]
|
2016-12-06 15:46:02 +00:00
|
|
|
} else if (is_mac) {
|
2016-07-21 19:25:45 +00:00
|
|
|
ldflags = [ "-Wl,-rpath,@loader_path/." ]
|
|
|
|
} else if (is_linux) {
|
2016-09-15 17:44:15 +00:00
|
|
|
ldflags = [
|
|
|
|
"-rdynamic",
|
|
|
|
"-Wl,-rpath,\$ORIGIN",
|
|
|
|
]
|
2016-11-06 16:54:19 +00:00
|
|
|
} else if (is_win) {
|
|
|
|
ldflags = [
|
|
|
|
"/SUBSYSTEM:CONSOLE", # Quiet "no subsystem specified; CONSOLE assumed".
|
|
|
|
"/INCREMENTAL:NO", # Quiet warnings about failing to incrementally link by never trying to.
|
|
|
|
]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
}
|