cmQtAutoGenInitializer.h 3.99 KB
Newer Older
1
2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3
4
#ifndef cmQtAutoGenInitializer_h
#define cmQtAutoGenInitializer_h
5

6
#include "cmConfigure.h" // IWYU pragma: keep
7
#include "cmQtAutoGen.h"
8

9
10
#include <map>
#include <set>
11
#include <string>
12
#include <vector>
13

14
class cmGeneratorTarget;
15
class cmTarget;
16

17
/// @brief Initializes the QtAutoGen generators
18
class cmQtAutoGenInitializer : public cmQtAutoGen
19
20
{
public:
21
22
  static std::string GetQtMajorVersion(cmGeneratorTarget const* target);
  static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
23
                                       std::string const& qtVersionMajor);
24

25
  /// @brief Rcc job information
26
27
28
29
30
31
32
33
34
35
  class Qrc
  {
  public:
    Qrc()
      : Generated(false)
      , Unique(false)
    {
    }

  public:
36
    std::string LockFile;
37
38
39
40
41
    std::string QrcFile;
    std::string QrcName;
    std::string PathChecksum;
    std::string InfoFile;
    std::string SettingsFile;
42
    std::map<std::string, std::string> ConfigSettingsFile;
43
44
45
46
47
48
49
50
    std::string RccFile;
    bool Generated;
    bool Unique;
    std::vector<std::string> Options;
    std::vector<std::string> Resources;
  };

public:
51
52
53
  cmQtAutoGenInitializer(cmGeneratorTarget* target, bool mocEnabled,
                         bool uicEnabled, bool rccEnabled,
                         std::string const& qtVersionMajor);
54

55
56
  bool InitCustomTargets();
  bool SetupCustomTargets();
57
58

private:
59
60
61
62
63
64
65
  bool InitMoc();
  bool InitUic();
  bool InitRcc();

  bool InitScanFiles();
  bool InitAutogenTarget();
  bool InitRccTargets();
66

67
68
69
  bool SetupWriteAutogenInfo();
  bool SetupWriteRccInfo();

70
  void AddGeneratedSource(std::string const& filename, GeneratorT genType);
71
72
73
74

  bool QtVersionGreaterOrEqual(unsigned long requestMajor,
                               unsigned long requestMinor) const;

75
76
77
78
  bool GetMocExecutable();
  bool GetUicExecutable();
  bool GetRccExecutable();

79
80
81
82
  bool RccListInputs(std::string const& fileName,
                     std::vector<std::string>& files,
                     std::string& errorMessage);

83
84
private:
  cmGeneratorTarget* Target;
85

86
  // Qt
87
88
  std::string QtVersionMajor;
  std::string QtVersionMinor;
89
90
91

  // Configuration
  bool MultiConfig = false;
92
93
  std::string ConfigDefault;
  std::vector<std::string> ConfigsList;
94
  std::string Verbosity;
95
96
97
98
99
100
101
102
103
104
105
106
107
  std::string TargetsFolder;

  /// @brief Common directories
  struct
  {
    std::string Info;
    std::string Build;
    std::string Work;
    std::string Include;
    std::map<std::string, std::string> ConfigInclude;
  } Dir;

  /// @brief Autogen target variables
108
109
  struct
  {
110
111
112
113
114
115
116
117
118
119
120
    std::string Name;
    // Settings
    std::string Parallel;
    // Configuration files
    std::string InfoFile;
    std::string SettingsFile;
    std::map<std::string, std::string> ConfigSettingsFile;
    // Dependencies
    std::set<std::string> DependFiles;
    std::set<cmTarget*> DependTargets;
    // Sources to process
121
122
123
124
    std::vector<std::string> Headers;
    std::vector<std::string> Sources;
    std::vector<std::string> HeadersGenerated;
    std::vector<std::string> SourcesGenerated;
125
126
127
  } AutogenTarget;

  /// @brief Moc only variables
128
129
  struct
  {
130
    bool Enabled = false;
131
132
133
134
135
136
137
    std::string Executable;
    std::string PredefsCmd;
    std::set<std::string> Skip;
    std::string Includes;
    std::map<std::string, std::string> ConfigIncludes;
    std::string Defines;
    std::map<std::string, std::string> ConfigDefines;
138
    std::string MocsCompilation;
139
  } Moc;
140
141

  ///@brief Uic only variables
142
143
  struct
  {
144
    bool Enabled = false;
145
146
147
148
149
150
151
152
    std::string Executable;
    std::set<std::string> Skip;
    std::vector<std::string> SearchPaths;
    std::string Options;
    std::map<std::string, std::string> ConfigOptions;
    std::vector<std::string> FileFiles;
    std::vector<std::vector<std::string>> FileOptions;
  } Uic;
153
154

  /// @brief Rcc only variables
155
156
  struct
  {
157
    bool Enabled = false;
158
159
160
161
    std::string Executable;
    std::vector<std::string> ListOptions;
    std::vector<Qrc> Qrcs;
  } Rcc;
162
163
164
};

#endif