Address a few TODOs in the gn config
authorjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 5 Jun 2014 08:45:24 +0000 (08:45 +0000)
committerjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 5 Jun 2014 08:45:24 +0000 (08:45 +0000)
- add direct dependant settings
- only compile mksnapshot on the host toolset

BUG=none
LOG=n
R=machenbach@chromium.org, brettw@chromium.org

Review URL: https://codereview.chromium.org/314073002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21689 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

BUILD.gn

index 2fe4579..9588ab8 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -31,10 +31,22 @@ config("internal_config") {
 
   if (component_mode == "shared_library") {
     defines = [
+      "V8_SHARED",
       "BUILDING_V8_SHARED",
+    ]
+  }
+}
+
+# This config should only be applied to code using V8 and not any V8 code
+# itself.
+config("external_config") {
+  if (is_component_build) {
+    defines = [
       "V8_SHARED",
+      "USING_V8_SHARED",
     ]
   }
+  include_dirs = [ "include" ]
 }
 
 config("features") {
@@ -960,30 +972,26 @@ source_set("v8_libbase") {
 # Executables
 #
 
-executable("mksnapshot") {
-  visibility = ":*"  # Only targets in this file can depend on this.
+if (current_toolchain == host_toolchain) {
+  executable("mksnapshot") {
+    visibility = ":*"  # Only targets in this file can depend on this.
 
-  sources = [
-    "src/mksnapshot.cc",
-  ]
-
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [ "//build/config/compiler:no_chromium_code" ]
-  configs += [ ":internal_config", ":features", ":toolchain" ]
-
-  deps = [
-    ":v8_base",
-    ":v8_nosnapshot",
-  ]
+    sources = [
+      "src/mksnapshot.cc",
+    ]
 
-  libs = []
+    configs -= [ "//build/config/compiler:chromium_code" ]
+    configs += [ "//build/config/compiler:no_chromium_code" ]
+    configs += [ ":internal_config", ":features", ":toolchain" ]
 
-  if (v8_compress_startup_data == "bz2") {
-    libs += [ "bz2" ]
-  }
+    deps = [
+      ":v8_base",
+      ":v8_nosnapshot",
+    ]
 
-  if (is_android && current_toolchain != host_toolchain) {
-    libs += [ "log" ]
+    if (v8_compress_startup_data == "bz2") {
+      libs = [ "bz2" ]
+    }
   }
 }
 
@@ -1014,7 +1022,11 @@ component("v8") {
   configs += [ "//build/config/compiler:no_chromium_code" ]
   configs += [ ":internal_config", ":features", ":toolchain" ]
 
-  # TODO(jochen): Support direct dependent configs.
+  direct_dependent_configs = [ ":external_config" ]
+
+  if (is_android && current_toolchain != host_toolchain) {
+    libs += [ "log" ]
+  }
 }
 
 } else {
@@ -1031,7 +1043,8 @@ group("v8") {
       ":v8_nosnapshot",
     ]
   }
-  # TODO(jochen): Support direct dependent configs.
+
+  direct_dependent_configs = [ ":external_config" ]
 }
 
 }