| OLD | NEW |
| 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # TODO(zra): These build arguments should likely be moved to a gni file that is | 5 # TODO(zra): These build arguments should likely be moved to a gni file that is |
| 6 # included in BUILD.gn files that care about the values of the flags. For now, | 6 # included in BUILD.gn files that care about the values of the flags. For now, |
| 7 # since the GN build only happens as part of a Mojo build there is no need for | 7 # since the GN build only happens as part of a Mojo build there is no need for |
| 8 # the indirection. | 8 # the indirection. |
| 9 declare_args() { | 9 declare_args() { |
| 10 # Instead of using is_debug, we introduce a different flag for specifying a | 10 # Instead of using is_debug, we introduce a different flag for specifying a |
| 11 # Debug build of Dart so that clients can still use a Release build of Dart | 11 # Debug build of Dart so that clients can still use a Release build of Dart |
| 12 # while themselves doing a Debug build. | 12 # while themselves doing a Debug build. |
| 13 dart_debug = false | 13 dart_debug = false |
| 14 | 14 |
| 15 # Product mode drops many features (e.g. debugger, profiler, etc) in order to | 15 # Set the runtime mode. This affects how the runtime is built and what |
| 16 # shrink download size and decrease memory and cpu usage. | 16 # features it has. Valid values are: |
| 17 dart_product = false | 17 # 'develop' (the default) - VM is built to run as a JIT with all development |
| 18 # features enabled. |
| 19 # 'profile' - The VM is built to run with AOT compiled code with only the |
| 20 # CPU profiling features enabled. |
| 21 # 'release' - The VM is built to run with AOT compiled code with no developer |
| 22 # features enabled. |
| 23 dart_runtime_mode = "develop" |
| 18 | 24 |
| 19 # Explicitly set the target architecture in case of precompilation. Leaving | 25 # Explicitly set the target architecture in case of precompilation. Leaving |
| 20 # this unspecified results in automatic target architecture detection. | 26 # this unspecified results in automatic target architecture detection. |
| 21 # Available options are: arm, arm64, mips, x64 and ia32 | 27 # Available options are: arm, arm64, mips, x64 and ia32 |
| 22 dart_target_arch = "" | 28 dart_target_arch = "" |
| 23 } | 29 } |
| 24 | 30 |
| 25 config("dart_public_config") { | 31 config("dart_public_config") { |
| 26 include_dirs = [ | 32 include_dirs = [ |
| 27 ".", | 33 ".", |
| 28 ] | 34 ] |
| 29 } | 35 } |
| 30 | 36 |
| 37 # Controls PRODUCT #define. |
| 38 config("dart_product_config") { |
| 39 defines = [] |
| 40 |
| 41 if ((dart_runtime_mode != "develop") && |
| 42 (dart_runtime_mode != "profile") && |
| 43 (dart_runtime_mode != "release")) { |
| 44 print("Invalid |dart_runtime_mode|") |
| 45 assert(false) |
| 46 } |
| 47 |
| 48 if (dart_runtime_mode == "release") { |
| 49 if (dart_debug) { |
| 50 print("Debug and release mode are mutually exclusive.") |
| 51 } |
| 52 assert(!dart_debug) |
| 53 defines += ["PRODUCT"] |
| 54 } |
| 55 } |
| 56 |
| 57 # Controls DART_PRECOMPILED_RUNTIME #define. |
| 58 config("dart_precompiled_runtime_config") { |
| 59 defines = [] |
| 60 |
| 61 if ((dart_runtime_mode != "develop") && |
| 62 (dart_runtime_mode != "profile") && |
| 63 (dart_runtime_mode != "release")) { |
| 64 print("Invalid |dart_runtime_mode|") |
| 65 assert(false) |
| 66 } |
| 67 |
| 68 if (dart_runtime_mode == "release") { |
| 69 if (dart_debug) { |
| 70 print("Debug and release mode are mutually exclusive.") |
| 71 } |
| 72 assert(!dart_debug) |
| 73 defines += ["DART_PRECOMPILED_RUNTIME"] |
| 74 } else if (dart_runtime_mode == "profile") { |
| 75 if (dart_debug) { |
| 76 print("Debug and profile mode are mutually exclusive.") |
| 77 } |
| 78 assert(!dart_debug) |
| 79 defines += ["DART_PRECOMPILED_RUNTIME"] |
| 80 } |
| 81 } |
| 82 |
| 83 # Controls DART_PRECOMPILER #define. |
| 84 config("dart_precompiler_config") { |
| 85 defines = [] |
| 86 defines += ["DART_PRECOMPILER"] |
| 87 } |
| 88 |
| 31 config("dart_config") { | 89 config("dart_config") { |
| 32 defines = [] | 90 defines = [] |
| 33 | 91 |
| 34 if (dart_target_arch != "") { | 92 if (dart_target_arch != "") { |
| 35 if (dart_target_arch == "arm") { | |
| 36 defines += [ "TARGET_ARCH_ARM" ] | |
| 37 } else if (dart_target_arch == "arm64") { | |
| 38 defines += [ "TARGET_ARCH_ARM64" ] | |
| 39 } else if (dart_target_arch == "mips") { | |
| 40 defines += [ "TARGET_ARCH_MIPS" ] | |
| 41 } else if (dart_target_arch == "x64") { | |
| 42 defines += [ "TARGET_ARCH_X64" ] | |
| 43 } else if (dart_target_arch == "ia32") { | |
| 44 defines += [ "TARGET_ARCH_IA32" ] | |
| 45 } else if (dart_target_arch == "dbc") { | |
| 46 defines += [ "TARGET_ARCH_DBC" ] | |
| 47 } else { | |
| 48 print("Invalid |dart_target_arch|") | |
| 49 assert(false) | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 if (dart_debug) { | |
| 54 defines += ["DEBUG"] | |
| 55 } else { | |
| 56 defines += ["NDEBUG"] | |
| 57 } | |
| 58 | |
| 59 if (dart_product) { | |
| 60 if (dart_debug) { | |
| 61 print("Debug and product mode are mutually exclusive.") | |
| 62 } | |
| 63 assert(!dart_debug) | |
| 64 defines += ["PRODUCT"] | |
| 65 } | |
| 66 | |
| 67 # Ideally this would only be enabled for gen_snapshot | |
| 68 defines += ["DART_PRECOMPILER"] | |
| 69 | |
| 70 cflags = [ | |
| 71 "-Werror", | |
| 72 "-Wall", | |
| 73 "-Wextra", # Also known as -W. | |
| 74 "-Wno-unused-parameter", | |
| 75 "-Wnon-virtual-dtor", | |
| 76 "-Wvla", | |
| 77 "-Wno-conversion-null", | |
| 78 "-Woverloaded-virtual", | |
| 79 "-g3", | |
| 80 "-ggdb3", | |
| 81 "-fno-rtti", | |
| 82 "-fno-exceptions", | |
| 83 ] | |
| 84 | |
| 85 if (dart_debug) { | |
| 86 cflags += [ | |
| 87 "-O1", | |
| 88 ] | |
| 89 } else { | |
| 90 cflags += [ | |
| 91 "-O3", | |
| 92 ] | |
| 93 } | |
| 94 | |
| 95 if (is_asan) { | |
| 96 ldflags = [ | |
| 97 "-Wl,-u_sanitizer_options_link_helper", | |
| 98 "-fsanitize=address", | |
| 99 ] | |
| 100 } | |
| 101 } | |
| 102 | |
| 103 config("dart_config_no_precompiler") { | |
| 104 defines = [] | |
| 105 | |
| 106 if (dart_target_arch != "") { | |
| 107 if (dart_target_arch == "arm") { | 93 if (dart_target_arch == "arm") { |
| 108 defines += [ "TARGET_ARCH_ARM" ] | 94 defines += [ "TARGET_ARCH_ARM" ] |
| 109 } else if (dart_target_arch == "arm64") { | 95 } else if (dart_target_arch == "arm64") { |
| 110 defines += [ "TARGET_ARCH_ARM64" ] | 96 defines += [ "TARGET_ARCH_ARM64" ] |
| 111 } else if (dart_target_arch == "mips") { | 97 } else if (dart_target_arch == "mips") { |
| 112 defines += [ "TARGET_ARCH_MIPS" ] | 98 defines += [ "TARGET_ARCH_MIPS" ] |
| 113 } else if (dart_target_arch == "x64") { | 99 } else if (dart_target_arch == "x64") { |
| 114 defines += [ "TARGET_ARCH_X64" ] | 100 defines += [ "TARGET_ARCH_X64" ] |
| 115 } else if (dart_target_arch == "ia32") { | 101 } else if (dart_target_arch == "ia32") { |
| 116 defines += [ "TARGET_ARCH_IA32" ] | 102 defines += [ "TARGET_ARCH_IA32" ] |
| 117 } else if (dart_target_arch == "dbc") { | 103 } else if (dart_target_arch == "dbc") { |
| 118 defines += [ "TARGET_ARCH_DBC" ] | 104 defines += [ "TARGET_ARCH_DBC" ] |
| 119 } else { | 105 } else { |
| 120 print("Invalid |dart_target_arch|") | 106 print("Invalid |dart_target_arch|") |
| 121 assert(false) | 107 assert(false) |
| 122 } | 108 } |
| 123 } | 109 } |
| 124 | 110 |
| 125 if (dart_debug) { | 111 if (dart_debug) { |
| 126 defines += ["DEBUG"] | 112 defines += ["DEBUG"] |
| 127 } else { | 113 } else { |
| 128 defines += ["NDEBUG"] | 114 defines += ["NDEBUG"] |
| 129 } | 115 } |
| 130 | 116 |
| 131 if (dart_product) { | |
| 132 if (dart_debug) { | |
| 133 print("Debug and product mode are mutually exclusive.") | |
| 134 } | |
| 135 assert(!dart_debug) | |
| 136 defines += ["PRODUCT"] | |
| 137 } | |
| 138 | |
| 139 cflags = [ | 117 cflags = [ |
| 140 "-Werror", | 118 "-Werror", |
| 141 "-Wall", | 119 "-Wall", |
| 142 "-Wextra", # Also known as -W. | 120 "-Wextra", # Also known as -W. |
| 143 "-Wno-unused-parameter", | 121 "-Wno-unused-parameter", |
| 144 "-Wnon-virtual-dtor", | 122 "-Wnon-virtual-dtor", |
| 145 "-Wvla", | 123 "-Wvla", |
| 146 "-Wno-conversion-null", | 124 "-Wno-conversion-null", |
| 147 "-Woverloaded-virtual", | 125 "-Woverloaded-virtual", |
| 148 "-g3", | 126 "-g3", |
| (...skipping 13 matching lines...) Expand all Loading... |
| 162 } | 140 } |
| 163 | 141 |
| 164 if (is_asan) { | 142 if (is_asan) { |
| 165 ldflags = [ | 143 ldflags = [ |
| 166 "-Wl,-u_sanitizer_options_link_helper", | 144 "-Wl,-u_sanitizer_options_link_helper", |
| 167 "-fsanitize=address", | 145 "-fsanitize=address", |
| 168 ] | 146 ] |
| 169 } | 147 } |
| 170 } | 148 } |
| 171 | 149 |
| 172 | |
| 173 static_library("libdart") { | 150 static_library("libdart") { |
| 174 configs += [":dart_config"] | 151 configs += [":dart_config", |
| 152 ":dart_product_config", |
| 153 ":dart_precompiled_runtime_config"] |
| 175 deps = [ | 154 deps = [ |
| 176 "vm:libdart_lib", | 155 "vm:libdart_lib", |
| 177 "vm:libdart_vm", | 156 "vm:libdart_vm", |
| 178 "third_party/double-conversion/src:libdouble_conversion", | 157 "third_party/double-conversion/src:libdouble_conversion", |
| 179 ":generate_version_cc_file", | 158 ":generate_version_cc_file", |
| 180 ] | 159 ] |
| 181 include_dirs = [ | 160 include_dirs = [ |
| 182 ".", | 161 ".", |
| 183 ] | 162 ] |
| 184 public_configs = [":dart_public_config"] | 163 public_configs = [":dart_public_config"] |
| 185 sources = [ | 164 sources = [ |
| 186 "include/dart_api.h", | 165 "include/dart_api.h", |
| 187 "include/dart_mirrors_api.h", | 166 "include/dart_mirrors_api.h", |
| 188 "include/dart_native_api.h", | 167 "include/dart_native_api.h", |
| 189 "include/dart_tools_api.h", | 168 "include/dart_tools_api.h", |
| 190 "vm/dart_api_impl.cc", | 169 "vm/dart_api_impl.cc", |
| 191 "vm/debugger_api_impl.cc", | 170 "vm/debugger_api_impl.cc", |
| 192 "vm/mirrors_api_impl.cc", | 171 "vm/mirrors_api_impl.cc", |
| 193 "vm/native_api_impl.cc", | 172 "vm/native_api_impl.cc", |
| 194 "vm/version.h", | 173 "vm/version.h", |
| 195 "$target_gen_dir/version.cc", | 174 "$target_gen_dir/version.cc", |
| 196 ] | 175 ] |
| 197 } | 176 } |
| 198 | 177 |
| 199 | |
| 200 static_library("libdart_precompiled_runtime") { | |
| 201 configs += [":dart_config_no_precompiler"] | |
| 202 deps = [ | |
| 203 "vm:libdart_lib_precompiled_runtime", | |
| 204 "vm:libdart_vm_precompiled_runtime", | |
| 205 "third_party/double-conversion/src:libdouble_conversion", | |
| 206 ":generate_version_cc_file", | |
| 207 ] | |
| 208 include_dirs = [ | |
| 209 ".", | |
| 210 ] | |
| 211 public_configs = [":dart_public_config"] | |
| 212 sources = [ | |
| 213 "include/dart_api.h", | |
| 214 "include/dart_mirrors_api.h", | |
| 215 "include/dart_native_api.h", | |
| 216 "include/dart_tools_api.h", | |
| 217 "vm/dart_api_impl.cc", | |
| 218 "vm/debugger_api_impl.cc", | |
| 219 "vm/mirrors_api_impl.cc", | |
| 220 "vm/native_api_impl.cc", | |
| 221 "vm/version.h", | |
| 222 "$target_gen_dir/version.cc", | |
| 223 ] | |
| 224 defines = [ | |
| 225 "DART_PRECOMPILED_RUNTIME", | |
| 226 ] | |
| 227 } | |
| 228 | |
| 229 | |
| 230 action("generate_version_cc_file") { | 178 action("generate_version_cc_file") { |
| 231 deps = [ | 179 deps = [ |
| 232 ":libdart_dependency_helper", | 180 ":libdart_dependency_helper", |
| 233 ] | 181 ] |
| 234 inputs = [ | 182 inputs = [ |
| 235 "../tools/utils.py", | 183 "../tools/utils.py", |
| 236 "../tools/print_version.py", | 184 "../tools/print_version.py", |
| 237 "../tools/VERSION", | 185 "../tools/VERSION", |
| 238 "vm/version_in.cc", | 186 "vm/version_in.cc", |
| 239 ] | 187 ] |
| 240 output = "$target_gen_dir/version.cc" | 188 output = "$target_gen_dir/version.cc" |
| 241 outputs = [ output, ] | 189 outputs = [ output, ] |
| 242 | 190 |
| 243 script = "../tools/make_version.py" | 191 script = "../tools/make_version.py" |
| 244 args = [ | 192 args = [ |
| 245 "--quiet", | 193 "--quiet", |
| 246 "--output", rebase_path(output, root_build_dir), | 194 "--output", rebase_path(output, root_build_dir), |
| 247 "--input", rebase_path("vm/version_in.cc", root_build_dir), | 195 "--input", rebase_path("vm/version_in.cc", root_build_dir), |
| 248 "--ignore_svn_revision", | 196 "--ignore_svn_revision", |
| 249 ] | 197 ] |
| 250 } | 198 } |
| 251 | 199 |
| 252 | 200 |
| 253 executable("libdart_dependency_helper") { | 201 executable("libdart_dependency_helper") { |
| 254 configs += [":dart_config"] | 202 configs += [":dart_config", |
| 203 ":dart_product_config", |
| 204 ":dart_precompiled_runtime_config"] |
| 255 deps = [ | 205 deps = [ |
| 256 "vm:libdart_lib_nosnapshot", | 206 "vm:libdart_lib_nosnapshot", |
| 257 "vm:libdart_lib", | 207 "vm:libdart_lib", |
| 258 "vm:libdart_vm", | 208 "vm:libdart_vm", |
| 259 "vm:libdart_platform", | 209 "vm:libdart_platform", |
| 260 "third_party/double-conversion/src:libdouble_conversion", | 210 "third_party/double-conversion/src:libdouble_conversion", |
| 261 ] | 211 ] |
| 262 sources = [ | 212 sources = [ |
| 263 "vm/libdart_dependency_helper.cc", | 213 "vm/libdart_dependency_helper.cc", |
| 264 ] | 214 ] |
| 265 } | 215 } |
| OLD | NEW |