blob: bb568895771edf0a9283ff50654395b76c4ecc67 [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.
config("libdart_vm_config") {
# TODO(zra, jamesr): This check can go away after some problems with the
# fuchsia toolchain definition are fixed.
if (!defined(is_fuchsia) || !is_fuchsia) {
libs = [ "dl" ]
if (!is_android) {
libs += [ "pthread" ]
if (is_linux) {
libs += [ "rt" ]
}
}
}
}
static_library("libdart_platform") {
configs += ["..:dart_config", "..:dart_product_config"]
public_configs = [":libdart_vm_config"]
platform_headers_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("../platform/platform_headers.gypi")],
"scope",
["../platform/platform_headers.gypi"])
platform_headers =
rebase_path(platform_headers_gypi.sources, ".", "../platform")
platform_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("../platform/platform_sources.gypi")],
"scope",
["../platform/platform_sources.gypi"])
platform_sources =
rebase_path(platform_sources_gypi.sources, ".", "../platform")
sources = platform_headers + platform_sources
include_dirs = [
"..",
]
}
vm_sources_list = exec_script("../../tools/gypi_to_gn.py",
[rebase_path("vm_sources.gypi")],
"scope",
["vm_sources.gypi"])
static_library("libdart_vm") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
public_configs = [":libdart_vm_config"]
set_sources_assignment_filter(["*_test.cc", "*_test.h"])
sources = vm_sources_list.sources
include_dirs = [
"..",
]
}
static_library("libdart_vm_nosnapshot") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
public_configs = [":libdart_vm_config"]
defines = [ "DART_NO_SNAPSHOT" ]
set_sources_assignment_filter(["*_test.cc", "*_test.h"])
sources = vm_sources_list.sources
include_dirs = [
"..",
]
}
static_library("libdart_vm_nosnapshot_with_precompiler") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiler_config"]
public_configs = [":libdart_vm_config"]
defines = [ "DART_NO_SNAPSHOT" ]
set_sources_assignment_filter(["*_test.cc", "*_test.h"])
sources = vm_sources_list.sources
include_dirs = [
"..",
]
}
template("generate_library_source") {
assert(defined(invoker.libname), "Need libname in $target_name")
assert(defined(invoker.filename), "Need a filename in $target_name")
assert(defined(invoker.kind), "Need kind in $target_name")
assert(defined(invoker.output), "Need output in $target_name")
assert(defined(invoker.path), "Need path in $target_name")
action(target_name) {
visibility = [ ":*" ] # Only targets in this file can see this.
libname = invoker.libname
filename = invoker.filename
kind = invoker.kind
path = invoker.path
lib_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("${path}/${filename}_sources.gypi")],
"scope",
["${path}/${filename}_sources.gypi"])
lib_sources =
rebase_path(lib_sources_gypi.sources, ".", path)
script = "../tools/gen_library_src_paths.py"
inputs = [
"../tools/gen_library_src_paths.py",
"../lib/libgen_in.cc",
]
inputs += lib_sources
outputs = [ 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}",] +
rebase_path(lib_sources, root_build_dir)
}
}
# This templates expects invoker.sources to be a list of pairs of strings.
# The pairs of strings mean the following.
# library name, file name
# e.g. for the "internal" library named "dart:_internal",
# with sources listed at sdk/lib/internal/internal_sources.gypi and
# lib/internal_sources.gypi, we have: ["_internal", "internal"]
#
# 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_nosnapshot and libdart_lib.
template("generate_core_libraries") {
assert(defined(invoker.sources), "Need sources in $target_name")
liboutputs = []
libsources = []
libdeps = []
foreach(lib, invoker.sources) {
libname = lib[0]
filename = lib[1]
do_patch = lib[2]
source_path = lib[3]
generate_library_source("generate_${filename}_cc_file") {
libname = libname
filename = filename
kind = "source"
path = source_path
output = "$target_gen_dir/${filename}_gen.cc"
}
if (do_patch) {
patch_path = lib[4]
generate_library_source("generate_${filename}_patch_cc_file") {
libname = libname
filename = filename
kind = "patch"
path = patch_path
output = "$target_gen_dir/${filename}_patch_gen.cc"
}
}
lib_sources_gypi =
exec_script("../../tools/gypi_to_gn.py",
[rebase_path("../lib/${filename}_sources.gypi")],
"scope",
["../lib/${filename}_sources.gypi"])
libsources += rebase_path(lib_sources_gypi.sources, ".", "../lib")
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"]
}
}
static_library("libdart_lib_nosnapshot") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
deps = libdeps
sources = libsources + ["bootstrap.cc"] + liboutputs
include_dirs = [
"..",
]
}
static_library("libdart_lib_nosnapshot_with_precompiler") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiler_config" ]
deps = libdeps
sources = libsources + [ "bootstrap.cc"] + liboutputs
include_dirs = [
"..",
]
}
static_library("libdart_lib") {
configs += ["..:dart_config",
"..:dart_product_config",
"..:dart_precompiled_runtime_config"]
sources = libsources + [ "bootstrap_nocore.cc"]
include_dirs = [
"..",
]
}
}
generate_core_libraries("core_libraries") {
sources = [
["async", "async", true, "../../sdk/lib/async", "../lib"],
["core", "core", true, "../../sdk/lib/core", "../lib"],
["collection", "collection", true, "../../sdk/lib/collection", "../lib"],
["convert", "convert", true, "../../sdk/lib/convert", "../lib"],
["developer", "developer", true, "../../sdk/lib/developer", "../lib"],
["_internal", "internal", true, "../../sdk/lib/internal", "../lib"],
["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"],
["math", "math", true, "../../sdk/lib/math", "../lib"],
["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"],
["profiler", "profiler", false, "../../sdk/lib/profiler"],
["typed_data", "typed_data", false, "../lib"],
["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"],
]
}