| Index: runtime/BUILD.gn
|
| diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
|
| index d4cd0bccf55b79682ae4836a590c4ef91ff591a9..bd091d9ae67f4d8a9e75022ed480d0d5961f509c 100644
|
| --- a/runtime/BUILD.gn
|
| +++ b/runtime/BUILD.gn
|
| @@ -12,9 +12,15 @@ declare_args() {
|
| # while themselves doing a Debug build.
|
| dart_debug = false
|
|
|
| - # Product mode drops many features (e.g. debugger, profiler, etc) in order to
|
| - # shrink download size and decrease memory and cpu usage.
|
| - dart_product = 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.
|
| @@ -28,79 +34,59 @@ config("dart_public_config") {
|
| ]
|
| }
|
|
|
| -config("dart_config") {
|
| +# Controls PRODUCT #define.
|
| +config("dart_product_config") {
|
| 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 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"]
|
| + if ((dart_runtime_mode != "develop") &&
|
| + (dart_runtime_mode != "profile") &&
|
| + (dart_runtime_mode != "release")) {
|
| + print("Invalid |dart_runtime_mode|")
|
| + assert(false)
|
| }
|
|
|
| - if (dart_product) {
|
| + if (dart_runtime_mode == "release") {
|
| if (dart_debug) {
|
| - print("Debug and product mode are mutually exclusive.")
|
| + print("Debug and release mode are mutually exclusive.")
|
| }
|
| assert(!dart_debug)
|
| defines += ["PRODUCT"]
|
| }
|
| +}
|
|
|
| - # Ideally this would only be enabled for gen_snapshot
|
| - defines += ["DART_PRECOMPILER"]
|
| -
|
| - 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",
|
| - ]
|
| +# Controls DART_PRECOMPILED_RUNTIME #define.
|
| +config("dart_precompiled_runtime_config") {
|
| + defines = []
|
|
|
| - if (dart_debug) {
|
| - cflags += [
|
| - "-O1",
|
| - ]
|
| - } else {
|
| - cflags += [
|
| - "-O3",
|
| - ]
|
| + if ((dart_runtime_mode != "develop") &&
|
| + (dart_runtime_mode != "profile") &&
|
| + (dart_runtime_mode != "release")) {
|
| + print("Invalid |dart_runtime_mode|")
|
| + assert(false)
|
| }
|
|
|
| - if (is_asan) {
|
| - ldflags = [
|
| - "-Wl,-u_sanitizer_options_link_helper",
|
| - "-fsanitize=address",
|
| - ]
|
| + if (dart_runtime_mode == "release") {
|
| + if (dart_debug) {
|
| + print("Debug and release mode are mutually exclusive.")
|
| + }
|
| + assert(!dart_debug)
|
| + defines += ["DART_PRECOMPILED_RUNTIME"]
|
| + } else if (dart_runtime_mode == "profile") {
|
| + if (dart_debug) {
|
| + print("Debug and profile mode are mutually exclusive.")
|
| + }
|
| + assert(!dart_debug)
|
| + defines += ["DART_PRECOMPILED_RUNTIME"]
|
| }
|
| }
|
|
|
| -config("dart_config_no_precompiler") {
|
| +# Controls DART_PRECOMPILER #define.
|
| +config("dart_precompiler_config") {
|
| + defines = []
|
| + defines += ["DART_PRECOMPILER"]
|
| +}
|
| +
|
| +config("dart_config") {
|
| defines = []
|
|
|
| if (dart_target_arch != "") {
|
| @@ -128,14 +114,6 @@ config("dart_config_no_precompiler") {
|
| defines += ["NDEBUG"]
|
| }
|
|
|
| - if (dart_product) {
|
| - if (dart_debug) {
|
| - print("Debug and product mode are mutually exclusive.")
|
| - }
|
| - assert(!dart_debug)
|
| - defines += ["PRODUCT"]
|
| - }
|
| -
|
| cflags = [
|
| "-Werror",
|
| "-Wall",
|
| @@ -169,9 +147,10 @@ config("dart_config_no_precompiler") {
|
| }
|
| }
|
|
|
| -
|
| static_library("libdart") {
|
| - configs += [":dart_config"]
|
| + configs += [":dart_config",
|
| + ":dart_product_config",
|
| + ":dart_precompiled_runtime_config"]
|
| deps = [
|
| "vm:libdart_lib",
|
| "vm:libdart_vm",
|
| @@ -196,37 +175,6 @@ 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 = [
|
| - "DART_PRECOMPILED_RUNTIME",
|
| - ]
|
| -}
|
| -
|
| -
|
| action("generate_version_cc_file") {
|
| deps = [
|
| ":libdart_dependency_helper",
|
| @@ -251,7 +199,9 @@ action("generate_version_cc_file") {
|
|
|
|
|
| executable("libdart_dependency_helper") {
|
| - configs += [":dart_config"]
|
| + configs += [":dart_config",
|
| + ":dart_product_config",
|
| + ":dart_precompiled_runtime_config"]
|
| deps = [
|
| "vm:libdart_lib_nosnapshot",
|
| "vm:libdart_lib",
|
|
|