| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
| 10 #include "tools/gn/functions.h" | 10 #include "tools/gn/functions.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 " are relative to the build output directory. There must always be\n" | 474 " are relative to the build output directory. There must always be\n" |
| 475 " at least one output file. There can be more than one output (a\n" | 475 " at least one output file. There can be more than one output (a\n" |
| 476 " linker might produce a library and an import library, for\n" | 476 " linker might produce a library and an import library, for\n" |
| 477 " example).\n" | 477 " example).\n" |
| 478 "\n" | 478 "\n" |
| 479 " This array just declares to GN what files the tool will\n" | 479 " This array just declares to GN what files the tool will\n" |
| 480 " produce. It is your responsibility to specify the tool command\n" | 480 " produce. It is your responsibility to specify the tool command\n" |
| 481 " that actually produces these files.\n" | 481 " that actually produces these files.\n" |
| 482 "\n" | 482 "\n" |
| 483 " If you specify more than one output for shared library links,\n" | 483 " If you specify more than one output for shared library links,\n" |
| 484 " you should consider setting link_output and depend_output.\n" | 484 " you should consider setting link_output, depend_output, and\n" |
| 485 " Otherwise, the first entry in the outputs list should always be\n" | 485 " runtime_link_output. Otherwise, the first entry in the\n" |
| 486 " the main output which will be linked to.\n" | 486 " outputs list should always be the main output which will be\n" |
| 487 " linked to.\n" |
| 487 "\n" | 488 "\n" |
| 488 " Example for a compiler tool that produces .obj files:\n" | 489 " Example for a compiler tool that produces .obj files:\n" |
| 489 " outputs = [\n" | 490 " outputs = [\n" |
| 490 " \"{{source_out_dir}}/{{source_name_part}}.obj\"\n" | 491 " \"{{source_out_dir}}/{{source_name_part}}.obj\"\n" |
| 491 " ]\n" | 492 " ]\n" |
| 492 "\n" | 493 "\n" |
| 493 " Example for a linker tool that produces a .dll and a .lib. The\n" | 494 " Example for a linker tool that produces a .dll and a .lib. The\n" |
| 494 " use of {{output_extension}} rather than hardcoding \".dll\"\n" | 495 " use of {{output_extension}} rather than hardcoding \".dll\"\n" |
| 495 " allows the extension of the library to be overridden on a\n" | 496 " allows the extension of the library to be overridden on a\n" |
| 496 " target-by-target basis, but in this example, it always\n" | 497 " target-by-target basis, but in this example, it always\n" |
| 497 " produces a \".lib\" import library:\n" | 498 " produces a \".lib\" import library:\n" |
| 498 " outputs = [\n" | 499 " outputs = [\n" |
| 499 " \"{{root_out_dir}}/{{target_output_name}}" | 500 " \"{{root_out_dir}}/{{target_output_name}}" |
| 500 "{{output_extension}}\",\n" | 501 "{{output_extension}}\",\n" |
| 501 " \"{{root_out_dir}}/{{target_output_name}}.lib\",\n" | 502 " \"{{root_out_dir}}/{{target_output_name}}.lib\",\n" |
| 502 " ]\n" | 503 " ]\n" |
| 503 "\n" | 504 "\n" |
| 504 " link_output [string with substitutions]\n" | 505 " link_output [string with substitutions]\n" |
| 505 " depend_output [string with substitutions]\n" | 506 " depend_output [string with substitutions]\n" |
| 507 " runtime_link_output [string with substitutions]\n" |
| 506 " Valid for: \"solink\" only (optional)\n" | 508 " Valid for: \"solink\" only (optional)\n" |
| 507 "\n" | 509 "\n" |
| 508 " These two files specify which of the outputs from the solink\n" | 510 " These three files specify which of the outputs from the solink\n" |
| 509 " tool should be used for linking and dependency tracking. These\n" | 511 " tool should be used for linking and dependency tracking. These\n" |
| 510 " should match entries in the \"outputs\". If unspecified, the\n" | 512 " should match entries in the \"outputs\". If unspecified, the\n" |
| 511 " first item in the \"outputs\" array will be used for both. See\n" | 513 " first item in the \"outputs\" array will be used for all. See\n" |
| 512 " \"Separate linking and dependencies for shared libraries\"\n" | 514 " \"Separate linking and dependencies for shared libraries\"\n" |
| 513 " below for more.\n" | 515 " below for more. If link_output is set but runtime_link_output\n" |
| 516 " is not set, runtime_link_output defaults to link_output\n" |
| 514 "\n" | 517 "\n" |
| 515 " On Windows, where the tools produce a .dll shared library and\n" | 518 " On Windows, where the tools produce a .dll shared library and\n" |
| 516 " a .lib import library, you will want both of these to be the\n" | 519 " a .lib import library, you will want both of these to be the\n" |
| 517 " import library. On Linux, if you're not doing the separate\n" | 520 " import library, while runtime_link_output should be set to the\n" |
| 518 " linking/dependency optimization, both of these should be the\n" | 521 " .dll file. On Linux, if you're not doing the separate\n" |
| 522 " linking/dependency optimization, all of these should be the\n" |
| 519 " .so output.\n" | 523 " .so output.\n" |
| 520 "\n" | 524 "\n" |
| 521 " output_prefix [string]\n" | 525 " output_prefix [string]\n" |
| 522 " Valid for: Linker tools (optional)\n" | 526 " Valid for: Linker tools (optional)\n" |
| 523 "\n" | 527 "\n" |
| 524 " Prefix to use for the output name. Defaults to empty. This\n" | 528 " Prefix to use for the output name. Defaults to empty. This\n" |
| 525 " prefix will be prepended to the name of the target (or the\n" | 529 " prefix will be prepended to the name of the target (or the\n" |
| 526 " output_name if one is manually specified for it) if the prefix\n" | 530 " output_name if one is manually specified for it) if the prefix\n" |
| 527 " is not already there. The result will show up in the\n" | 531 " is not already there. The result will show up in the\n" |
| 528 " {{output_name}} substitution pattern.\n" | 532 " {{output_name}} substitution pattern.\n" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 scoped_ptr<Tool> tool(new Tool); | 824 scoped_ptr<Tool> tool(new Tool); |
| 821 | 825 |
| 822 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), | 826 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), |
| 823 &Tool::set_command, err) || | 827 &Tool::set_command, err) || |
| 824 !ReadOutputExtension(&block_scope, tool.get(), err) || | 828 !ReadOutputExtension(&block_scope, tool.get(), err) || |
| 825 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(), | 829 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(), |
| 826 &Tool::set_depfile, err) || | 830 &Tool::set_depfile, err) || |
| 827 !ReadDepsFormat(&block_scope, tool.get(), err) || | 831 !ReadDepsFormat(&block_scope, tool.get(), err) || |
| 828 !ReadPattern(&block_scope, "description", subst_validator, tool.get(), | 832 !ReadPattern(&block_scope, "description", subst_validator, tool.get(), |
| 829 &Tool::set_description, err) || | 833 &Tool::set_description, err) || |
| 830 !ReadString(&block_scope, "lib_switch", tool.get(), | 834 !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch, |
| 831 &Tool::set_lib_switch, err) || | 835 err) || |
| 832 !ReadString(&block_scope, "lib_dir_switch", tool.get(), | 836 !ReadString(&block_scope, "lib_dir_switch", tool.get(), |
| 833 &Tool::set_lib_dir_switch, err) || | 837 &Tool::set_lib_dir_switch, err) || |
| 834 !ReadPattern(&block_scope, "link_output", subst_validator, tool.get(), | 838 !ReadPattern(&block_scope, "link_output", subst_validator, tool.get(), |
| 835 &Tool::set_link_output, err) || | 839 &Tool::set_link_output, err) || |
| 836 !ReadPattern(&block_scope, "depend_output", subst_validator, tool.get(), | 840 !ReadPattern(&block_scope, "depend_output", subst_validator, tool.get(), |
| 837 &Tool::set_depend_output, err) || | 841 &Tool::set_depend_output, err) || |
| 842 !ReadPattern(&block_scope, "runtime_link_output", subst_validator, |
| 843 tool.get(), &Tool::set_runtime_link_output, err) || |
| 838 !ReadString(&block_scope, "output_prefix", tool.get(), | 844 !ReadString(&block_scope, "output_prefix", tool.get(), |
| 839 &Tool::set_output_prefix, err) || | 845 &Tool::set_output_prefix, err) || |
| 840 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) || | 846 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) || |
| 841 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) || | 847 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) || |
| 842 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(), | 848 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(), |
| 843 &Tool::set_rspfile, err) || | 849 &Tool::set_rspfile, err) || |
| 844 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(), | 850 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(), |
| 845 &Tool::set_rspfile_content, err)) { | 851 &Tool::set_rspfile_content, err)) { |
| 846 return Value(); | 852 return Value(); |
| 847 } | 853 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 return Value(); | 973 return Value(); |
| 968 | 974 |
| 969 Scope::KeyValueMap values; | 975 Scope::KeyValueMap values; |
| 970 block_scope.GetCurrentScopeValues(&values); | 976 block_scope.GetCurrentScopeValues(&values); |
| 971 toolchain->args() = values; | 977 toolchain->args() = values; |
| 972 | 978 |
| 973 return Value(); | 979 return Value(); |
| 974 } | 980 } |
| 975 | 981 |
| 976 } // namespace functions | 982 } // namespace functions |
| OLD | NEW |