blob: 1185ee464cc68a2df8e9062fb1d3c2ad25f9be06 [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
}
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 =
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
}
static_library("libdart_nosnapshot") {
configs += ["..:dart_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",
]
}
executable("gen_snapshot") {
configs += ["..:dart_config"]
deps = [
":generate_builtin_cc_file",
":generate_io_cc_file",
":generate_io_patch_cc_file",
":libdart_builtin",
":libdart_nosnapshot",
]
sources = [
"address_sanitizer.cc",
"gen_snapshot.cc",
# Very limited native resolver provided.
"builtin_common.cc",
"builtin_gen_snapshot.cc",
"builtin.cc",
"builtin.h",
"platform_android.cc",
"platform_linux.cc",
"platform_macos.cc",
"platform_win.cc",
"platform.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 = [
"..",
]
}
source_set("libdart_embedder_noio") {
configs += ["..:dart_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).
source_set("embedded_dart_io") {
configs += ["..:dart_config",]
# Set custom sources assignment filter. The custom filters does three things:
# 1) Filters out unnecessary files pulled in from the gypi files.
# 2) Filters out secure socket support.
# 3) Enables dart:io by filtering out _unsupported.cc implementations.
custom_sources_filter = [
"*net/nss_memio.cc",
"*net/nss_memio.h",
"*secure_socket.cc",
"*secure_socket.h",
"*filter_unsupported.cc",
"*io_service_unsupported.cc",
"*io_service.cc",
"*io_service.h",
"*_test.cc",
"*_test.h",
"*dbg*",
"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)
defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
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"
]
}