• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 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_QT_CREATOR_WRITER_H_
6 #define TOOLS_GN_QT_CREATOR_WRITER_H_
7 
8 #include <set>
9 #include <string>
10 
11 #include "base/files/file_path.h"
12 #include "gn/err.h"
13 #include "gn/target.h"
14 
15 class Builder;
16 class BuildSettings;
17 
18 class QtCreatorWriter {
19  public:
20   static bool RunAndWriteFile(const BuildSettings* build_settings,
21                               const Builder& builder,
22                               Err* err,
23                               const std::string& root_target);
24 
25  private:
26   QtCreatorWriter(const BuildSettings* build_settings,
27                   const Builder& builder,
28                   const base::FilePath& project_prefix,
29                   const std::string& root_target_name);
30   ~QtCreatorWriter();
31 
32   void Run();
33 
34   bool DiscoverTargets();
35   void HandleTarget(const Target* target);
36 
37   void CollectDeps(const Target* target);
38   void AddToSources(const Target::FileList& files);
39   void GenerateFile(const base::FilePath::CharType* suffix,
40                     const std::set<std::string>& items);
41 
42   const BuildSettings* build_settings_;
43   const Builder& builder_;
44   base::FilePath project_prefix_;
45   std::string root_target_name_;
46   TargetSet targets_;
47   std::set<std::string> sources_;
48   std::set<std::string> includes_;
49   std::set<std::string> defines_;
50   Err err_;
51 
52   QtCreatorWriter(const QtCreatorWriter&) = delete;
53   QtCreatorWriter& operator=(const QtCreatorWriter&) = delete;
54 };
55 
56 #endif  // TOOLS_GN_QT_CREATOR_WRITER_H_
57