Index: build/symlink.gni |
diff --git a/build/symlink.gni b/build/symlink.gni |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e73aa481cdcb9208000c9cd70f9cbafbda70940b |
--- /dev/null |
+++ b/build/symlink.gni |
@@ -0,0 +1,57 @@ |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Creates a symlink. |
+# Args: |
+# source: Path to link to. |
+# output: Where to create the symlink. |
+template("symlink") { |
+ action(target_name) { |
+ forward_variables_from(invoker, |
+ [ |
+ "deps", |
+ "testonly", |
+ "visibility", |
+ ]) |
+ outputs = [ |
+ invoker.output, |
+ ] |
+ script = "//build/symlink.py" |
+ args = [ |
+ "-f", |
+ rebase_path(invoker.source, get_path_info(invoker.output, "dir")), |
+ rebase_path(invoker.output, root_build_dir), |
+ ] |
+ } |
+} |
+ |
+# Creates a symlink from root_build_dir/target_name to |binary_label|, which |
+# can be convenient when target_toolchain != host_toolchain. |
+# Note that for executables, using a copy (as opposed to a symlink) does not |
+# work when is_component_build=true, since dependent libraries are found via |
+# relative location. |
brettw
2015/12/10 18:20:03
I think it would be worth adding here how you will
agrieve
2015/12/11 10:37:01
Done.
|
+# Args: |
+# binary_label: Target that builds the file to symlink to. e.g.: |
+# ":foo($host_toolchain)". |
+# output: Where to create the symlink (default="$root_out_dir/$target_name") |
+template("host_binary_symlink") { |
brettw
2015/12/10 18:20:03
Since callers how have to specify the toolchain in
agrieve
2015/12/11 10:37:01
Done.
|
+ symlink(target_name) { |
+ forward_variables_from(invoker, |
+ [ |
+ "output", |
+ "testonly", |
+ "visibility", |
+ ]) |
+ deps = [ |
+ invoker.binary_label, |
+ ] |
+ |
+ _out_dir = get_label_info(invoker.binary_label, "root_out_dir") |
+ source = "$_out_dir/" + get_label_info(invoker.binary_label, "name") |
+ |
+ if (!defined(output)) { |
+ output = "$root_out_dir/${invoker.target_name}" |
+ } |
+ } |
+} |