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

Unified Diff: tools/gn/visual_studio_utils.cc

Issue 2428013002: Setting "SubSystem" option on "Link" page for Visual Studio project. (Closed)
Patch Set: Fixed missed space indent Created 4 years, 2 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
« no previous file with comments | « tools/gn/visual_studio_utils.h ('k') | tools/gn/visual_studio_utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
+ }
+}
« no previous file with comments | « tools/gn/visual_studio_utils.h ('k') | tools/gn/visual_studio_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698