summaryrefslogtreecommitdiff
path: root/libdeno/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'libdeno/BUILD.gn')
-rw-r--r--libdeno/BUILD.gn98
1 files changed, 98 insertions, 0 deletions
diff --git a/libdeno/BUILD.gn b/libdeno/BUILD.gn
new file mode 100644
index 000000000..5cd774eaa
--- /dev/null
+++ b/libdeno/BUILD.gn
@@ -0,0 +1,98 @@
+# 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) {
+ 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 = [
+ ":create_snapshot_libdeno_test",
+ ":libdeno",
+ "//testing/gtest:gtest",
+ ]
+ data = [
+ "$target_gen_dir/snapshot_libdeno_test.bin",
+ ]
+ snapshot_path = rebase_path(data[0], root_build_dir)
+ defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
+ configs = [ ":deno_config" ]
+}
+
+# Generates $target_gen_dir/snapshot_libdeno_test.bin
+create_snapshot("libdeno_test") {
+ testonly = true
+ js = "libdeno_test.js"
+}