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-12-14 18:17:53 +00:00
|
|
|
if (target_cpu == "x86" || target_cpu == "mipsel" || target_cpu == "arm") {
|
|
|
|
ndk_api = 18
|
|
|
|
} else {
|
|
|
|
ndk_api = 21
|
|
|
|
}
|
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-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
|
|
|
|
}
|
|
|
|
|
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 = ""
|
|
|
|
ndk_simpleperf = ""
|
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"
|
|
|
|
ndk_simpleperf = "simpleperf/android/arm64/simpleperf"
|
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"
|
|
|
|
ndk_simpleperf = "simpleperf/android/arm/simpleperf"
|
2016-08-26 15:13:04 +00:00
|
|
|
} 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
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-mips64/gdbserver/gdbserver"
|
2016-08-26 15:13:04 +00:00
|
|
|
} 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
|
2017-01-05 16:39:04 +00:00
|
|
|
ndk_gdbserver = "prebuilt/android-mips/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"
|
|
|
|
ndk_simpleperf = "simpleperf/android/x86_64/simpleperf"
|
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"
|
|
|
|
ndk_simpleperf = "simpleperf/android/x86/simpleperf"
|
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",
|
2016-10-26 15:41:47 +00:00
|
|
|
"//gn:no_exceptions",
|
2016-08-03 22:08:04 +00:00
|
|
|
"//gn:no_rtti",
|
2016-10-13 03:58:06 +00:00
|
|
|
"//gn:warnings",
|
2016-11-16 17:13:44 +00:00
|
|
|
"//gn:warnings_except_public_headers",
|
2016-08-03 22:08:04 +00:00
|
|
|
]
|
2017-01-21 15:35:10 +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-10-04 21:09:13 +00:00
|
|
|
default_configs += [ "//gn:extra_flags" ]
|
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
|
|
|
|
set_default_toolchain("//gn:msvc")
|
|
|
|
} else {
|
|
|
|
# GCC-like toolchains, including Clang.
|
|
|
|
set_default_toolchain("//gn:gcc_like")
|
|
|
|
}
|