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 #ifndef TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ | 5 #ifndef TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ |
6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ | 6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "tools/gn/config_values.h" | 9 #include "tools/gn/config_values.h" |
10 #include "tools/gn/ninja_target_writer.h" | 10 #include "tools/gn/ninja_target_writer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // tool-specific (e.g. "cflags_c"). For non-tool-specific flags (e.g. | 40 // tool-specific (e.g. "cflags_c"). For non-tool-specific flags (e.g. |
41 // "defines") tool_type should be TYPE_NONE. | 41 // "defines") tool_type should be TYPE_NONE. |
42 void WriteOneFlag( | 42 void WriteOneFlag( |
43 SubstitutionType subst_enum, | 43 SubstitutionType subst_enum, |
44 bool has_precompiled_headers, | 44 bool has_precompiled_headers, |
45 Toolchain::ToolType tool_type, | 45 Toolchain::ToolType tool_type, |
46 const std::vector<std::string>& (ConfigValues::* getter)() const, | 46 const std::vector<std::string>& (ConfigValues::* getter)() const, |
47 EscapeOptions flag_escape_options); | 47 EscapeOptions flag_escape_options); |
48 | 48 |
49 // Writes build lines required for precompiled headers. Any generated | 49 // Writes build lines required for precompiled headers. Any generated |
50 // object files will be appended to the given vector. | 50 // object files will be appended to the |object_files|. Any generated |
| 51 // non-object files (for instance, .gch files from a GCC toolchain, are |
| 52 // appended to |other_files|). |
51 // | 53 // |
52 // input_dep is the stamp file collecting the dependencies required before | 54 // input_dep is the stamp file collecting the dependencies required before |
53 // compiling this target. It will be empty if there are no input deps. | 55 // compiling this target. It will be empty if there are no input deps. |
54 void WritePrecompiledHeaderCommands(const SourceFileTypeSet& used_types, | 56 void WritePCHCommands(const SourceFileTypeSet& used_types, |
55 const OutputFile& input_dep, | 57 const OutputFile& input_dep, |
56 std::vector<OutputFile>* object_files); | 58 std::vector<OutputFile>* object_files, |
| 59 std::vector<OutputFile>* other_files); |
57 | 60 |
58 // Writes a Windows .pch compile build line for a language type. | 61 // Writes a .pch compile build line for a language type. |
| 62 void WritePCHCommand(SubstitutionType flag_type, |
| 63 Toolchain::ToolType tool_type, |
| 64 Tool::PrecompiledHeaderType header_type, |
| 65 const OutputFile& input_dep, |
| 66 std::vector<OutputFile>* object_files, |
| 67 std::vector<OutputFile>* other_files); |
| 68 |
| 69 void WriteGCCPCHCommand(SubstitutionType flag_type, |
| 70 Toolchain::ToolType tool_type, |
| 71 const OutputFile& order_only_dep, |
| 72 std::vector<OutputFile>* gch_files); |
| 73 |
59 void WriteWindowsPCHCommand(SubstitutionType flag_type, | 74 void WriteWindowsPCHCommand(SubstitutionType flag_type, |
60 Toolchain::ToolType tool_type, | 75 Toolchain::ToolType tool_type, |
61 const OutputFile& input_dep, | 76 const OutputFile& order_only_dep, |
62 std::vector<OutputFile>* object_files); | 77 std::vector<OutputFile>* object_files); |
63 | 78 |
64 // extra_deps are additional dependencies to run before the rule. | 79 // pch_deps are additional dependencies to run before the rule. They are |
| 80 // expected to abide by the naming conventions specified by GetPCHOutputFiles. |
65 // | 81 // |
66 // iorder_only_dep is the name of the stamp file that covers the dependencies | 82 // order_only_dep is the name of the stamp file that covers the dependencies |
67 // that must be run before doing any compiles. | 83 // that must be run before doing any compiles. |
68 // | 84 // |
69 // The files produced by the compiler will be added to two output vectors. | 85 // The files produced by the compiler will be added to two output vectors. |
70 void WriteSources(const std::vector<OutputFile>& extra_deps, | 86 void WriteSources(const std::vector<OutputFile>& pch_deps, |
71 const OutputFile& order_only_dep, | 87 const OutputFile& order_only_dep, |
72 std::vector<OutputFile>* object_files, | 88 std::vector<OutputFile>* object_files, |
73 std::vector<SourceFile>* other_files); | 89 std::vector<SourceFile>* other_files); |
74 | 90 |
75 // Writes a build line. | 91 // Writes a build line. |
76 void WriteCompilerBuildLine(const SourceFile& source, | 92 void WriteCompilerBuildLine(const SourceFile& source, |
77 const std::vector<OutputFile>& extra_deps, | 93 const std::vector<OutputFile>& extra_deps, |
78 const OutputFile& order_only_dep, | 94 const OutputFile& order_only_dep, |
79 Toolchain::ToolType tool_type, | 95 Toolchain::ToolType tool_type, |
80 const std::vector<OutputFile>& outputs); | 96 const std::vector<OutputFile>& outputs); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const Tool* tool_; | 139 const Tool* tool_; |
124 | 140 |
125 // Cached version of the prefix used for rule types for this toolchain. | 141 // Cached version of the prefix used for rule types for this toolchain. |
126 std::string rule_prefix_; | 142 std::string rule_prefix_; |
127 | 143 |
128 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter); | 144 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter); |
129 }; | 145 }; |
130 | 146 |
131 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ | 147 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ |
132 | 148 |
OLD | NEW |