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

Unified Diff: tools/gn/ninja_binary_target_writer.h

Issue 1207903002: Windows precompiled header support in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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 977e9823fe4fd075949b2f1d9058126cc66ac541..408f76d1584dd023ad17e77b8d7551421948010a 100644
--- a/tools/gn/ninja_binary_target_writer.h
+++ b/tools/gn/ninja_binary_target_writer.h
@@ -12,6 +12,7 @@
#include "tools/gn/unique_vector.h"
struct EscapeOptions;
+class SourceFileTypeSet;
// Writes a .ninja file for a binary target type (an executable, a shared
// library, or a static library).
@@ -24,10 +25,43 @@ class NinjaBinaryTargetWriter : public NinjaTargetWriter {
private:
typedef std::set<OutputFile> OutputFileSet;
-
- void WriteCompilerVars();
- void WriteSources(std::vector<OutputFile>* object_files,
+ class SourceFileTypeSet;
+
+ // Writes all flags for the compiler: includes, defines, cflags, etc.
+ // Any .pch files this function generates references to will be appended to
+ // the *pch_files vector.
+ void WriteCompilerVars(const SourceFileTypeSet& used_types);
+ void WriteOneFlag(
+ SubstitutionType subst_enum,
+ const std::vector<std::string>& (ConfigValues::* getter)() const,
+ EscapeOptions flag_escape_options);
+
+ void WritePrecompiledHeaderCommands(const SourceFileTypeSet& used_types,
+ const OutputFile& input_dep,
+ std::vector<OutputFile>* object_files);
+ void WritePrecompiledHeaderCommand(SubstitutionType flag_type,
+ Toolchain::ToolType tool_type,
+ const OutputFile& input_dep,
+ std::vector<OutputFile>* object_files);
+
+ // extra_deps are additional dependencies to run before the rule.
+ //
+ // iorder_only_dep is the name of the stamp file that covers the dependencies
+ // that must be run before doing any compiles.
+ //
+ // The files produced by the compiler will be added to two output vectors.
+ void WriteSources(const std::vector<OutputFile>& extra_deps,
+ const OutputFile& order_only_dep,
+ std::vector<OutputFile>* object_files,
std::vector<SourceFile>* other_files);
+
+ // Writes a build line.
+ void WriteCompilerBuildLine(const SourceFile& source,
+ const std::vector<OutputFile>& extra_deps,
+ const OutputFile& order_only_dep,
+ Toolchain::ToolType tool_type,
+ const std::vector<OutputFile>& outputs);
+
void WriteLinkerStuff(const std::vector<OutputFile>& object_files,
const std::vector<SourceFile>& other_files);
void WriteLinkerFlags(const SourceFile* optional_def_file);
@@ -78,8 +112,28 @@ class NinjaBinaryTargetWriter : public NinjaTargetWriter {
Toolchain::ToolType* computed_tool_type,
std::vector<OutputFile>* outputs) const;
+ // Appends the object files generated by the given source set to the given
+ // output vector.
+ void AddSourceSetObjectFiles(const Target* source_set,
+ UniqueVector<OutputFile>* obj_files) const;
+
+ // Returns the object files for the precompiled header of the given type
+ // (flag type and tool type must match). The given target is used rather than
+ // this class' target_ so any target's object files can be retrieved.
+ void GetWindowsPCHObjectFiles(const Target* target,
+ SubstitutionType flag_type,
+ Toolchain::ToolType tool_type,
+ std::vector<OutputFile>* outputs) const;
+
+ // Returns the computed name of the Windows .pch file for the given
+ // flag type (C/C++/ObjC/ObjC++).
+ OutputFile GetWindowsPCHFile(SubstitutionType flag_type) const;
+
const Tool* tool_;
+ // Cached version of the prefix used for rule types for this toolchain.
+ std::string rule_prefix_;
+
DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter);
};

Powered by Google App Engine
This is Rietveld 408576698