2019-01-21 14:03:30 -05:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-09-12 15:07:21 -04:00
|
|
|
import("//v8/gni/v8.gni")
|
2018-11-25 16:56:04 -05:00
|
|
|
|
2019-09-06 20:32:58 -04:00
|
|
|
group("default") {
|
|
|
|
testonly = true
|
|
|
|
deps = [
|
|
|
|
":libdeno_static_lib",
|
|
|
|
":libdeno_test",
|
|
|
|
":v8",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-11-25 16:56:04 -05:00
|
|
|
config("deno_config") {
|
2019-09-12 15:07:21 -04:00
|
|
|
include_dirs = [ "//v8" ] # This allows us to v8/src/base/ libraries.
|
|
|
|
configs = [ "//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-09-06 21:43:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_debug && is_clang && !is_win) {
|
|
|
|
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 = [
|
2019-09-12 15:07:21 -04:00
|
|
|
"//v8:v8",
|
|
|
|
"//v8:v8_libbase",
|
|
|
|
"//v8:v8_libplatform",
|
|
|
|
"//v8:v8_libsampler",
|
2018-11-25 16:56:04 -05:00
|
|
|
]
|
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
|
2019-08-26 22:29:51 -04:00
|
|
|
# In particular no assets, no rust, no msg handlers.
|
2018-11-25 16:56:04 -05:00
|
|
|
# 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",
|
2019-04-28 15:31:10 -04:00
|
|
|
"buffer.h",
|
2018-11-25 16:56:04 -05:00
|
|
|
"deno.h",
|
2019-01-29 11:32:40 -05:00
|
|
|
"exceptions.cc",
|
|
|
|
"exceptions.h",
|
2018-11-25 16:56:04 -05:00
|
|
|
"internal.h",
|
2019-01-30 17:21:31 -05:00
|
|
|
"modules.cc",
|
2018-11-25 16:56:04 -05:00
|
|
|
]
|
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
|
|
|
}
|
|
|
|
|
2019-05-01 09:48:56 -04:00
|
|
|
v8_executable("libdeno_test") {
|
2018-11-25 16:56:04 -05:00
|
|
|
testonly = true
|
|
|
|
sources = [
|
|
|
|
"libdeno_test.cc",
|
2019-01-30 17:21:31 -05:00
|
|
|
"modules_test.cc",
|
2018-11-25 16:56:04 -05:00
|
|
|
"test.cc",
|
|
|
|
]
|
|
|
|
deps = [
|
|
|
|
":libdeno",
|
|
|
|
"//testing/gtest:gtest",
|
|
|
|
]
|
|
|
|
data = [
|
2019-06-04 13:35:51 -04:00
|
|
|
"libdeno_test.js",
|
2018-11-25 16:56:04 -05:00
|
|
|
]
|
2019-06-04 13:35:51 -04:00
|
|
|
js_path = rebase_path(data[0])
|
|
|
|
defines = [ "JS_PATH=\"$js_path\"" ]
|
2018-11-25 16:56:04 -05:00
|
|
|
configs = [ ":deno_config" ]
|
|
|
|
}
|