2019-01-21 14:03:30 -05:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2018-11-25 16:56:04 -05:00
|
|
|
import("//third_party/v8/gni/v8.gni")
|
2018-12-23 17:08:08 -05:00
|
|
|
import("./deno.gni")
|
2018-11-25 16:56:04 -05:00
|
|
|
|
|
|
|
config("deno_config") {
|
|
|
|
include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries.
|
|
|
|
configs = [ "//third_party/v8:external_config" ]
|
2018-12-19 20:07:06 -05:00
|
|
|
cflags = []
|
|
|
|
|
2018-11-25 16:56:04 -05:00
|
|
|
if (is_debug) {
|
|
|
|
defines = [ "DEBUG" ]
|
|
|
|
}
|
2018-12-19 20:07:06 -05:00
|
|
|
|
2018-11-25 16:56:04 -05:00
|
|
|
if (is_clang) {
|
2018-12-19 20:07:06 -05:00
|
|
|
cflags += [
|
2018-11-25 16:56:04 -05:00
|
|
|
"-fcolor-diagnostics",
|
|
|
|
"-fansi-escape-codes",
|
|
|
|
]
|
2019-01-02 21:05:47 -05:00
|
|
|
if (is_debug) {
|
|
|
|
cflags += [ "-glldb" ]
|
|
|
|
}
|
2018-11-25 16:56:04 -05:00
|
|
|
}
|
|
|
|
|
2018-12-13 16:19:17 -05:00
|
|
|
if (is_win) {
|
2018-12-19 20:07:06 -05:00
|
|
|
# The `/Zl` ("omit default library name") flag makes the compiler produce
|
|
|
|
# object files that can link with both the static and dynamic CRT.
|
|
|
|
cflags += [ "/Zl" ]
|
2018-12-13 16:19:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
v8_source_set("v8") {
|
|
|
|
deps = [
|
2018-11-25 16:56:04 -05:00
|
|
|
"//third_party/v8:v8",
|
|
|
|
"//third_party/v8:v8_libbase",
|
|
|
|
"//third_party/v8:v8_libplatform",
|
|
|
|
"//third_party/v8:v8_libsampler",
|
|
|
|
]
|
2018-12-19 20:11:58 -05:00
|
|
|
configs = [ ":deno_config" ]
|
2018-11-25 16:56:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# Only functionality needed for libdeno_test and snapshot_creator
|
|
|
|
# In particular no flatbuffers, no assets, no rust, no msg handlers.
|
|
|
|
# Because snapshots are slow, it's important that snapshot_creator's
|
|
|
|
# dependencies are minimal.
|
2018-12-19 20:11:58 -05:00
|
|
|
v8_source_set("libdeno") {
|
2018-11-25 16:56:04 -05:00
|
|
|
sources = [
|
|
|
|
"api.cc",
|
|
|
|
"binding.cc",
|
|
|
|
"deno.h",
|
|
|
|
"file_util.cc",
|
|
|
|
"file_util.h",
|
|
|
|
"internal.h",
|
|
|
|
]
|
2018-12-13 16:19:17 -05:00
|
|
|
deps = [
|
2018-12-13 15:56:53 -05:00
|
|
|
":v8",
|
2018-12-19 20:11:58 -05:00
|
|
|
]
|
|
|
|
configs = [ ":deno_config" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# The cargo-driven build links with libdeno to pull in all non-rust code.
|
|
|
|
v8_static_library("libdeno_static_lib") {
|
|
|
|
output_name = "libdeno"
|
|
|
|
deps = [
|
|
|
|
":libdeno",
|
2018-12-13 16:19:17 -05:00
|
|
|
"//build/config:shared_library_deps",
|
2018-12-13 15:56:53 -05:00
|
|
|
]
|
2018-12-19 20:11:58 -05:00
|
|
|
configs = [ ":deno_config" ]
|
2018-11-25 16:56:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
v8_executable("snapshot_creator") {
|
|
|
|
sources = [
|
|
|
|
"snapshot_creator.cc",
|
|
|
|
]
|
|
|
|
deps = [
|
|
|
|
":libdeno",
|
|
|
|
]
|
|
|
|
configs = [ ":deno_config" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
v8_executable("test_cc") {
|
|
|
|
testonly = true
|
|
|
|
sources = [
|
|
|
|
"file_util_test.cc",
|
|
|
|
"libdeno_test.cc",
|
|
|
|
"test.cc",
|
|
|
|
]
|
|
|
|
deps = [
|
|
|
|
":libdeno",
|
2018-12-01 01:53:37 -05:00
|
|
|
":snapshot_test",
|
2018-11-25 16:56:04 -05:00
|
|
|
"//testing/gtest:gtest",
|
|
|
|
]
|
|
|
|
data = [
|
2018-12-01 01:53:37 -05:00
|
|
|
"$target_gen_dir/snapshot_test.bin",
|
2018-11-25 16:56:04 -05:00
|
|
|
]
|
|
|
|
snapshot_path = rebase_path(data[0], root_build_dir)
|
|
|
|
defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
|
|
|
|
configs = [ ":deno_config" ]
|
|
|
|
}
|
|
|
|
|
2018-12-01 01:53:37 -05:00
|
|
|
# Generates $target_gen_dir/snapshot_test.bin
|
|
|
|
snapshot("snapshot_test") {
|
2018-11-25 16:56:04 -05:00
|
|
|
testonly = true
|
2018-12-11 13:07:31 -05:00
|
|
|
source_root = "libdeno_test.js"
|
2018-11-25 16:56:04 -05:00
|
|
|
}
|