Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: tools/gn/function_toolchain.cc

Issue 1690843002: gn: Add runtime_link_output to tool("solib") (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: e Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/runtime_deps.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_toolchain.cc
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc
index 58532551d4f2d65250db6002fbaf675eec20cff7..3e272c958642a4ade77f90a78a5fc05e3fa6dbbb 100644
--- a/tools/gn/function_toolchain.cc
+++ b/tools/gn/function_toolchain.cc
@@ -481,9 +481,10 @@ const char kTool_Help[] =
" that actually produces these files.\n"
"\n"
" If you specify more than one output for shared library links,\n"
- " you should consider setting link_output and depend_output.\n"
- " Otherwise, the first entry in the outputs list should always be\n"
- " the main output which will be linked to.\n"
+ " you should consider setting link_output, depend_output, and\n"
+ " runtime_link_output. Otherwise, the first entry in the\n"
+ " outputs list should always be the main output which will be\n"
+ " linked to.\n"
"\n"
" Example for a compiler tool that produces .obj files:\n"
" outputs = [\n"
@@ -503,20 +504,22 @@ const char kTool_Help[] =
"\n"
" link_output [string with substitutions]\n"
" depend_output [string with substitutions]\n"
+ " runtime_link_output [string with substitutions]\n"
" Valid for: \"solink\" only (optional)\n"
"\n"
- " These two files specify which of the outputs from the solink\n"
+ " These three files specify which of the outputs from the solink\n"
" tool should be used for linking and dependency tracking. These\n"
" should match entries in the \"outputs\". If unspecified, the\n"
- " first item in the \"outputs\" array will be used for both. See\n"
+ " first item in the \"outputs\" array will be used for all. See\n"
" \"Separate linking and dependencies for shared libraries\"\n"
- " below for more.\n"
+ " below for more. If link_output is set but runtime_link_output\n"
+ " is not set, runtime_link_output defaults to link_output.\n"
"\n"
" On Windows, where the tools produce a .dll shared library and\n"
- " a .lib import library, you will want both of these to be the\n"
- " import library. On Linux, if you're not doing the separate\n"
- " linking/dependency optimization, both of these should be the\n"
- " .so output.\n"
+ " a .lib import library, you will want the first two to be the\n"
+ " import library and the third one to be the .dll file.\n"
+ " On Linux, if you're not doing the separate linking/dependency\n"
+ " optimization, all of these should be the .so output.\n"
"\n"
" output_prefix [string]\n"
" Valid for: Linker tools (optional)\n"
@@ -827,14 +830,16 @@ Value RunTool(Scope* scope,
!ReadDepsFormat(&block_scope, tool.get(), err) ||
!ReadPattern(&block_scope, "description", subst_validator, tool.get(),
&Tool::set_description, err) ||
- !ReadString(&block_scope, "lib_switch", tool.get(),
- &Tool::set_lib_switch, err) ||
+ !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch,
+ err) ||
!ReadString(&block_scope, "lib_dir_switch", tool.get(),
&Tool::set_lib_dir_switch, err) ||
!ReadPattern(&block_scope, "link_output", subst_validator, tool.get(),
&Tool::set_link_output, err) ||
!ReadPattern(&block_scope, "depend_output", subst_validator, tool.get(),
&Tool::set_depend_output, err) ||
+ !ReadPattern(&block_scope, "runtime_link_output", subst_validator,
+ tool.get(), &Tool::set_runtime_link_output, err) ||
!ReadString(&block_scope, "output_prefix", tool.get(),
&Tool::set_output_prefix, err) ||
!ReadPrecompiledHeaderType(&block_scope, tool.get(), err) ||
@@ -854,8 +859,9 @@ Value RunTool(Scope* scope,
return Value();
}
- // Validate that the link_output and depend_output refer to items in the
- // outputs and aren't defined for irrelevant tool types.
+ // Validate that the link_output, depend_output, and runtime_link_output
+ // refer to items in the outputs and aren't defined for irrelevant tool
+ // types.
if (!tool->link_output().empty()) {
if (tool_type != Toolchain::TYPE_SOLINK &&
tool_type != Toolchain::TYPE_SOLINK_MODULE) {
@@ -888,6 +894,19 @@ Value RunTool(Scope* scope,
"be specified or they should both be empty.");
return Value();
}
+ if (!tool->runtime_link_output().empty()) {
+ if (tool_type != Toolchain::TYPE_SOLINK &&
+ tool_type != Toolchain::TYPE_SOLINK_MODULE) {
+ *err = Err(function, "This tool specifies a runtime_link_output.",
+ "This is only valid for solink and solink_module tools.");
+ return Value();
+ }
+ if (!IsPatternInOutputList(tool->outputs(), tool->runtime_link_output())) {
+ *err = Err(function, "This tool's runtime_link_output is bad.",
+ "It must match one of the outputs.");
+ return Value();
+ }
+ }
// Make sure there weren't any vars set in this tool that were unused.
if (!block_scope.CheckForUnusedVars(err))
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/runtime_deps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698