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 #include "tools/gn/gyp_helper.h" | 5 #include "tools/gn/gyp_helper.h" |
6 | 6 |
7 #include "tools/gn/err.h" | 7 #include "tools/gn/err.h" |
8 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
9 #include "tools/gn/settings.h" | 9 #include "tools/gn/settings.h" |
10 #include "tools/gn/source_file.h" | 10 #include "tools/gn/source_file.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 *err = Err(Location(), "Need to specify a gyp_file value for " + | 38 *err = Err(Location(), "Need to specify a gyp_file value for " + |
39 target->label().GetUserVisibleName(false) + "\n" | 39 target->label().GetUserVisibleName(false) + "\n" |
40 "since I can't make up one with no name."); | 40 "since I can't make up one with no name."); |
41 return SourceFile(); | 41 return SourceFile(); |
42 } | 42 } |
43 | 43 |
44 return SourceFile(dir + dir_name + ".gyp"); | 44 return SourceFile(dir + dir_name + ".gyp"); |
45 } | 45 } |
46 | 46 |
47 std::string GypHelper::GetNameForTarget(const Target* target) const { | 47 std::string GypHelper::GetNameForTarget(const Target* target) const { |
48 const Toolchain* toolchain = target->settings()->toolchain(); | 48 if (target->settings()->is_default()) |
49 if (toolchain->is_default()) | |
50 return target->label().name(); // Default toolchain has no suffix. | 49 return target->label().name(); // Default toolchain has no suffix. |
51 return target->label().name() + "_" + toolchain->label().name(); | 50 return target->label().name() + "_" + |
| 51 target->settings()->toolchain_label().name(); |
52 } | 52 } |
53 | 53 |
54 std::string GypHelper::GetFullRefForTarget(const Target* target) const { | 54 std::string GypHelper::GetFullRefForTarget(const Target* target) const { |
55 Err err; | 55 Err err; |
56 SourceFile gypfile = GetGypFileForTarget(target, &err); | 56 SourceFile gypfile = GetGypFileForTarget(target, &err); |
57 CHECK(gypfile.is_source_absolute()) << | 57 CHECK(gypfile.is_source_absolute()) << |
58 "GYP files should not be system-absolute: " << gypfile.value(); | 58 "GYP files should not be system-absolute: " << gypfile.value(); |
59 | 59 |
60 std::string ret("<(DEPTH)/"); | 60 std::string ret("<(DEPTH)/"); |
61 // Trim off the leading double-slash. | 61 // Trim off the leading double-slash. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 ret.append(&dir.value()[2], dir.value().size() - 2); | 96 ret.append(&dir.value()[2], dir.value().size() - 2); |
97 } | 97 } |
98 | 98 |
99 // Optionally trim the slash off the end. | 99 // Optionally trim the slash off the end. |
100 if (!ret.empty() && !include_slash && | 100 if (!ret.empty() && !include_slash && |
101 (ret[ret.size() - 1] == '/' || ret[ret.size() - 1] == '\\')) | 101 (ret[ret.size() - 1] == '/' || ret[ret.size() - 1] == '\\')) |
102 ret.resize(ret.size() - 1); | 102 ret.resize(ret.size() - 1); |
103 | 103 |
104 return ret; | 104 return ret; |
105 } | 105 } |
OLD | NEW |