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.
|
|
|
|
|
2016-09-21 16:14:19 +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 = ""
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_api = 0 # 0 == picked automatically for target_cpu.
|
2016-09-08 15:39:34 +00:00
|
|
|
sanitize = ""
|
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
|
|
|
|
|
|
|
# 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"
|
|
|
|
is_ios = current_os == "ios"
|
|
|
|
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-08-26 15:13:04 +00:00
|
|
|
if (is_android) {
|
2016-08-25 21:50:44 +00:00
|
|
|
target_cpu = "arm64"
|
|
|
|
}
|
2016-08-17 01:28:43 +00:00
|
|
|
}
|
|
|
|
if (current_cpu == "") {
|
|
|
|
current_cpu = target_cpu
|
|
|
|
}
|
|
|
|
|
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 = ""
|
|
|
|
|
|
|
|
if (ndk_api == 0) {
|
|
|
|
ndk_api = 18
|
|
|
|
if (target_cpu == "arm64" || target_cpu == "mips64el" ||
|
|
|
|
target_cpu == "x64") {
|
|
|
|
ndk_api = 21
|
|
|
|
}
|
|
|
|
}
|
2016-08-25 21:50:44 +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-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
|
|
|
|
} 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
|
|
|
|
} else if (target_cpu == "mips64el") {
|
|
|
|
ndk_target = "mips64el-linux-android"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-mips64"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_stdlib = "mips64"
|
|
|
|
ndk_gccdir = ndk_target
|
|
|
|
} else if (target_cpu == "mipsel") {
|
|
|
|
ndk_target = "mipsel-linux-android"
|
2016-09-14 13:12:09 +00:00
|
|
|
ndk_platform = "android-${ndk_api}/arch-mips"
|
2016-08-26 15:13:04 +00:00
|
|
|
ndk_stdlib = "mips"
|
|
|
|
ndk_gccdir = ndk_target
|
|
|
|
} 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
|
|
|
|
} 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
|
2016-08-25 21:50:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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",
|
|
|
|
"//gn:no_rtti",
|
|
|
|
]
|
2016-07-21 19:25:45 +00:00
|
|
|
if (!is_debug) {
|
2016-08-03 22:08:04 +00:00
|
|
|
default_configs += [ "//gn:release" ]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
2016-09-14 18:16:49 +00:00
|
|
|
if (!is_official_build) {
|
|
|
|
default_configs += [ "//gn:debug_symbols" ]
|
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
|
|
|
|
set_defaults("executable") {
|
2016-08-03 22:08:04 +00:00
|
|
|
configs = default_configs + [ "//gn:executable" ]
|
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
|
|
|
|
set_default_toolchain("//gn:msvc")
|
|
|
|
} else {
|
|
|
|
# GCC-like toolchains, including Clang.
|
|
|
|
set_default_toolchain("//gn:gcc_like")
|
|
|
|
}
|