summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGen.h
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2018-01-03 15:59:40 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2018-01-17 16:23:49 (GMT)
commita008578deebfa71b38786281450e3d9cf84f5847 (patch)
tree70173006b0adc6a62626e59d9cc653826f950336 /Source/cmQtAutoGen.h
parent488baaf0d6144cd7cedfbbd3bb6eadcc72257fc4 (diff)
downloadCMake-a008578deebfa71b38786281450e3d9cf84f5847.zip
CMake-a008578deebfa71b38786281450e3d9cf84f5847.tar.gz
CMake-a008578deebfa71b38786281450e3d9cf84f5847.tar.bz2
Autogen: Process files concurrently in AUTOMOC and AUTOUIC
This introduces concurrent thread processing in the `_autogen` target wich processes AUTOMOC and AUTOUIC. Source file parsing is distributed among the threads by using a job queue from which the threads pull new parse jobs. Each thread might start an independent ``moc`` or ``uic`` process. Altogether this roughly speeds up the AUTOMOC and AUTOUIC build process by the number of physical CPUs on the host system. The exact number of threads to start in the `_autogen` target is controlled by the new AUTOGEN_PARALLEL target property which is initialized by the new CMAKE_AUTOGEN_PARALLEL variable. If AUTOGEN_PARALLEL is empty or unset (which is the default) the thread count is set to the number of physical CPUs on the host system. The AUTOMOC/AUTOUIC generator and the AUTORCC generator are refactored to use a libuv loop internally. Closes #17422.
Diffstat (limited to 'Source/cmQtAutoGen.h')
-rw-r--r--Source/cmQtAutoGen.h55
1 files changed, 36 insertions, 19 deletions
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index e769e93..30ce0f6 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -9,14 +9,18 @@
#include <vector>
/** \class cmQtAutoGen
- * \brief Class used as namespace for QtAutogen related types and functions
+ * \brief Common base class for QtAutoGen classes
*/
class cmQtAutoGen
{
public:
- static std::string const listSep;
+ /// @brief Nested lists separator
+ static std::string const ListSep;
+ /// @brief Maximum number of parallel threads/processes in a generator
+ static unsigned int const ParallelMax;
- enum Generator
+ /// @brief AutoGen generator type
+ enum class GeneratorT
{
GEN, // General
MOC,
@@ -24,27 +28,33 @@ public:
RCC
};
- enum MultiConfig
+ /// @brief Multiconfiguration type
+ enum class MultiConfigT
{
- SINGLE, // Single configuration
- WRAP, // Multi configuration using wrapper files
- FULL // Full multi configuration using per config sources
+ SINGLE, // Single configuration
+ WRAPPER, // Multi configuration using wrapper files
+ MULTI // Multi configuration using per config sources
};
public:
/// @brief Returns the generator name
- static std::string const& GeneratorName(Generator genType);
+ static std::string const& GeneratorName(GeneratorT genType);
/// @brief Returns the generator name in upper case
- static std::string GeneratorNameUpper(Generator genType);
+ static std::string GeneratorNameUpper(GeneratorT genType);
/// @brief Returns the multi configuration name string
- static std::string const& MultiConfigName(MultiConfig config);
+ static std::string const& MultiConfigName(MultiConfigT config);
/// @brief Returns the multi configuration type
- static MultiConfig MultiConfigType(std::string const& name);
+ static MultiConfigT MultiConfigType(std::string const& name);
/// @brief Returns a the string escaped and enclosed in quotes
static std::string Quoted(std::string const& text);
+ static std::string QuotedCommand(std::vector<std::string> const& command);
+
+ /// @brief Returns the parent directory of the file with a "/" suffix
+ static std::string SubDirPrefix(std::string const& filename);
+
/// @brief Appends the suffix to the filename before the last dot
static std::string AppendFilenameSuffix(std::string const& filename,
std::string const& suffix);
@@ -59,14 +69,21 @@ public:
std::vector<std::string> const& newOpts,
bool isQt5);
- /// @brief Reads the resource files list from from a .qrc file
- /// @arg fileName Must be the absolute path of the .qrc file
- /// @return True if the rcc file was successfully read
- static bool RccListInputs(std::string const& rccCommand,
- std::vector<std::string> const& rccListOptions,
- std::string const& fileName,
- std::vector<std::string>& files,
- std::string* errorMessage = nullptr);
+ /// @brief Parses the content of a qrc file
+ ///
+ /// Use when rcc does not support the "--list" option
+ static void RccListParseContent(std::string const& content,
+ std::vector<std::string>& files);
+
+ /// @brief Parses the output of the "rcc --list ..." command
+ static bool RccListParseOutput(std::string const& rccStdOut,
+ std::string const& rccStdErr,
+ std::vector<std::string>& files,
+ std::string& error);
+
+ /// @brief Converts relative qrc entry paths to full paths
+ static void RccListConvertFullPath(std::string const& qrcFileDir,
+ std::vector<std::string>& files);
};
#endif