Index: tools/gn/visual_studio_utils.cc |
diff --git a/tools/gn/visual_studio_utils.cc b/tools/gn/visual_studio_utils.cc |
index 894472213dcf5102c74a3c3fa522fdba76945b94..94a28833ca0c53bec5d2b44fb2d23b85b5b46720 100644 |
--- a/tools/gn/visual_studio_utils.cc |
+++ b/tools/gn/visual_studio_utils.cc |
@@ -4,13 +4,20 @@ |
#include "tools/gn/visual_studio_utils.h" |
+#include <vector> |
+ |
#include "base/md5.h" |
+#include "base/strings/string_split.h" |
#include "base/strings/string_util.h" |
CompilerOptions::CompilerOptions() = default; |
CompilerOptions::~CompilerOptions() = default; |
+LinkerOptions::LinkerOptions() = default; |
+ |
+LinkerOptions::~LinkerOptions() = default; |
+ |
std::string MakeGuid(const std::string& entry_path, const std::string& seed) { |
std::string str = base::ToUpperASCII(base::MD5String(seed + entry_path)); |
return '{' + str.substr(0, 8) + '-' + str.substr(8, 4) + '-' + |
@@ -115,3 +122,18 @@ void ParseCompilerOption(const std::string& cflag, CompilerOptions* options) { |
// Put everything else into additional_options. |
options->additional_options += cflag + ' '; |
} |
+ |
+// Parses |ldflags| value and stores it in |options|. |
+void ParseLinkerOption(const std::string& ldflag, LinkerOptions* options) { |
+ const char kSubsytemPrefix[] ="/SUBSYSTEM:"; |
+ if (base::StartsWith(ldflag, kSubsytemPrefix, |
+ base::CompareCase::SENSITIVE)) { |
+ const std::string subsystem( |
+ ldflag.begin() + std::string(kSubsytemPrefix).length(), |
+ ldflag.end()); |
+ const std::vector<std::string> tokens = base::SplitString( |
+ subsystem, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
+ if (!tokens.empty()) |
+ options->subsystem = tokens[0]; |
+ } |
+} |