1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
11 #include <cm/string_view>
13 /** \class cmQtAutoGen
14 * \brief Common base class for QtAutoGen classes
19 /** Integer version. */
22 unsigned int Major = 0;
23 unsigned int Minor = 0;
25 IntegerVersion() = default;
26 IntegerVersion(unsigned int major, unsigned int minor)
32 bool operator>(IntegerVersion const version) const
34 return (this->Major > version.Major) ||
35 ((this->Major == version.Major) && (this->Minor > version.Minor));
38 bool operator>=(IntegerVersion const version) const
40 return (this->Major > version.Major) ||
41 ((this->Major == version.Major) && (this->Minor >= version.Minor));
45 /** Compiler features. */
46 class CompilerFeatures
49 bool Evaluated = false;
50 std::string HelpOutput;
51 std::vector<std::string> ListOptions;
53 using CompilerFeaturesHandle = std::shared_ptr<CompilerFeatures>;
55 /** AutoGen generator type. */
64 /// @brief Maximum number of parallel threads/processes in a generator
65 static unsigned int const ParallelMax;
68 /// @brief Maximum number of characters on command line
69 static size_t const CommandLineLengthMax;
72 /// @brief Returns the generator name
73 static cm::string_view GeneratorName(GenT genType);
74 /// @brief Returns the generator name in upper case
75 static cm::string_view GeneratorNameUpper(GenT genType);
77 /// @brief Returns a string with the requested tool names
78 static std::string Tools(bool moc, bool uic, bool rcc);
80 /// @brief Returns the string escaped and enclosed in quotes
81 static std::string Quoted(cm::string_view text);
83 static std::string QuotedCommand(std::vector<std::string> const& command);
85 /// @brief Returns the file name without path and extension (thread safe)
86 static std::string FileNameWithoutLastExtension(cm::string_view filename);
88 /// @brief Returns the parent directory of the file (thread safe)
89 static std::string ParentDir(cm::string_view filename);
91 /// @brief Returns the parent directory of the file with a "/" suffix
92 static std::string SubDirPrefix(cm::string_view filename);
94 /// @brief Appends the suffix to the filename before the last dot
95 static std::string AppendFilenameSuffix(cm::string_view filename,
96 cm::string_view suffix);
98 /// @brief Merges newOpts into baseOpts
99 static void UicMergeOptions(std::vector<std::string>& baseOpts,
100 std::vector<std::string> const& newOpts,
103 /// @brief Merges newOpts into baseOpts
104 static void RccMergeOptions(std::vector<std::string>& baseOpts,
105 std::vector<std::string> const& newOpts,
109 * @brief Lists files in qrc resource files
115 RccLister(std::string rccExecutable, std::vector<std::string> listOptions);
117 //! The rcc executable
118 std::string const& RccExcutable() const { return this->RccExcutable_; }
119 void SetRccExecutable(std::string const& rccExecutable)
121 this->RccExcutable_ = rccExecutable;
124 //! The rcc executable list options
125 std::vector<std::string> const& ListOptions() const
127 return this->ListOptions_;
129 void SetListOptions(std::vector<std::string> const& listOptions)
131 this->ListOptions_ = listOptions;
135 * @brief Lists a files in the qrcFile
136 * @arg files The file names are appended to this list
137 * @arg error contains the error message when the function fails
139 bool list(std::string const& qrcFile, std::vector<std::string>& files,
140 std::string& error, bool verbose = false) const;
143 std::string RccExcutable_;
144 std::vector<std::string> ListOptions_;