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.
|
|
|
|
|
2017-03-03 15:55:02 +00:00
|
|
|
is_skia_standalone = true
|
|
|
|
|
2016-07-21 19:25:45 +00:00
|
|
|
# It's best to keep the names and defaults of is_foo flags consistent with Chrome.
|
|
|
|
|
|
|
|
declare_args() {
|
2016-09-14 18:16:49 +00:00
|
|
|
is_official_build = false
|
2016-07-21 19:25:45 +00:00
|
|
|
is_component_build = false
|
2016-08-25 21:50:44 +00:00
|
|
|
ndk = ""
|
2017-11-28 19:31:14 +00:00
|
|
|
|
|
|
|
# It's nice to keep ndk_api set to what Clank targets, but probably no big deal if we can't.
|
2017-12-05 13:50:20 +00:00
|
|
|
if (target_cpu == "x86" || target_cpu == "arm") {
|
2017-11-28 19:31:14 +00:00
|
|
|
ndk_api = 16
|
2016-12-14 18:17:53 +00:00
|
|
|
} else {
|
|
|
|
ndk_api = 21
|
|
|
|
}
|
2017-11-28 19:31:14 +00:00
|
|
|
|
2016-09-08 15:39:34 +00:00
|
|
|
sanitize = ""
|
2017-06-29 14:03:38 +00:00
|
|
|
|
|
|
|
ar = "ar"
|
|
|
|
cc = "cc"
|
|
|
|
cxx = "c++"
|
|
|
|
|
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_sdk = "C:/Program Files (x86)/Windows Kits/10"
|
|
|
|
win_sdk_version = ""
|
|
|
|
|
|
|
|
win_vc = ""
|
|
|
|
win_toolchain_version = ""
|
|
|
|
|
2017-07-31 15:57:21 +00:00
|
|
|
clang_win = ""
|
2018-05-22 17:25:15 +00:00
|
|
|
|
|
|
|
skia_moltenvk_path = ""
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
2016-09-14 18:16:49 +00:00
|
|
|
declare_args() {
|
|
|
|
is_debug = !is_official_build
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(!(is_debug && is_official_build))
|
2016-07-21 19:25:45 +00:00
|
|
|
|
2017-09-21 17:45:16 +00:00
|
|
|
if (target_cpu == "wasm") {
|
|
|
|
target_os = "wasm"
|
|
|
|
}
|
|
|
|
|
2016-07-21 19:25:45 +00:00
|
|
|
# Platform detection
|
|
|
|
if (target_os == "") {
|
|
|
|
target_os = host_os
|
2016-08-25 21:50:44 +00:00
|
|
|
if (ndk != "") {
|
|
|
|
target_os = "android"
|
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
if (current_os == "") {
|
|
|
|
current_os = target_os
|
|
|
|
}
|
|
|
|
|
2016-08-26 15:13:04 +00:00
|
|
|
is_android = current_os == "android"
|
|
|
|
is_fuchsia = current_os == "fuchsia"
|
2017-03-14 20:22:32 +00:00
|
|
|
is_ios = current_os == "ios" || current_os == "tvos"
|
|
|
|
is_tvos = current_os == "tvos"
|
2016-08-26 15:13:04 +00:00
|
|
|
is_linux = current_os == "linux"
|
|
|
|
is_mac = current_os == "mac"
|
|
|
|
is_win = current_os == "win"
|
|
|
|
|
2016-08-17 01:28:43 +00:00
|
|
|
if (target_cpu == "") {
|
|
|
|
target_cpu = host_cpu
|
2016-11-03 18:06:31 +00:00
|
|
|
if (is_android || is_ios) {
|
2016-08-25 21:50:44 +00:00
|
|
|
target_cpu = "arm64"
|
|
|
|
}
|
2016-08-17 01:28:43 +00:00
|
|
|
}
|
2017-01-23 16:58:53 +00:00
|
|
|
if (target_cpu == "x86_64") {
|
|
|
|
target_cpu = "x64"
|
|
|
|
}
|
2016-08-17 01:28:43 +00:00
|
|
|
if (current_cpu == "") {
|
|
|
|
current_cpu = target_cpu
|
|
|
|
}
|
|
|
|
|
2017-09-21 17:45:16 +00:00
|
|
|
is_clang = is_android || is_ios || is_mac ||
|
|
|
|
(cc == "clang" && cxx == "clang++") || clang_win != ""
|
2017-07-31 15:57:21 +00:00
|
|
|
if (!is_clang && !is_win) {
|
|
|
|
is_clang = exec_script("gn/is_clang.py",
|
|
|
|
[
|
|
|
|
cc,
|
|
|
|
cxx,
|
|
|
|
],
|
|
|
|
"value")
|
|
|
|
}
|
|
|
|
|
2016-08-25 21:50:44 +00:00
|
|
|
if (is_android) {
|
|
|
|
ndk_host = ""
|
|
|
|
ndk_target = ""
|
|
|
|
ndk_platform = ""
|
|
|
|
ndk_stdlib = ""
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_gccdir = ""
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = ""
|
2016-09-14 13:12:09 +00:00
|
|
|
|
2016-08-26 15:13:04 +00:00
|
|
|
if (host_os == "linux") {
|
2016-08-25 21:50:44 +00:00
|
|
|
ndk_host = "linux-x86_64"
|
2016-08-26 15:13:04 +00:00
|
|
|
} else if (host_os == "mac") {
|
|
|
|
ndk_host = "darwin-x86_64"
|
2016-10-24 20:49:15 +00:00
|
|
|
} else if (host_os == "win") {
|
|
|
|
ndk_host = "windows-x86_64"
|
2016-08-25 21:50:44 +00:00
|
|
|
}
|
2016-08-26 15:13:04 +00:00
|
|
|
|
2016-08-25 21:50:44 +00:00
|
|
|
if (target_cpu == "arm64") {
|
|
|
|
ndk_target = "aarch64-linux-android"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-arm64"
|
2016-08-25 21:50:44 +00:00
|
|
|
ndk_stdlib = "arm64-v8a"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_gccdir = ndk_target
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver"
|
2016-08-26 15:13:04 +00:00
|
|
|
} else if (target_cpu == "arm") {
|
|
|
|
ndk_target = "arm-linux-androideabi"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-arm"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_stdlib = "armeabi-v7a"
|
|
|
|
ndk_gccdir = ndk_target
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver"
|
2016-08-26 15:13:04 +00:00
|
|
|
} else if (target_cpu == "x64") {
|
|
|
|
ndk_target = "x86_64-linux-android"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-x86_64"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_stdlib = "x86_64"
|
|
|
|
ndk_gccdir = ndk_stdlib
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver"
|
2016-08-26 15:13:04 +00:00
|
|
|
} else if (target_cpu == "x86") {
|
|
|
|
ndk_target = "i686-linux-android"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-x86"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_stdlib = "x86"
|
|
|
|
ndk_gccdir = ndk_stdlib
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
|
2016-08-25 21:50:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
msvc = ""
|
|
|
|
if (target_os == "win") {
|
2019-01-08 23:37:43 +00:00
|
|
|
# By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a
|
2018-02-08 15:24:09 +00:00
|
|
|
# non-default location, you can set win_vc to inform us where it is.
|
2019-01-08 23:37:43 +00:00
|
|
|
vc_2017_ent_default =
|
|
|
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC"
|
2018-02-08 15:24:09 +00:00
|
|
|
vc_2017_pro_default =
|
2018-12-07 20:30:43 +00:00
|
|
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC"
|
2018-02-08 15:24:09 +00:00
|
|
|
vc_2017_com_default =
|
2018-12-07 20:30:43 +00:00
|
|
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC"
|
2018-02-14 16:25:31 +00:00
|
|
|
vc_2017_bt_default =
|
2018-12-07 20:30:43 +00:00
|
|
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
|
|
|
|
vc_2015_default = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC"
|
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
|
|
|
|
|
|
|
if (win_vc == "") {
|
2018-02-08 15:24:09 +00:00
|
|
|
if ("True" == exec_script("//gn/checkdir.py",
|
2019-01-08 23:37:43 +00:00
|
|
|
[ "$vc_2017_ent_default" ],
|
2018-02-08 15:24:09 +00:00
|
|
|
"trim string")) {
|
2019-01-08 23:37:43 +00:00
|
|
|
win_vc = vc_2017_ent_default
|
|
|
|
msvc = 2017
|
|
|
|
} else if ("True" == exec_script("//gn/checkdir.py",
|
|
|
|
[ "$vc_2017_pro_default" ],
|
|
|
|
"trim string")) {
|
2018-02-08 15:24:09 +00:00
|
|
|
win_vc = vc_2017_pro_default
|
|
|
|
msvc = 2017
|
|
|
|
} else if ("True" == exec_script("//gn/checkdir.py",
|
|
|
|
[ "$vc_2017_com_default" ],
|
|
|
|
"trim string")) {
|
|
|
|
win_vc = vc_2017_com_default
|
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
|
|
|
msvc = 2017
|
2018-02-14 16:25:31 +00:00
|
|
|
} else if ("True" == exec_script("//gn/checkdir.py",
|
|
|
|
[ "$vc_2017_bt_default" ],
|
|
|
|
"trim string")) {
|
|
|
|
win_vc = vc_2017_bt_default
|
|
|
|
msvc = 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
|
|
|
} else if ("True" == exec_script("//gn/checkdir.py",
|
|
|
|
[ "$vc_2015_default" ],
|
|
|
|
"trim string")) {
|
|
|
|
win_vc = vc_2015_default
|
|
|
|
msvc = 2015
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC directory.
|
|
|
|
|
|
|
|
if (msvc == "") {
|
|
|
|
if ("True" ==
|
|
|
|
exec_script("//gn/checkdir.py", [ "$win_vc/Tools" ], "trim string")) {
|
|
|
|
msvc = 2017
|
|
|
|
} else {
|
|
|
|
msvc = 2015
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:47:41 +00:00
|
|
|
if (target_os == "win") {
|
|
|
|
if (msvc == 2017 && win_toolchain_version == "") {
|
|
|
|
win_toolchain_version = exec_script("//gn/highest_version_dir.py",
|
2017-12-11 19:59:03 +00:00
|
|
|
[
|
|
|
|
"$win_vc/Tools/MSVC",
|
|
|
|
"[0-9]{2}\.[0-9]{2}\.[0-9]{5}",
|
|
|
|
],
|
2017-12-06 21:47:41 +00:00
|
|
|
"trim string")
|
|
|
|
}
|
|
|
|
if (win_sdk_version == "") {
|
|
|
|
win_sdk_version = exec_script("//gn/highest_version_dir.py",
|
2017-12-11 19:59:03 +00:00
|
|
|
[
|
|
|
|
"$win_sdk/Include",
|
|
|
|
"[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]",
|
|
|
|
],
|
2017-12-06 21:47:41 +00:00
|
|
|
"trim string")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-29 16:10:31 +00:00
|
|
|
# A component is either a static or a shared library.
|
2016-07-21 19:25:45 +00:00
|
|
|
template("component") {
|
2016-07-29 16:10:31 +00:00
|
|
|
_component_mode = "static_library"
|
2016-07-21 19:25:45 +00:00
|
|
|
if (is_component_build) {
|
|
|
|
_component_mode = "shared_library"
|
|
|
|
}
|
|
|
|
|
|
|
|
target(_component_mode, target_name) {
|
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Default configs
|
2016-08-03 22:08:04 +00:00
|
|
|
default_configs = [
|
|
|
|
"//gn:default",
|
2016-10-26 15:41:47 +00:00
|
|
|
"//gn:no_exceptions",
|
2016-08-03 22:08:04 +00:00
|
|
|
"//gn:no_rtti",
|
|
|
|
]
|
2017-01-21 15:35:10 +00:00
|
|
|
if (!is_debug) {
|
2018-09-19 17:44:43 +00:00
|
|
|
default_configs += [
|
|
|
|
"//gn:optimize",
|
|
|
|
"//gn:NDEBUG",
|
|
|
|
]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
2016-09-14 18:16:49 +00:00
|
|
|
if (!is_official_build) {
|
2018-09-04 14:15:58 +00:00
|
|
|
default_configs += [
|
|
|
|
"//gn:debug_symbols",
|
|
|
|
"//gn:warnings",
|
|
|
|
]
|
2016-09-14 18:16:49 +00:00
|
|
|
}
|
2018-09-04 14:15:58 +00:00
|
|
|
default_configs += [
|
|
|
|
"//gn:warnings_except_public_headers",
|
|
|
|
"//gn:extra_flags",
|
|
|
|
]
|
2019-02-04 15:01:53 +00:00
|
|
|
if (sanitize == "MSVC") {
|
|
|
|
default_configs += [ "//gn:msvc_rtc" ]
|
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
|
|
|
|
set_defaults("executable") {
|
2016-10-04 21:09:13 +00:00
|
|
|
configs = [ "//gn:executable" ] + default_configs
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults("source_set") {
|
2016-08-03 22:08:04 +00:00
|
|
|
configs = default_configs
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults("static_library") {
|
2016-08-03 22:08:04 +00:00
|
|
|
configs = default_configs
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults("shared_library") {
|
2016-08-03 22:08:04 +00:00
|
|
|
configs = default_configs
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults("component") {
|
2016-08-03 22:08:04 +00:00
|
|
|
configs = default_configs
|
2016-08-25 00:32:30 +00:00
|
|
|
if (!is_component_build) {
|
|
|
|
complete_static_lib = true
|
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
if (is_win) {
|
|
|
|
# Windows tool chain
|
2017-06-29 14:03:38 +00:00
|
|
|
set_default_toolchain("//gn/toolchain:msvc")
|
|
|
|
default_toolchain_name = "msvc"
|
|
|
|
host_toolchain = "msvc"
|
2016-09-16 20:29:57 +00:00
|
|
|
} else {
|
|
|
|
# GCC-like toolchains, including Clang.
|
2017-06-29 14:03:38 +00:00
|
|
|
set_default_toolchain("//gn/toolchain:gcc_like")
|
|
|
|
default_toolchain_name = "gcc_like"
|
|
|
|
host_toolchain = "gcc_like_host"
|
2016-09-16 20:29:57 +00:00
|
|
|
}
|