deno/libdeno/BUILD.gn
Ryan Dahl f230734623 build: snapshot doesn't need source_map
Continuation of the work done in c113df.
2018-12-11 15:06:21 -05:00

103 lines
2.4 KiB
Plaintext

# Copyright 2018 the Deno authors. All rights reserved. MIT license.
import("./deno.gni")
import("//third_party/v8/gni/v8.gni")
config("deno_config") {
include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries.
configs = [ "//third_party/v8:external_config" ]
if (is_debug) {
defines = [ "DEBUG" ]
}
if (is_clang) {
cflags = [
"-fcolor-diagnostics",
"-fansi-escape-codes",
]
}
}
v8_static_library("v8") {
public_deps = [
"//build/win:default_exe_manifest",
"//third_party/v8:v8",
"//third_party/v8:v8_libbase",
"//third_party/v8:v8_libplatform",
"//third_party/v8:v8_libsampler",
]
configs = [ ":deno_config" ]
}
# 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.
v8_static_library("libdeno") {
configs = [ ":deno_config" ]
sources = [
"api.cc",
"binding.cc",
"deno.h",
"file_util.cc",
"file_util.h",
"internal.h",
]
if (!use_prebuilt_v8) {
public_deps = [
":v8",
]
} else {
# TODO(ry) It would be nice to have a standalone target for the prebuilt
# library that could simply be added to the deps here, but it wasn't
# obvious how to accomplish that in gn.
if (is_mac) {
libs = [ "//prebuilt/mac/libv8.a" ]
} else if (is_linux) {
libs = [ "//prebuilt/linux64/libv8.a" ]
} else if (is_win) {
if (is_debug) {
libs = [ "//prebuilt/win/v8_debug.lib" ]
} else {
libs = [ "//prebuilt/win/v8.lib" ]
}
} else {
assert(false, "We don't have prebuilt binaries for this platform yet.")
}
}
}
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",
":snapshot_test",
"//testing/gtest:gtest",
]
data = [
"$target_gen_dir/snapshot_test.bin",
]
snapshot_path = rebase_path(data[0], root_build_dir)
defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
configs = [ ":deno_config" ]
}
# Generates $target_gen_dir/snapshot_test.bin
snapshot("snapshot_test") {
testonly = true
source_root = "libdeno_test.js"
}