Add libdart_precompiled_runtime target to runtime/BUILD.gn

This allows the embedder using the gn build files build a VM runtime without compiler-related code, used to run a precompiled snapshot.

It is a copy of libdart, but has the macro DART_PRECOMPILED_RUNTIME defined which excludes all
 compiler-related code, not needed to run precompiled code from the binary.

BUG=
R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1738503002 .
This commit is contained in:
Florian Schneider 2016-02-25 13:44:28 -08:00
parent 6dce8ce573
commit 289157044a
2 changed files with 117 additions and 0 deletions

View file

@ -87,6 +87,65 @@ config("dart_config") {
}
}
config("dart_config_no_precompiler") {
defines = []
if (dart_target_arch != "") {
if (dart_target_arch == "arm") {
defines += [ "TARGET_ARCH_ARM" ]
} else if (dart_target_arch == "arm64") {
defines += [ "TARGET_ARCH_ARM64" ]
} else if (dart_target_arch == "mips") {
defines += [ "TARGET_ARCH_MIPS" ]
} else if (dart_target_arch == "x64") {
defines += [ "TARGET_ARCH_X64" ]
} else if (dart_target_arch == "ia32") {
defines += [ "TARGET_ARCH_IA32" ]
} else {
print("Invalid |dart_target_arch|")
assert(false)
}
}
if (dart_debug) {
defines += ["DEBUG"]
} else {
defines += ["NDEBUG"]
}
cflags = [
"-Werror",
"-Wall",
"-Wextra", # Also known as -W.
"-Wno-unused-parameter",
"-Wnon-virtual-dtor",
"-Wvla",
"-Wno-conversion-null",
"-Woverloaded-virtual",
"-g3",
"-ggdb3",
"-fno-rtti",
"-fno-exceptions",
]
if (dart_debug) {
cflags += [
"-O1",
]
} else {
cflags += [
"-O3",
]
}
if (is_asan) {
ldflags = [
"-Wl,-u_sanitizer_options_link_helper",
"-fsanitize=address",
]
}
}
static_library("libdart") {
configs += [":dart_config"]
@ -119,6 +178,38 @@ static_library("libdart") {
}
static_library("libdart_precompiled_runtime") {
configs += [":dart_config_no_precompiler"]
deps = [
"vm:libdart_lib_precompiled_runtime",
"vm:libdart_vm_precompiled_runtime",
"third_party/double-conversion/src:libdouble_conversion",
":generate_version_cc_file",
]
include_dirs = [
".",
]
public_configs = [":dart_public_config"]
sources = [
"include/dart_api.h",
"include/dart_mirrors_api.h",
"include/dart_native_api.h",
"include/dart_tools_api.h",
"vm/dart_api_impl.cc",
"vm/debugger_api_impl.cc",
"vm/mirrors_api_impl.cc",
"vm/native_api_impl.cc",
"vm/version.h",
"$target_gen_dir/version.cc",
]
defines = [
# Using DART_SHARED_LIB to export the Dart API entries.
"DART_SHARED_LIB",
"DART_PRECOMPILED_RUNTIME",
]
}
action("generate_version_cc_file") {
deps = [
":libdart_dependency_helper",

View file

@ -62,6 +62,24 @@ static_library("libdart_vm") {
}
static_library("libdart_vm_precompiled_runtime") {
configs += ["..:dart_config_no_precompiler"]
public_configs = [":libdart_vm_config"]
defines = ["DART_PRECOMPILED_RUNTIME"]
vm_sources_list = exec_script("../../tools/gypi_to_gn.py",
[rebase_path("vm_sources.gypi")],
"scope",
["vm_sources.gypi"])
set_sources_assignment_filter(["*_test.cc", "*_test.h"])
sources = vm_sources_list.sources
- ["vtune.cc", "vtune.h"]
include_dirs = [
"..",
]
}
static_library("libdart_vm_nosnapshot") {
configs += ["..:dart_config"]
public_configs = [":libdart_vm_config"]
@ -179,6 +197,14 @@ template("generate_core_libraries") {
"..",
]
}
static_library("libdart_lib_precompiled_runtime") {
configs += ["..:dart_config_no_precompiler"]
defines = ["DART_PRECOMPILED_RUNTIME"]
sources = libsources + [ "bootstrap_nocore.cc", ]
include_dirs = [
"..",
]
}
}