• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TOOLS_GN_VISUAL_STUDIO_UTILS_H_
6 #define TOOLS_GN_VISUAL_STUDIO_UTILS_H_
7 
8 #include <string>
9 
10 // Some compiler options which will be written to project file. We don't need to
11 // specify all options because generated project file is going to be used only
12 // for compilation of single file. For real build ninja files are used.
13 struct CompilerOptions {
14   CompilerOptions();
15   ~CompilerOptions();
16 
17   std::string additional_options;
18   std::string buffer_security_check;
19   std::string forced_include_files;
20   std::string disable_specific_warnings;
21   std::string optimization;
22   std::string runtime_library;
23   std::string treat_warning_as_error;
24   std::string warning_level;
25 };
26 
27 // Some linker options which will be written to project file. We don't need to
28 // specify all options because generated project file is going to be used only
29 // for compilation of single file. For real build ninja files are used.
30 struct LinkerOptions {
31   LinkerOptions();
32   ~LinkerOptions();
33 
34   std::string subsystem;
35 };
36 
37 // Generates something which looks like a GUID, but depends only on the name and
38 // seed. This means the same name / seed will always generate the same GUID, so
39 // that projects and solutions which refer to each other can explicitly
40 // determine the GUID to refer to explicitly. It also means that the GUID will
41 // not change when the project for a target is rebuilt.
42 std::string MakeGuid(const std::string& entry_path, const std::string& seed);
43 
44 // Parses |cflag| value and stores it in |options|.
45 void ParseCompilerOption(const std::string& cflag, CompilerOptions* options);
46 
47 // Parses |ldflags| value and stores it in |options|.
48 void ParseLinkerOption(const std::string& ldflag, LinkerOptions* options);
49 
50 #endif  // TOOLS_GN_VISUAL_STUDIO_UTILS_H_
51