Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: runtime/bin/BUILD.gn

Issue 690923003: Adds GN build files for building in GN based projects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/BUILD.gn
===================================================================
--- runtime/bin/BUILD.gn (revision 0)
+++ runtime/bin/BUILD.gn (revision 0)
@@ -0,0 +1,330 @@
+# 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.
+
+
+declare_args() {
+ dart_io_support = false
+}
+
+
+template("gen_library_src_path") {
+ assert(defined(invoker.sources), "Need sources in $target_name")
+ assert(defined(invoker.output), "Need output in $target_name")
+ action(target_name) {
+ visibility = [ ":*" ] # Only targets in this file can see this.
+ script = "../tools/gen_library_src_paths.py"
+ inputs = [
+ "../tools/gen_library_src_paths.py",
+ "builtin_in.cc",
+ ]
+ outputs = [ invoker.output, ]
+ name = invoker.name
+ kind = invoker.kind
+ args = [
+ "--output", rebase_path(invoker.output, root_build_dir),
+ "--input_cc", rebase_path("builtin_in.cc", root_build_dir),
+ "--include", "bin/builtin.h",
+ "--var_name", "dart::bin::Builtin::${name}_${kind}_paths_",
+ "--library_name", "dart:${name}",] +
+ rebase_path(invoker.sources, root_build_dir)
+ }
+}
+
+
+builtin_sources_gypi =
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("builtin_sources.gypi")],
+ "scope",
+ ["builtin_sources.gypi"])
+
+gen_library_src_path("generate_builtin_cc_file") {
+ name = "_builtin"
+ kind = "source"
+ sources = builtin_sources_gypi.sources
+ output = "$target_gen_dir/builtin_gen.cc"
+}
+
+
+iolib_sources_gypi =
Ivan Posva 2014/11/11 18:26:23 I find it a bit confusing that we are including th
zra 2014/11/11 22:03:34 Needed for gen_snapshot
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("../../sdk/lib/io/iolib_sources.gypi")],
+ "scope",
+ ["../../sdk/lib/io/iolib_sources.gypi"])
+iolib_sources = rebase_path(iolib_sources_gypi.sources, ".", "../../sdk/lib/io")
+
+gen_library_src_path("generate_io_cc_file") {
+ name = "io"
+ kind = "source"
+ sources = ["../../sdk/lib/io/io.dart"] + iolib_sources
+ output = "$target_gen_dir/io_gen.cc"
+}
+
+io_sources_gypi =
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("io_sources.gypi")],
+ "scope",
+ ["io_sources.gypi"])
+
+gen_library_src_path("generate_io_patch_cc_file") {
+ name = "io"
+ kind = "patch"
+ sources = io_sources_gypi.sources
+ output = "$target_gen_dir/io_patch_gen.cc"
+}
+
+
+config("libdart_builtin_config") {
+ libs = [
+ "dl",
+ ]
+}
+
+
+builtin_impl_sources_gypi =
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("builtin_impl_sources.gypi")],
+ "scope",
+ ["builtin_impl_sources.gypi"])
+
+static_library("libdart_builtin") {
+ configs += ["../..:dart_config"]
+ public_configs = [":libdart_builtin_config"]
+ deps = [
+ ":generate_builtin_cc_file",
+ ":generate_io_cc_file",
+ ":generate_io_patch_cc_file",
+ ]
+ include_dirs = [
+ "..",
+ ]
+ set_sources_assignment_filter(["*_test.cc", "*_test.h"])
+ sources = [
+ "log_android.cc",
+ "log_linux.cc",
+ "log_macos.cc",
+ "log_win.cc",
+ ] + builtin_impl_sources_gypi.sources
+}
+
+
+io_impl_sources_gypi =
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("io_impl_sources.gypi")],
+ "scope",
+ ["io_impl_sources.gypi"])
+
+static_library("libdart_io") {
+ configs += ["../..:dart_config"]
+
+ if (dart_io_support) {
+ sources = io_impl_sources_gypi.sources - [
+ "filter_unsupported.cc",
+ "secure_socket_unsupported.cc",
+ "io_service_unsupported.cc",
+ ]
+ # TODO(zra): This would be needed for full IO-enabled VM build.
+ # deps = ["net:libssl_dart",]
+ } else {
+ sources = io_impl_sources_gypi.sources - [
+ "filter.cc",
+ "filter.h",
+ "io_service.cc",
+ "io_service.h",
+ "net/nss_memio.cc",
+ "net/nss_memio.h",
+ "secure_socket.cc",
+ "secure_socket.h",
+ ]
+ }
+ sources += [
+ "io_natives.h",
+ "io_natives.cc",
+ ]
+
+ include_dirs = [
+ "..",
+ ]
+}
+
+
+static_library("libdart_withcore") {
+ configs += ["../..:dart_config"]
+ deps = [
+ "../vm:libdart_lib_withcore",
+ "../vm:libdart_vm",
+ "../vm:libdart_platform",
+ "../third_party/jscre:libjscre",
+ "../third_party/double-conversion/src:libdouble_conversion",
+ "..:generate_version_cc_file",
+ ]
+
+ sources = [
+ "../include/dart_api.h",
+ "../include/dart_debugger_api.h",
+ "../include/dart_mirrors_api.h",
+ "../include/dart_native_api.h",
+ "../vm/dart_api_impl.cc",
+ "../vm/debugger_api_impl.cc",
+ "../vm/mirrors_api_impl.cc",
+ "../vm/native_api_impl.cc",
+ "$target_gen_dir/../version.cc",
+ ]
+
+ include_dirs = [
+ "..",
+ ]
+
+ defines = [
+ "DART_SHARED_LIB",
+ ]
+}
+
+
+executable("gen_snapshot") {
+ configs += ["../..:dart_config"]
+ deps = [
+ ":libdart_withcore",
+ ":libdart_builtin",
+ ]
+
+ sources = [
+ "gen_snapshot.cc",
+ # Very limited native resolver provided.
+ "builtin_gen_snapshot.cc",
+ "builtin.cc",
+ "builtin.h",
+ # Include generated source files.
+ "$target_gen_dir/builtin_gen.cc",
+ "$target_gen_dir/io_gen.cc",
+ "$target_gen_dir/io_patch_gen.cc",
+ ]
+
+ include_dirs = [
+ "..",
+ ]
+}
+
+
+action("generate_snapshot_bin") {
+ deps = [":gen_snapshot"]
+ inputs = [
+ "../tools/create_snapshot_bin.py"
+ ]
+ output = "$target_gen_dir/snapshot_gen.bin"
+ outputs = [output,]
+
+ script = "../tools/create_snapshot_bin.py"
+ args = [
+ "--executable",
+ rebase_path("$root_out_dir/gen_snapshot"),
+ "--output_bin", rebase_path(output, root_build_dir),
+ "--target_os", os
+ ]
+}
+
+
+action("generate_snapshot_file") {
+ deps = [":generate_snapshot_bin"]
+ inputs = [
+ "../tools/create_snapshot_file.py",
+ "snapshot_in.cc",
+ "$target_gen_dir/snapshot_gen.bin",
+ ]
+ output = "$target_gen_dir/snapshot.cc"
+ outputs = [output,]
+
+ script = "../tools/create_snapshot_file.py"
+ args = [
+ "--input_bin", rebase_path("$target_gen_dir/snapshot_gen.bin"),
+ "--input_cc", rebase_path("snapshot_in.cc"),
+ "--output", rebase_path(output),
+ ]
+}
+
+
+resources_sources_gypi =
Ivan Posva 2014/11/11 18:26:23 If we do not have dart:io then including the obser
zra 2014/11/11 22:03:34 Removed
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path("resources_sources.gypi")],
+ "scope",
+ ["resources_sources.gypi"])
+
+action("generate_resources_cc_file") {
+ sources = resources_sources_gypi.sources
+
+ inputs = [
+ "../tools/create_resources.py",
+ # The following two files are used to trigger a rebuild.
+ "vmservice/observatory/deployed/web/index.html",
+ "vmservice/observatory/deployed/web/index.html_bootstrap.dart.js",
+ ] + sources
+ output = "$target_gen_dir/resources_gen.cc"
+ outputs = [output,]
+
+ script = "../tools/create_resources.py"
+ args = [
+ "--output", rebase_path(output),
+ "--outer_namespace", "dart",
+ "--inner_namespace", "bin",
+ "--table_name", "service_bin",
+ "--root_prefix", "bin/",
+ "--client_root", "bin/vmservice/observatory/deployed/",
+ ] + rebase_path(sources)
+}
+
+
+static_library("libdart_embedder_noio") {
+ configs += ["../..:dart_config",]
+ deps = [
+ "..:libdart",
+ "../vm:libdart_platform",
+ ":generate_snapshot_file",
+ ":generate_resources_cc_file",
+ ]
+
+ sources = [
+ "$target_gen_dir/snapshot.cc",
+ "$target_gen_dir/resources_gen.cc",
+ ]
+
+ include_dirs = [
+ "..",
+ ]
+}
+
+
+config("dart_exe_config") {
+ ldflags = [
+ "-rdynamic",
+ ]
+}
+
+
+executable("dart") {
Ivan Posva 2014/11/11 18:26:23 This dart binary will not be usable as it lacks th
zra 2014/11/11 22:03:34 Removed
+ configs += ["../..:dart_config", ":dart_exe_config"]
+ deps = [
+ "..:libdart",
+ ":libdart_builtin",
+ "../vm:libdart_platform",
+ ":libdart_io",
+ ":generate_snapshot_file",
+ ":generate_resources_cc_file",
+ ]
+
+ sources = [
+ "main.cc",
+ "builtin_natives.cc",
+ "builtin_nolib.cc",
+ "builtin.h",
+ "io_natives.h",
+ "vmservice.h",
+ "vmservice_impl.cc",
+ "vmservice_impl.h",
+ "$target_gen_dir/snapshot.cc",
+ "$target_gen_dir/resources_gen.cc",
+ ]
+
+ include_dirs = [
+ "..",
+ ]
+}

Powered by Google App Engine
This is Rietveld 408576698