mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
Autogen: Add cmQtAutogenGlobalInitializer::Keywords class
The new `cmQtAutogenGlobalInitializer::Keywords` class instance is bound to the lifetime of the `cmQtAutogenGlobalInitializer` instance. Global static const strings would be allocated at program start and deallocated at program end. Keeping keyword strings alive only in the context where they're needed helps to reduce the memory footprint.
This commit is contained in:
@@ -20,6 +20,13 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
cmQtAutoGenGlobalInitializer::Keywords::Keywords()
|
||||
: AUTOMOC("AUTOMOC")
|
||||
, AUTOUIC("AUTOUIC")
|
||||
, AUTORCC("AUTORCC")
|
||||
{
|
||||
}
|
||||
|
||||
cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
|
||||
std::vector<cmLocalGenerator*> const& localGenerators)
|
||||
{
|
||||
|
||||
@@ -17,11 +17,25 @@ class cmQtAutoGenInitializer;
|
||||
/// @brief Initializes the QtAutoGen generators
|
||||
class cmQtAutoGenGlobalInitializer
|
||||
{
|
||||
public:
|
||||
/// @brief Collection of QtAutogen related keywords
|
||||
class Keywords
|
||||
{
|
||||
public:
|
||||
Keywords();
|
||||
|
||||
std::string AUTOMOC;
|
||||
std::string AUTOUIC;
|
||||
std::string AUTORCC;
|
||||
};
|
||||
|
||||
public:
|
||||
cmQtAutoGenGlobalInitializer(
|
||||
std::vector<cmLocalGenerator*> const& localGenerators);
|
||||
~cmQtAutoGenGlobalInitializer();
|
||||
|
||||
Keywords const* kw() const { return Keywords_.get(); };
|
||||
|
||||
bool generate();
|
||||
|
||||
private:
|
||||
@@ -48,6 +62,7 @@ private:
|
||||
std::map<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
|
||||
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
|
||||
std::unordered_map<std::string, std::string> ExecutableTestOutputs_;
|
||||
std::unique_ptr<Keywords> Keywords_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user