blob: bff1387bb54f433cbaa90227fa1be7f04818c298 [file] [log] [blame]
# 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
dart_boringssl_path = "../../third_party/boringssl"
}
resources_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("vmservice/vmservice_sources.gypi")],
"scope",
["vmservice/vmservice_sources.gypi"])
# Generate a resources.cc file for the service isolate without Observatory.
action("gen_resources_cc") {
visibility = [ ":*" ] # Only targets in this file can see this.
script = "../tools/create_resources.py"
inputs = [
"../tools/create_resources.py",
]
# The path below is hard coded for the Mojo and Flutter trees. When moving
# the Dart runtime to gn, this path might need to be updated.
sources = rebase_path(resources_sources_gypi.sources,
"",
"//dart/runtime/bin/vmservice/")
outputs = [ "$target_gen_dir/resources_gen.cc" ]
args = [
"--output",
rebase_path("$target_gen_dir/resources_gen.cc", root_build_dir),
"--outer_namespace", "dart",
"--inner_namespace", "bin",
"--table_name", "service_bin",
"--root_prefix", rebase_path(".", root_build_dir) + "/",
] + rebase_path(sources, root_build_dir)
}
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"
}
sdk_io_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("../../sdk/lib/io/io_sources.gypi")],
"scope",
["../../sdk/lib/io/io_sources.gypi"])
sdk_io_sources =
rebase_path(sdk_io_sources_gypi.sources, ".", "../../sdk/lib/io")
gen_library_src_path("generate_io_cc_file") {
name = "io"
kind = "source"
sources = ["../../sdk/lib/io/io.dart"] + sdk_io_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", "..:dart_product_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
}
static_library("libdart_nosnapshot") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
deps = [
"../vm:libdart_lib_nosnapshot",
"../vm:libdart_vm_nosnapshot",
"../vm:libdart_platform",
"../third_party/double-conversion/src:libdouble_conversion",
"..:generate_version_cc_file",
]
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",
"$target_gen_dir/../version.cc",
]
include_dirs = [
"..",
]
defines = [
"DART_SHARED_LIB",
]
}
static_library("libdart_nosnapshot_with_precompiler") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiler_config"]
deps = [
"../vm:libdart_lib_nosnapshot_with_precompiler",
"../vm:libdart_vm_nosnapshot_with_precompiler",
"../vm:libdart_platform",
"../third_party/double-conversion/src:libdouble_conversion",
"..:generate_version_cc_file",
]
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",
"$target_gen_dir/../version.cc",
]
include_dirs = [
"..",
]
defines = [
"DART_SHARED_LIB",
]
}
executable("gen_snapshot") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiler_config"]
deps = [
":gen_resources_cc",
":gen_snapshot_dart_io",
":generate_builtin_cc_file",
":generate_io_cc_file",
":generate_io_patch_cc_file",
":libdart_builtin",
":libdart_nosnapshot_with_precompiler",
]
sources = [
"address_sanitizer.cc",
"gen_snapshot.cc",
# Very limited native resolver provided.
"builtin_common.cc",
"builtin_gen_snapshot.cc",
"builtin.cc",
"builtin.h",
"vmservice_impl.cc",
"vmservice_impl.h",
# Include generated source files.
"$target_gen_dir/builtin_gen.cc",
"$target_gen_dir/io_gen.cc",
"$target_gen_dir/io_patch_gen.cc",
"$target_gen_dir/resources_gen.cc",
]
include_dirs = [
"..",
]
}
source_set("libdart_embedder_noio") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
deps = [
"..:libdart",
"../vm:libdart_platform",
]
}
io_impl_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("io_impl_sources.gypi") ],
"scope",
[ "io_impl_sources.gypi" ])
# A source set for the implementation of 'dart:io' library
# (without secure sockets) suitable for linking with gen_snapshot.
source_set("gen_snapshot_dart_io") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiler_config"]
deps = [
"//third_party/zlib",
]
custom_sources_filter = [
"*_test.cc",
"*_test.h",
"builtin.cc",
"builtin_common.cc",
"builtin_gen_snapshot.cc",
]
if (!is_mac && !is_ios) {
# Dart tree uses *_macos.* instead of *_mac.*
custom_sources_filter += [
"*_macos.h",
"*_macos.cc",
]
}
set_sources_assignment_filter(custom_sources_filter)
defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
sources = io_impl_sources_gypi.sources + builtin_impl_sources_gypi.sources
sources += [
"io_natives.cc",
"io_natives.h",
]
include_dirs = [
"..",
"//third_party"
]
}
# A source set for the implementation of 'dart:io' library
# (without secure sockets).
source_set("embedded_dart_io") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
custom_sources_filter = [
"*_test.cc",
"*_test.h",
"builtin.cc",
"builtin_gen_snapshot.cc",
]
if (!is_mac && !is_ios) {
# Dart tree uses *_macos.* instead of *_mac.*
custom_sources_filter += [
"*_macos.h",
"*_macos.cc",
]
}
set_sources_assignment_filter(custom_sources_filter)
if (is_mac || is_ios) {
libs = [
"Security.framework",
]
} else {
deps = [
rebase_path(dart_boringssl_path, "."),
]
}
sources = io_impl_sources_gypi.sources + builtin_impl_sources_gypi.sources
sources += [
"builtin_nolib.cc",
"builtin_natives.cc",
"io_natives.cc",
"io_natives.h",
"embedded_dart_io.cc",
"embedded_dart_io.h",
"log_android.cc",
"log_linux.cc",
"log_macos.cc",
"log_win.cc",
"log.h",
]
include_dirs = [
"..",
"//third_party"
]
}