summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGeneratorRcc.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/cmQtAutoGeneratorRcc.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/cmQtAutoGeneratorRcc.h')
-rw-r--r--Source/cmQtAutoGeneratorRcc.h97
1 files changed, 71 insertions, 26 deletions
diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h
index 0e3f690..8a69c6c 100644
--- a/Source/cmQtAutoGeneratorRcc.h
+++ b/Source/cmQtAutoGeneratorRcc.h
@@ -5,52 +5,97 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmFilePathChecksum.h"
#include "cmQtAutoGen.h"
#include "cmQtAutoGenerator.h"
+#include "cm_uv.h"
#include <string>
#include <vector>
class cmMakefile;
+// @brief AUTORCC generator
class cmQtAutoGeneratorRcc : public cmQtAutoGenerator
{
CM_DISABLE_COPY(cmQtAutoGeneratorRcc)
public:
cmQtAutoGeneratorRcc();
+ ~cmQtAutoGeneratorRcc() override;
private:
- // -- Initialization & settings
- bool InfoFileRead(cmMakefile* makefile);
- void SettingsFileRead(cmMakefile* makefile);
- bool SettingsFileWrite();
- // -- Central processing
- bool Process(cmMakefile* makefile) override;
- bool RccGenerate();
+ // -- Types
+ /// @brief Processing stage
+ enum class StageT
+ {
+ SETTINGS_READ,
+ TEST_QRC_RCC_FILES,
+ TEST_RESOURCES_READ,
+ TEST_RESOURCES,
+ TEST_INFO_FILE,
+ GENERATE,
+ GENERATE_RCC,
+ GENERATE_WRAPPER,
+ SETTINGS_WRITE,
+ FINISH,
+ END
+ };
+
+ // -- Abstract processing interface
+ bool Init(cmMakefile* makefile) override;
+ bool Process() override;
+ // -- Process stage
+ static void UVPollStage(uv_async_t* handle);
+ void PollStage();
+ void SetStage(StageT stage);
+ // -- Settings file
+ void SettingsFileRead();
+ void SettingsFileWrite();
+ // -- Tests
+ bool TestQrcRccFiles();
+ bool TestResourcesRead();
+ bool TestResources();
+ void TestInfoFile();
+ // -- Generation
+ void GenerateParentDir();
+ bool GenerateRcc();
+ void GenerateWrapper();
+
+ // -- Utility
+ bool StartProcess(std::string const& workingDirectory,
+ std::vector<std::string> const& command,
+ bool mergedOutput);
+
+private:
// -- Config settings
- std::string ConfigSuffix;
- cmQtAutoGen::MultiConfig MultiConfig;
- // -- Settings
- bool SettingsChanged;
- std::string SettingsFile;
- std::string SettingsString;
+ bool SettingsChanged_;
+ std::string ConfigSuffix_;
+ MultiConfigT MultiConfig_;
// -- Directories
- std::string ProjectSourceDir;
- std::string ProjectBinaryDir;
- std::string CurrentSourceDir;
- std::string CurrentBinaryDir;
- std::string AutogenBuildDir;
- cmFilePathChecksum FilePathChecksum;
+ std::string AutogenBuildDir_;
// -- Qt environment
- std::string RccExecutable;
- std::vector<std::string> RccListOptions;
+ std::string RccExecutable_;
+ std::vector<std::string> RccListOptions_;
// -- Job
- std::string QrcFile;
- std::string RccFile;
- std::vector<std::string> Options;
- std::vector<std::string> Inputs;
+ std::string QrcFile_;
+ std::string QrcFileName_;
+ std::string QrcFileDir_;
+ std::string RccFile_;
+ std::string RccFileWrapper_;
+ std::string RccFileBuild_;
+ std::vector<std::string> Options_;
+ std::vector<std::string> Inputs_;
+ // -- Subprocess
+ ProcessResultT ProcessResult_;
+ std::unique_ptr<ReadOnlyProcessT> Process_;
+ // -- Settings file
+ std::string SettingsFile_;
+ std::string SettingsString_;
+ // -- libuv loop
+ StageT Stage_;
+ bool Error_;
+ bool Generate_;
+ bool BuildFileChanged_;
};
#endif