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

Unified Diff: tools/gn/ninja_binary_target_writer.h

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 years, 4 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/ninja_action_target_writer_unittest.cc ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_binary_target_writer.h
diff --git a/tools/gn/ninja_binary_target_writer.h b/tools/gn/ninja_binary_target_writer.h
index 14762534ed0f83772acd6ec10f06cf44d7980991..e3236ce52f6f65a896e845a8a3646127dcb5d7ce 100644
--- a/tools/gn/ninja_binary_target_writer.h
+++ b/tools/gn/ninja_binary_target_writer.h
@@ -6,17 +6,18 @@
#define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
#include "base/compiler_specific.h"
+#include "tools/gn/config_values.h"
#include "tools/gn/ninja_target_writer.h"
#include "tools/gn/toolchain.h"
#include "tools/gn/unique_vector.h"
+struct EscapeOptions;
+
// Writes a .ninja file for a binary target type (an executable, a shared
// library, or a static library).
class NinjaBinaryTargetWriter : public NinjaTargetWriter {
public:
- NinjaBinaryTargetWriter(const Target* target,
- const Toolchain* toolchain,
- std::ostream& out);
+ NinjaBinaryTargetWriter(const Target* target, std::ostream& out);
virtual ~NinjaBinaryTargetWriter();
virtual void Run() OVERRIDE;
@@ -27,14 +28,10 @@ class NinjaBinaryTargetWriter : public NinjaTargetWriter {
void WriteCompilerVars();
void WriteSources(std::vector<OutputFile>* object_files);
void WriteLinkerStuff(const std::vector<OutputFile>& object_files);
- void WriteLinkerFlags(const Toolchain::Tool& tool,
- const OutputFile& windows_manifest);
- void WriteLibs(const Toolchain::Tool& tool);
-
- // Writes the build line for linking the target. Includes newline.
- void WriteLinkCommand(const OutputFile& external_output_file,
- const OutputFile& internal_output_file,
- const std::vector<OutputFile>& object_files);
+ void WriteLinkerFlags();
+ void WriteLibs();
+ void WriteOutputExtension();
+ void WriteSolibs(const std::vector<OutputFile>& solibs);
// Writes the stamp line for a source set. These are not linked.
void WriteSourceSetStamp(const std::vector<OutputFile>& object_files);
@@ -57,12 +54,29 @@ class NinjaBinaryTargetWriter : public NinjaTargetWriter {
// Writes the implicit dependencies for the link or stamp line. This is
// the "||" and everything following it on the ninja line.
//
- // The implicit dependencies are the non-linkable deps passed in as an
+ // The order-only dependencies are the non-linkable deps passed in as an
// argument, plus the data file depdencies in the target.
- void WriteImplicitDependencies(
+ void WriteOrderOnlyDependencies(
const UniqueVector<const Target*>& non_linkable_deps);
- Toolchain::ToolType tool_type_;
+ // Computes the set of output files resulting from compiling the given source
+ // file. If the file can be compiled and the tool exists, fills the outputs in
+ // and writes the tool type to computed_tool_type. If the file is not
+ // compilable, returns false.
+ //
+ // The target that the source belongs to is passed as an argument. In the
+ // case of linking to source sets, this can be different than the target
+ // this class is currently writing.
+ //
+ // The function can succeed with a "NONE" tool type for object files which are
+ // just passed to the output. The output will always be overwritten, not
+ // appended to.
+ bool GetOutputFilesForSource(const Target* target,
+ const SourceFile& source,
+ Toolchain::ToolType* computed_tool_type,
+ std::vector<OutputFile>* outputs) const;
+
+ const Tool* tool_;
DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter);
};
« no previous file with comments | « tools/gn/ninja_action_target_writer_unittest.cc ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698