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_GYP_BINARY_TARGET_WRITER_H_ | 5 #ifndef TOOLS_GN_GYP_BINARY_TARGET_WRITER_H_ |
6 #define TOOLS_GN_GYP_BINARY_TARGET_WRITER_H_ | 6 #define TOOLS_GN_GYP_BINARY_TARGET_WRITER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "tools/gn/gyp_target_writer.h" | 12 #include "tools/gn/gyp_target_writer.h" |
13 #include "tools/gn/target.h" | 13 #include "tools/gn/target.h" |
14 #include "tools/gn/toolchain.h" | 14 #include "tools/gn/toolchain.h" |
15 | 15 |
16 // Writes a portion of a .gyp file for a binary target type (an executable, a | 16 // Writes a portion of a .gyp file for a binary target type (an executable, a |
17 // shared library, or a static library). | 17 // shared library, or a static library). |
18 class GypBinaryTargetWriter : public GypTargetWriter { | 18 class GypBinaryTargetWriter : public GypTargetWriter { |
19 public: | 19 public: |
20 GypBinaryTargetWriter(const TargetGroup& group, std::ostream& out); | 20 GypBinaryTargetWriter(const TargetGroup& group, |
| 21 const SourceDir& gyp_dir, |
| 22 std::ostream& out); |
21 virtual ~GypBinaryTargetWriter(); | 23 virtual ~GypBinaryTargetWriter(); |
22 | 24 |
23 virtual void Run() OVERRIDE; | 25 virtual void Run() OVERRIDE; |
24 | 26 |
25 private: | 27 private: |
26 struct Flags { | 28 struct Flags { |
27 Flags(); | 29 Flags(); |
28 ~Flags(); | 30 ~Flags(); |
29 | 31 |
30 std::vector<std::string> defines; | 32 std::vector<std::string> defines; |
31 std::vector<SourceDir> include_dirs; | 33 std::vector<SourceDir> include_dirs; |
32 | 34 |
33 std::vector<std::string> cflags; | 35 std::vector<std::string> cflags; |
34 std::vector<std::string> cflags_c; | 36 std::vector<std::string> cflags_c; |
35 std::vector<std::string> cflags_cc; | 37 std::vector<std::string> cflags_cc; |
36 std::vector<std::string> cflags_objc; | 38 std::vector<std::string> cflags_objc; |
37 std::vector<std::string> cflags_objcc; | 39 std::vector<std::string> cflags_objcc; |
38 std::vector<std::string> ldflags; | 40 std::vector<std::string> ldflags; |
39 std::vector<SourceDir> lib_dirs; | 41 std::vector<SourceDir> lib_dirs; |
40 std::vector<std::string> libs; | 42 std::vector<std::string> libs; |
41 }; | 43 }; |
42 | 44 |
43 // Writes the given number of spaces to the output stream and returns it. | |
44 std::ostream& Indent(int spaces); | |
45 | |
46 void WriteName(int indent); | 45 void WriteName(int indent); |
47 void WriteType(int indent); | 46 void WriteType(int indent); |
48 | 47 |
49 // Writes the flags, sources, and deps. | 48 // Writes the flags, sources, and deps. |
50 void WriteVCConfiguration(int indent); | 49 void WriteVCConfiguration(int indent); |
51 void WriteLinuxConfiguration(int indent); | 50 void WriteLinuxConfiguration(int indent); |
52 void WriteMacConfiguration(int indent); | 51 void WriteMacConfiguration(int indent); |
53 | 52 |
54 // Writes the flags, defines, etc. The flags input is non-const because the | 53 // Writes the flags, defines, etc. The flags input is non-const because the |
55 // cflags will be fixed up to account for things converted to VC settings | 54 // cflags will be fixed up to account for things converted to VC settings |
(...skipping 15 matching lines...) Expand all Loading... |
71 void WriteAllDependentSettings(int indent); | 70 void WriteAllDependentSettings(int indent); |
72 | 71 |
73 // Writes out the given flags and such from all configs in the given list. | 72 // Writes out the given flags and such from all configs in the given list. |
74 void WriteSettingsFromConfigList(const std::vector<const Config*>& configs, | 73 void WriteSettingsFromConfigList(const std::vector<const Config*>& configs, |
75 int indent); | 74 int indent); |
76 | 75 |
77 // Fills the given flags structure. | 76 // Fills the given flags structure. |
78 Flags FlagsFromTarget(const Target* target) const; | 77 Flags FlagsFromTarget(const Target* target) const; |
79 Flags FlagsFromConfigList(const LabelConfigVector& configs) const; | 78 Flags FlagsFromConfigList(const LabelConfigVector& configs) const; |
80 | 79 |
| 80 // Writes the given array with the given name. The indent should be the |
| 81 // indenting for the name, the values will be indented 2 spaces from there. |
| 82 // Writes nothing if there is nothing in the array. |
| 83 void WriteNamedArray(const char* name, |
| 84 const std::vector<std::string>& values, |
| 85 int indent); |
| 86 |
81 // All associated targets. | 87 // All associated targets. |
82 TargetGroup group_; | 88 TargetGroup group_; |
83 | 89 |
84 DISALLOW_COPY_AND_ASSIGN(GypBinaryTargetWriter); | 90 DISALLOW_COPY_AND_ASSIGN(GypBinaryTargetWriter); |
85 }; | 91 }; |
86 | 92 |
87 #endif // TOOLS_GN_GYP_BINARY_TARGET_WRITER_H_ | 93 #endif // TOOLS_GN_GYP_BINARY_TARGET_WRITER_H_ |
88 | 94 |
OLD | NEW |