cmQtAutoGenInitializer.h 3.83 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
  bool MultiConfig = false;
86
  // Qt
87
88
89
90
91
  std::string QtVersionMajor;
  std::string QtVersionMinor;
  // Configurations
  std::string ConfigDefault;
  std::vector<std::string> ConfigsList;
92
  std::string Parallel;
93
  std::string Verbosity;
94
95
96
97
98
  // Names
  std::string AutogenTargetName;
  std::string AutogenFolder;
  std::string AutogenInfoFile;
  std::string AutogenSettingsFile;
99
100
101
  std::map<std::string, std::string> AutogenConfigSettingsFile;
  std::set<std::string> AutogenDependFiles;
  std::set<cmTarget*> AutogenDependTargets;
102
103
104
105
  // Directories
  std::string DirInfo;
  std::string DirBuild;
  std::string DirWork;
106
107
  std::string DirInclude;
  std::map<std::string, std::string> DirConfigInclude;
108
109
110
111
112
113
114
115
116
  // Moc and UIC
  struct
  {
    // Sources
    std::vector<std::string> Headers;
    std::vector<std::string> Sources;
    std::vector<std::string> HeadersGenerated;
    std::vector<std::string> SourcesGenerated;
  } MocUic;
117
  // Moc
118
119
  struct
  {
120
    bool Enabled = false;
121
122
123
124
125
126
127
    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;
128
    std::string MocsCompilation;
129
  } Moc;
130
  // Uic
131
132
  struct
  {
133
    bool Enabled = false;
134
135
136
137
138
139
140
141
    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;
142
  // Rcc
143
144
  struct
  {
145
    bool Enabled = false;
146
147
148
149
    std::string Executable;
    std::vector<std::string> ListOptions;
    std::vector<Qrc> Qrcs;
  } Rcc;
150
151
152
};

#endif