skia2/gn/BUILDCONFIG.gn

227 lines
5.5 KiB
Plaintext
Raw Normal View History

# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
is_skia_standalone = true
# It's best to keep the names and defaults of is_foo flags consistent with Chrome.
declare_args() {
is_official_build = false
is_component_build = false
ndk = ""
# Android 5.0, Lollipop
ndk_api = 21
sanitize = ""
ar = "ar"
cc = "cc"
cxx = "c++"
win_sdk = "C:/Program Files (x86)/Windows Kits/10"
win_sdk_version = ""
win_vc = ""
win_toolchain_version = ""
clang_win = ""
clang_win_version = ""
Reland "Move gn setup for vulkan library/headers into their own third_party directory." This reverts commit 2c2a119f945eedaced4bf081347a53f05cf0c39c. Reason for revert: Relanding with fixes Original change's description: > Revert "Move gn setup for vulkan library/headers into their own third_party directory." > > This reverts commit 477094250cd55a38d4d796ab6c50eb57bdba65e1. > > Reason for revert: > I think we know this broke the MoltenVK bots. It also appears to have broken the Fuchsia roll: https://logs.chromium.org/v/?s=fuchsia%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8945885190914943680%2F%2B%2Fsteps%2Fbuild%2F0%2Fsteps%2Fbuild_fuchsia%2F0%2Fsteps%2Fgn_gen%2F0%2Fstdout > > Original change's description: > > Move gn setup for vulkan library/headers into their own third_party directory. > > > > Bug: skia: > > Change-Id: I4605f0d962271efb77bf3c17f1b0daaaddfb51c8 > > Reviewed-on: https://skia-review.googlesource.com/128540 > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > Reviewed-by: Mike Klein <mtklein@google.com> > > Reviewed-by: Ben Wagner <bungeman@google.com> > > TBR=egdaniel@google.com,mtklein@google.com,bungeman@google.com > > Change-Id: I6e41d98e39883eff34424a2f352b0c8adec178db > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/129444 > Reviewed-by: Mike Klein <mtklein@google.com> > Commit-Queue: Mike Klein <mtklein@google.com> Bug: skia: Change-Id: I26b4b1f7196dd1bd8bf2e7641ef741c90c742c81 Reviewed-on: https://skia-review.googlesource.com/129445 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
2018-05-22 17:25:15 +00:00
werror = false
}
declare_args() {
is_debug = !is_official_build
}
assert(!(is_debug && is_official_build))
if (target_cpu == "wasm") {
target_os = "wasm"
}
# Platform detection
if (target_os == "") {
target_os = host_os
if (ndk != "") {
target_os = "android"
}
}
if (current_os == "") {
current_os = target_os
}
is_android = current_os == "android"
is_fuchsia = current_os == "fuchsia"
is_ios = current_os == "ios" || current_os == "tvos"
is_tvos = current_os == "tvos"
is_linux = current_os == "linux"
is_mac = current_os == "mac"
is_win = current_os == "win"
# This is just to make the Dawn build files happy. Skia itself uses target_os = "linux"
# for ChromeOS, so this variable will not affect Skia proper.
is_chromeos = false
if (target_cpu == "") {
target_cpu = host_cpu
if (is_android || is_ios) {
target_cpu = "arm64"
}
}
if (target_cpu == "x86_64") {
target_cpu = "x64"
}
if (current_cpu == "") {
current_cpu = target_cpu
}
is_clang = is_android || is_ios || is_mac || is_fuchsia ||
(cc == "clang" && cxx == "clang++") || clang_win != ""
if (!is_clang && !is_win) {
is_clang = exec_script("//gn/is_clang.py",
[
cc,
cxx,
],
"value")
}
if (is_android) {
ndk_host = ""
ndk_target = ""
ndk_gdbserver = ""
if (host_os == "linux") {
ndk_host = "linux-x86_64"
} else if (host_os == "mac") {
ndk_host = "darwin-x86_64"
} else if (host_os == "win") {
ndk_host = "windows-x86_64"
}
if (target_cpu == "arm64") {
ndk_target = "aarch64-linux-android"
ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver"
} else if (target_cpu == "arm") {
ndk_target = "armv7a-linux-androideabi"
ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver"
} else if (target_cpu == "x64") {
ndk_target = "x86_64-linux-android"
ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver"
} else if (target_cpu == "x86") {
ndk_target = "i686-linux-android"
ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
}
}
if (target_os == "win") {
# By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a
# non-default location, you can set win_vc to inform us where it is.
if (win_vc == "") {
win_vc = exec_script("//gn/find_msvc.py", [], "trim string")
}
assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC
# directory.
}
if (target_os == "win") {
if (win_toolchain_version == "") {
win_toolchain_version = exec_script("//gn/highest_version_dir.py",
[
"$win_vc/Tools/MSVC",
"[0-9]{2}\.[0-9]{2}\.[0-9]{5}",
],
"trim string")
}
if (win_sdk_version == "") {
win_sdk_version = exec_script("//gn/highest_version_dir.py",
[
"$win_sdk/Include",
"[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]",
],
"trim string")
}
if (clang_win != "" && clang_win_version == "") {
clang_win_version = exec_script("//gn/highest_version_dir.py",
[
"$clang_win/lib/clang",
"[0-9]+\.[0-9]+\.[0-9]+",
],
"trim string")
}
}
# A component is either a static or a shared library.
template("component") {
_component_mode = "static_library"
if (is_component_build) {
_component_mode = "shared_library"
}
target(_component_mode, target_name) {
forward_variables_from(invoker, "*")
}
}
# Default configs
default_configs = [
"//gn:default",
"//gn:no_exceptions",
"//gn:no_rtti",
]
if (!is_debug) {
default_configs += [
"//gn:optimize",
"//gn:NDEBUG",
]
}
if (!is_official_build) {
default_configs += [
"//gn:debug_symbols",
"//gn:warnings",
]
}
default_configs += [
"//gn:warnings_except_public_headers",
"//gn:extra_flags",
]
set_defaults("executable") {
configs = [ "//gn:executable" ] + default_configs
}
set_defaults("source_set") {
configs = default_configs
}
set_defaults("static_library") {
configs = default_configs
}
set_defaults("shared_library") {
configs = default_configs
}
set_defaults("component") {
configs = default_configs
if (!is_component_build) {
complete_static_lib = true
}
}
if (is_win) {
# Windows tool chain
set_default_toolchain("//gn/toolchain:msvc")
default_toolchain_name = "msvc"
host_toolchain = "msvc"
} else {
# GCC-like toolchains, including Clang.
set_default_toolchain("//gn/toolchain:gcc_like")
default_toolchain_name = "gcc_like"
host_toolchain = "gcc_like_host"
}