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_SETTINGS_H_ | 5 #ifndef TOOLS_GN_SETTINGS_H_ |
6 #define TOOLS_GN_SETTINGS_H_ | 6 #define TOOLS_GN_SETTINGS_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "tools/gn/build_settings.h" | 9 #include "tools/gn/build_settings.h" |
10 #include "tools/gn/import_manager.h" | 10 #include "tools/gn/import_manager.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 LINUX, | 31 LINUX, |
32 MAC, | 32 MAC, |
33 WIN | 33 WIN |
34 }; | 34 }; |
35 | 35 |
36 // Constructs a toolchain settings. The output_subdir_name is the name we | 36 // Constructs a toolchain settings. The output_subdir_name is the name we |
37 // should use for the subdirectory in the build output directory for this | 37 // should use for the subdirectory in the build output directory for this |
38 // toolchain's outputs. It should have no slashes in it. The default | 38 // toolchain's outputs. It should have no slashes in it. The default |
39 // toolchain should use an empty string. | 39 // toolchain should use an empty string. |
40 Settings(const BuildSettings* build_settings, | 40 Settings(const BuildSettings* build_settings, |
41 const Toolchain* toolchain, | |
42 const std::string& output_subdir_name); | 41 const std::string& output_subdir_name); |
43 ~Settings(); | 42 ~Settings(); |
44 | 43 |
45 const BuildSettings* build_settings() const { return build_settings_; } | 44 const BuildSettings* build_settings() const { return build_settings_; } |
46 | 45 |
47 // Danger: this must only be used for getting the toolchain label until the | 46 const Label& toolchain_label() const { return toolchain_label_; } |
48 // toolchain has been resolved. Otherwise, it will be modified on an | 47 void set_toolchain_label(const Label& l) { toolchain_label_ = l; } |
49 // arbitrary thread when the toolchain invocation is found. Generally, you | 48 |
50 // will only read this from the target generation where we know everything | 49 // Indicates if this corresponds to the default toolchain. |
51 // has been resolved and won't change. | 50 bool is_default() const { return is_default_; } |
52 const Toolchain* toolchain() const { return toolchain_; } | 51 void set_is_default(bool id) { is_default_ = id; } |
53 | 52 |
54 bool IsMac() const { return target_os_ == MAC; } | 53 bool IsMac() const { return target_os_ == MAC; } |
55 bool IsLinux() const { return target_os_ == LINUX; } | 54 bool IsLinux() const { return target_os_ == LINUX; } |
56 bool IsWin() const { return target_os_ == WIN; } | 55 bool IsWin() const { return target_os_ == WIN; } |
57 | 56 |
58 TargetOS target_os() const { return target_os_; } | 57 TargetOS target_os() const { return target_os_; } |
59 void set_target_os(TargetOS t) { target_os_ = t; } | 58 void set_target_os(TargetOS t) { target_os_ = t; } |
60 | 59 |
61 const OutputFile& toolchain_output_subdir() const { | 60 const OutputFile& toolchain_output_subdir() const { |
62 return toolchain_output_subdir_; | 61 return toolchain_output_subdir_; |
(...skipping 24 matching lines...) Expand all Loading... |
87 bool greedy_target_generation() const { | 86 bool greedy_target_generation() const { |
88 return greedy_target_generation_; | 87 return greedy_target_generation_; |
89 } | 88 } |
90 void set_greedy_target_generation(bool gtg) { | 89 void set_greedy_target_generation(bool gtg) { |
91 greedy_target_generation_ = gtg; | 90 greedy_target_generation_ = gtg; |
92 } | 91 } |
93 | 92 |
94 private: | 93 private: |
95 const BuildSettings* build_settings_; | 94 const BuildSettings* build_settings_; |
96 | 95 |
97 const Toolchain* toolchain_; | 96 Label toolchain_label_; |
| 97 bool is_default_; |
98 | 98 |
99 TargetOS target_os_; | 99 TargetOS target_os_; |
100 | 100 |
101 mutable ImportManager import_manager_; | 101 mutable ImportManager import_manager_; |
102 | 102 |
103 // The subdirectory inside the build output for this toolchain. For the | 103 // The subdirectory inside the build output for this toolchain. For the |
104 // default toolchain, this will be empty (since the deafult toolchain's | 104 // default toolchain, this will be empty (since the deafult toolchain's |
105 // output directory is the same as the build directory). When nonempty, this | 105 // output directory is the same as the build directory). When nonempty, this |
106 // is guaranteed to end in a slash. | 106 // is guaranteed to end in a slash. |
107 OutputFile toolchain_output_subdir_; | 107 OutputFile toolchain_output_subdir_; |
108 | 108 |
109 // Full source file path to the toolchain output directory. | 109 // Full source file path to the toolchain output directory. |
110 SourceDir toolchain_output_dir_; | 110 SourceDir toolchain_output_dir_; |
111 | 111 |
112 SourceDir toolchain_gen_dir_; | 112 SourceDir toolchain_gen_dir_; |
113 | 113 |
114 Scope base_config_; | 114 Scope base_config_; |
115 | 115 |
116 bool greedy_target_generation_; | 116 bool greedy_target_generation_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(Settings); | 118 DISALLOW_COPY_AND_ASSIGN(Settings); |
119 }; | 119 }; |
120 | 120 |
121 #endif // TOOLS_GN_SETTINGS_H_ | 121 #endif // TOOLS_GN_SETTINGS_H_ |
OLD | NEW |