mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:20:38 +00:00
227 lines
5.7 KiB
Text
227 lines
5.7 KiB
Text
# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
# TODO(zra): These build arguments should likely be moved to a gni file that is
|
|
# included in BUILD.gn files that care about the values of the flags. For now,
|
|
# since the GN build only happens as part of a Mojo build there is no need for
|
|
# the indirection.
|
|
declare_args() {
|
|
# Instead of using is_debug, we introduce a different flag for specifying a
|
|
# Debug build of Dart so that clients can still use a Release build of Dart
|
|
# while themselves doing a Debug build.
|
|
dart_debug = false
|
|
|
|
# Set the runtime mode. This affects how the runtime is built and what
|
|
# features it has. Valid values are:
|
|
# 'develop' (the default) - VM is built to run as a JIT with all development
|
|
# features enabled.
|
|
# 'profile' - The VM is built to run with AOT compiled code with only the
|
|
# CPU profiling features enabled.
|
|
# 'release' - The VM is built to run with AOT compiled code with no developer
|
|
# features enabled.
|
|
dart_runtime_mode = "develop"
|
|
|
|
# Explicitly set the target architecture in case of precompilation. Leaving
|
|
# this unspecified results in automatic target architecture detection.
|
|
# Available options are: arm, arm64, mips, x64 and ia32
|
|
dart_target_arch = ""
|
|
|
|
dart_experimental_interpreter = false
|
|
}
|
|
|
|
config("dart_public_config") {
|
|
include_dirs = [
|
|
".",
|
|
]
|
|
}
|
|
|
|
# Controls PRODUCT #define.
|
|
config("dart_product_config") {
|
|
defines = []
|
|
|
|
if ((dart_runtime_mode != "develop") &&
|
|
(dart_runtime_mode != "profile") &&
|
|
(dart_runtime_mode != "release")) {
|
|
print("Invalid |dart_runtime_mode|")
|
|
assert(false)
|
|
}
|
|
|
|
if (dart_runtime_mode == "release") {
|
|
if (dart_debug) {
|
|
print("Debug and release mode are mutually exclusive.")
|
|
}
|
|
assert(!dart_debug)
|
|
defines += ["PRODUCT"]
|
|
}
|
|
}
|
|
|
|
# Controls DART_PRECOMPILED_RUNTIME #define.
|
|
config("dart_precompiled_runtime_config") {
|
|
defines = []
|
|
|
|
if ((dart_runtime_mode != "develop") &&
|
|
(dart_runtime_mode != "profile") &&
|
|
(dart_runtime_mode != "release")) {
|
|
print("Invalid |dart_runtime_mode|")
|
|
assert(false)
|
|
}
|
|
|
|
if (dart_runtime_mode == "release") {
|
|
if (dart_debug) {
|
|
print("Debug and release mode are mutually exclusive.")
|
|
}
|
|
assert(!dart_debug)
|
|
|
|
if (!dart_experimental_interpreter) {
|
|
defines += ["DART_PRECOMPILED_RUNTIME"]
|
|
}
|
|
} else if (dart_runtime_mode == "profile") {
|
|
if (!dart_experimental_interpreter) {
|
|
defines += ["DART_PRECOMPILED_RUNTIME"]
|
|
}
|
|
}
|
|
}
|
|
|
|
# Controls DART_PRECOMPILER #define.
|
|
config("dart_precompiler_config") {
|
|
defines = []
|
|
defines += ["DART_PRECOMPILER"]
|
|
}
|
|
|
|
config("dart_config") {
|
|
defines = []
|
|
|
|
if (dart_experimental_interpreter) {
|
|
dart_target_arch = "dbc"
|
|
}
|
|
|
|
if (dart_target_arch != "") {
|
|
if (dart_target_arch == "arm") {
|
|
defines += [ "TARGET_ARCH_ARM" ]
|
|
if (target_os == "mac" || target_os == "ios") {
|
|
defines += [ "TARGET_ABI_IOS" ]
|
|
} else {
|
|
defines += [ "TARGET_ABI_EABI" ]
|
|
}
|
|
} 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 if (dart_target_arch == "dbc") {
|
|
defines += [ "TARGET_ARCH_DBC" ]
|
|
} 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 (defined(is_asan) && is_asan) {
|
|
ldflags = [
|
|
"-Wl,-u_sanitizer_options_link_helper",
|
|
"-fsanitize=address",
|
|
]
|
|
}
|
|
}
|
|
|
|
static_library("libdart") {
|
|
configs += [":dart_config",
|
|
":dart_product_config",
|
|
":dart_precompiled_runtime_config"]
|
|
deps = [
|
|
"vm:libdart_lib",
|
|
"vm:libdart_vm",
|
|
"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",
|
|
]
|
|
}
|
|
|
|
action("generate_version_cc_file") {
|
|
deps = [
|
|
":libdart_dependency_helper",
|
|
]
|
|
inputs = [
|
|
"../tools/utils.py",
|
|
"../tools/print_version.py",
|
|
"../tools/VERSION",
|
|
"vm/version_in.cc",
|
|
]
|
|
output = "$target_gen_dir/version.cc"
|
|
outputs = [ output, ]
|
|
|
|
script = "../tools/make_version.py"
|
|
args = [
|
|
"--quiet",
|
|
"--output", rebase_path(output, root_build_dir),
|
|
"--input", rebase_path("vm/version_in.cc", root_build_dir),
|
|
"--ignore_svn_revision",
|
|
]
|
|
}
|
|
|
|
|
|
executable("libdart_dependency_helper") {
|
|
configs += [":dart_config",
|
|
":dart_product_config",
|
|
":dart_precompiled_runtime_config"]
|
|
deps = [
|
|
"vm:libdart_lib_nosnapshot",
|
|
"vm:libdart_lib",
|
|
"vm:libdart_vm",
|
|
"vm:libdart_platform",
|
|
"third_party/double-conversion/src:libdouble_conversion",
|
|
]
|
|
sources = [
|
|
"vm/libdart_dependency_helper.cc",
|
|
]
|
|
}
|