[gn] Split target arch/os defines from dart_config

This is a baby-step towards building an SDK targeting the host arch
during a cross-build. This will require a similar update to the use
of dart_config in the Flutter engine at //flutter/lib/io/BUILD.gn:19.

Change-Id: I8b871cceb53038cab8407264664c5ce545e6e010
Reviewed-on: https://dart-review.googlesource.com/17523
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Zachary Anderson 2017-10-31 17:33:13 +00:00 committed by Zach Anderson
parent 8ac1307f60
commit 9ab8b55663
5 changed files with 52 additions and 8 deletions

View file

@ -52,7 +52,7 @@ config("dart_no_snapshot_config") {
defines += [ "DART_NO_SNAPSHOT" ]
}
config("dart_config") {
config("dart_os_config") {
defines = []
if (target_os == "android") {
@ -72,6 +72,10 @@ config("dart_config") {
print("Unknown target_os: $target_os")
assert(false)
}
}
config("dart_arch_config") {
defines = []
if (dart_target_arch == "arm") {
defines += [ "TARGET_ARCH_ARM" ]
@ -94,6 +98,10 @@ config("dart_config") {
print("Invalid dart_target_arch: $dart_target_arch")
assert(false)
}
}
config("dart_config") {
defines = []
if (dart_debug) {
defines += [ "DEBUG" ]
@ -170,7 +178,11 @@ template("libdart_library") {
extra_deps += invoker.extra_deps
}
static_library(target_name) {
configs += [ ":dart_config" ] + extra_configs
configs += [
":dart_arch_config",
":dart_config",
":dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}

View file

@ -231,7 +231,11 @@ template("build_libdart_builtin") {
extra_configs += invoker.extra_configs
}
static_library(target_name) {
configs += [ "..:dart_config" ] + extra_configs
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}
@ -286,7 +290,9 @@ template("build_gen_snapshot") {
}
executable(target_name) {
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
"..:dart_precompiler_config",
] + extra_configs
if (is_fuchsia) {
@ -386,7 +392,9 @@ template("build_gen_snapshot_dart_io") {
}
source_set(target_name) {
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
"..:dart_precompiler_config",
] + extra_configs
deps = []
@ -450,7 +458,11 @@ template("dart_io") {
extra_sources += invoker.extra_sources
}
source_set(target_name) {
configs += [ "..:dart_config" ] + extra_configs
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}
@ -678,7 +690,9 @@ template("dart_executable") {
}
executable(target_name) {
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
"..:dart_maybe_product_config",
] + extra_configs
if (is_fuchsia) {
@ -979,7 +993,9 @@ executable("run_vm_tests") {
}
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
"..:dart_maybe_product_config",
]
if (is_fuchsia) {

View file

@ -10,7 +10,11 @@ template("build_libdart_platform") {
extra_configs += invoker.extra_configs
}
static_library(target_name) {
configs += [ "..:dart_config" ] + extra_configs
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}

View file

@ -3,7 +3,11 @@
# BSD-style license that can be found in the LICENSE file.
static_library("libdouble_conversion") {
configs += [ "../../..:dart_config" ]
configs += [
"../../..:dart_arch_config",
"../../..:dart_config",
"../../..:dart_os_config",
]
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}

View file

@ -64,7 +64,11 @@ template("build_libdart_vm") {
extra_configs += invoker.extra_configs
}
source_set(target_name) {
configs += [ "..:dart_config" ] + extra_configs
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
deps = [
@ -202,7 +206,11 @@ template("build_libdart_lib") {
extra_sources += invoker.extra_sources
}
source_set(target_name) {
configs += [ "..:dart_config" ] + extra_configs
configs += [
"..:dart_arch_config",
"..:dart_config",
"..:dart_os_config",
] + extra_configs
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}