blob: ebb800a6e5430e6878498aee9324c62c5ac2ed25 [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.
import("../../build/executable_suffix.gni")
import("../../sdk/lib/async/async_sources.gni")
import("../../sdk/lib/collection/collection_sources.gni")
import("../../sdk/lib/convert/convert_sources.gni")
import("../../sdk/lib/core/core_sources.gni")
import("../../sdk/lib/developer/developer_sources.gni")
import("../../sdk/lib/internal/internal_sources.gni")
import("../../sdk/lib/isolate/isolate_sources.gni")
import("../../sdk/lib/math/math_sources.gni")
import("../../sdk/lib/mirrors/mirrors_sources.gni")
import("../../sdk/lib/profiler/profiler_sources.gni")
import("../../sdk/lib/typed_data/typed_data_sources.gni")
import("../../sdk/lib/vmservice/vmservice_sources.gni")
import("../../utils/compile_platform.gni")
import("../bin/io_sources.gni")
import("../bin/cli_sources.gni")
import("../lib/async_sources.gni")
import("../lib/collection_sources.gni")
import("../lib/convert_sources.gni")
import("../lib/core_sources.gni")
import("../lib/developer_sources.gni")
import("../lib/internal_sources.gni")
import("../lib/isolate_sources.gni")
import("../lib/math_sources.gni")
import("../lib/mirrors_sources.gni")
import("../lib/profiler_sources.gni")
import("../lib/typed_data_sources.gni")
import("../lib/vmservice_sources.gni")
import("../configs.gni")
import("../runtime_args.gni")
import("compiler/compiler_sources.gni")
import("heap/heap_sources.gni")
import("vm_sources.gni")
config("libdart_vm_config") {
if (is_fuchsia) {
libs = [ "zircon" ]
} else if (is_win) {
libs = [
"advapi32.lib",
"shell32.lib",
"dbghelp.lib",
]
} else {
libs = [ "dl" ]
if (!is_android) {
libs += [ "pthread" ]
}
if (is_linux) {
libs += [ "rt" ]
}
}
}
library_for_all_configs("libdart_vm") {
target_type = "source_set"
if (is_fuchsia) {
extra_deps = [
# TODO(US-399): Remove time_service specific code when it is no longer
# necessary.
"//garnet/public/lib/component/cpp",
"//garnet/public/fidl/fuchsia.timezone",
# TODO(zra): When the platform-specific timeline code is moved out to
# the embedder, this can go away.
"//zircon/public/lib/fbl",
"//zircon/public/lib/trace-engine",
]
}
public_configs = [ ":libdart_vm_config" ]
set_sources_assignment_filter([
"*_test.cc",
"*_test.h",
])
sources = vm_sources + rebase_path(compiler_sources, ".", "./compiler/") +
rebase_path(heap_sources, ".", "./heap/")
include_dirs = [ ".." ]
}
template("process_library_source") {
assert(defined(invoker.libsources), "Need libsources in $target_name")
assert(defined(invoker.output), "Need output in $target_name")
action(target_name) {
visibility = [ ":*" ] # Only targets in this file can see this.
libsources = invoker.libsources
script = invoker.script
inputs = invoker.inputs + libsources
outputs = [
invoker.output,
]
args = invoker.args + rebase_path(libsources, root_build_dir)
}
}
template("generate_library_source") {
assert(defined(invoker.libname), "Need libname in $target_name")
assert(defined(invoker.libsources), "Need libsources in $target_name")
assert(defined(invoker.kind), "Need kind in $target_name")
assert(defined(invoker.output), "Need output in $target_name")
process_library_source(target_name) {
libname = invoker.libname
libsources = invoker.libsources
kind = invoker.kind
script = "../tools/gen_library_src_paths.py"
inputs = [
"../lib/libgen_in.cc",
]
output = invoker.output
args = [
"--output",
rebase_path(invoker.output, root_build_dir),
"--input_cc",
rebase_path("../lib/libgen_in.cc", root_build_dir),
"--include",
"vm/bootstrap.h",
"--var_name",
"dart::Bootstrap::${libname}_${kind}_paths_",
"--library_name",
"dart:${libname}",
]
}
}
# This templates expects invoker.sources to be a list of lists.
# The lists contain the following information about each library:
# library name (string)
# library sources (list of strings)
# library source base path (string)
# filename (string)
# do_patch (boolean)
#
# If do_patch is true, the lists additionally contains
# patch sources (list of strings)
# patch source base path (string)
#
# The template iterates over the list, and generates generate_library_source
# actions for each. After that, it generates targets to compile the generated
# sources to make libdart_lib_*.
template("generate_core_libraries") {
assert(defined(invoker.sources), "Need sources in $target_name")
assert(defined(invoker.allsources), "Need allsources in $target_name")
liboutputs = []
libdeps = []
foreach(lib, invoker.sources) {
libname = lib[0]
filename = lib[3]
do_patch = lib[4]
generate_library_source("generate_${filename}_cc_file") {
libname = libname
libsources = rebase_path(lib[1], ".", lib[2])
kind = "source"
output = "$target_gen_dir/${filename}_gen.cc"
}
if (do_patch) {
generate_library_source("generate_${filename}_patch_cc_file") {
libname = libname
libsources = rebase_path(lib[5], ".", lib[6])
kind = "patch"
output = "$target_gen_dir/${filename}_patch_gen.cc"
}
}
liboutputs += [ "$target_gen_dir/${filename}_gen.cc" ]
libdeps += [ ":generate_${filename}_cc_file" ]
if (do_patch) {
liboutputs += [ "$target_gen_dir/${filename}_patch_gen.cc" ]
libdeps += [ ":generate_${filename}_patch_cc_file" ]
}
}
all_libsources = rebase_path(invoker.allsources, ".", "../lib")
library_for_all_configs("libdart_lib") {
target_type = "source_set"
include_dirs = [ ".." ]
sources = all_libsources
snapshot_sources = [ "bootstrap_nocore.cc" ]
nosnapshot_sources = [ "bootstrap.cc" ] + liboutputs
nosnapshot_deps = libdeps
}
}
generate_core_libraries("core_libraries") {
sources = [
[
"async",
async_sdk_sources,
"../../sdk/lib/async",
"async",
true,
async_runtime_sources,
"../lib",
],
[
"collection",
collection_sdk_sources,
"../../sdk/lib/collection",
"collection",
true,
collection_runtime_sources,
"../lib",
],
[
"convert",
convert_sdk_sources,
"../../sdk/lib/convert",
"convert",
true,
convert_runtime_sources,
"../lib",
],
[
"core",
core_sdk_sources,
"../../sdk/lib/core",
"core",
true,
core_runtime_sources,
"../lib",
],
[
"developer",
developer_sdk_sources,
"../../sdk/lib/developer",
"developer",
true,
developer_runtime_sources,
"../lib",
],
[
"_internal",
internal_sdk_sources,
"../../sdk/lib/internal",
"internal",
true,
internal_runtime_sources,
"../lib",
],
[
"isolate",
isolate_sdk_sources,
"../../sdk/lib/isolate",
"isolate",
true,
isolate_runtime_sources,
"../lib",
],
[
"math",
math_sdk_sources,
"../../sdk/lib/math",
"math",
true,
math_runtime_sources,
"../lib",
],
[
"mirrors",
mirrors_sdk_sources,
"../../sdk/lib/mirrors",
"mirrors",
true,
mirrors_runtime_sources,
"../lib",
],
[
"profiler",
profiler_sdk_sources,
"../../sdk/lib/profiler",
"profiler",
false,
],
[
"typed_data",
typed_data_sdk_sources,
"../../sdk/lib/typed_data",
"typed_data",
true,
typed_data_runtime_sources,
"../lib",
],
[
"_vmservice",
vmservice_sdk_sources,
"../../sdk/lib/vmservice",
"vmservice",
true,
vmservice_runtime_sources,
"../lib",
],
]
allsources = async_runtime_sources + collection_runtime_sources +
convert_runtime_sources + core_runtime_sources +
developer_runtime_sources + internal_runtime_sources +
isolate_runtime_sources + math_runtime_sources +
mirrors_runtime_sources + profiler_runtime_sources +
typed_data_runtime_sources + vmservice_runtime_sources
}
compile_platform("vm_legacy_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../")
libraries_specification_uri = "org-dartlang-sdk:///sdk/lib/libraries.json"
outputs = [
"$root_out_dir/vm_platform.dill",
"$root_out_dir/vm_outline.dill",
]
args = [ "dart:core" ]
}
compile_platform("vm_platform") {
add_implicit_vm_platform_dependency = false
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../")
libraries_specification_uri = "org-dartlang-sdk:///sdk/lib/libraries.json"
outputs = [
"$root_out_dir/vm_platform_strong.dill",
"$root_out_dir/vm_outline_strong.dill",
]
args = [
"--strong-mode",
"dart:core",
]
if (dart_platform_bytecode) {
args += [ "--bytecode" ]
}
}
group("kernel_platform_files") {
public_deps = [
":vm_legacy_platform",
":vm_platform",
]
}