mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 12:49:36 -06:00
For multi configuration generators AUTOMOC generates the moc files that are included in `mocs_compilation.cpp` in `AUTOGEN_BUILD_DIR/include_$<CONFIG>/`. By doing so each configuration reads different moc files when compiling `mocs_compilation.cpp`. Since we do not (need to) rewrite `mocs_compilation.cpp` on a configuration change anymore, the files also does not need to be recompiled anymore. Not having to rewrite and recompile `mocs_compilation.cpp` on a configuration change anymore was the main objective of this patch. In a similar fashion AUTORCC generates a `qrc_BASE_CMAKE.cpp` file below `AUTOGEN_BUILD_DIR/include_$<CONFIG>/` and `qrc_BASE.cpp` becomes a mere wrapper that includes this actuall rcc output file (when using multi configuration generators). The template files `Modules/AutoRccInfo.cmake.in` and `Modules/AutogenInfo.cmake.in` were removed in favor of writing the info `.cmake` files manually. Closes #17230
104 lines
2.4 KiB
C++
104 lines
2.4 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#ifndef cmQtAutoGeneratorRcc_h
|
|
#define cmQtAutoGeneratorRcc_h
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#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:
|
|
// -- Types
|
|
|
|
/// @brief Processing stage
|
|
enum class StageT : unsigned char
|
|
{
|
|
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 IsMultiConfig() const { return MultiConfig_; }
|
|
std::string MultiConfigOutput() const;
|
|
bool StartProcess(std::string const& workingDirectory,
|
|
std::vector<std::string> const& command,
|
|
bool mergedOutput);
|
|
|
|
private:
|
|
// -- Config settings
|
|
bool MultiConfig_;
|
|
// -- Directories
|
|
std::string AutogenBuildDir_;
|
|
std::string IncludeDir_;
|
|
// -- Qt environment
|
|
std::string RccExecutable_;
|
|
std::vector<std::string> RccListOptions_;
|
|
// -- Job
|
|
std::string QrcFile_;
|
|
std::string QrcFileName_;
|
|
std::string QrcFileDir_;
|
|
std::string RccPathChecksum_;
|
|
std::string RccFileName_;
|
|
std::string RccFileOutput_;
|
|
std::string RccFilePublic_;
|
|
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_;
|
|
bool SettingsChanged_;
|
|
// -- libuv loop
|
|
StageT Stage_;
|
|
bool Error_;
|
|
bool Generate_;
|
|
bool BuildFileChanged_;
|
|
};
|
|
|
|
#endif
|