From 881e3cfbf96c7b4f48304d3dfc07899c2e6703de Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 23 Sep 2019 13:21:10 +0200 Subject: Autogen: Variable renames and cleanups --- Source/cmQtAutoGen.h | 5 ++-- Source/cmQtAutoGenInitializer.cxx | 41 ++++++++++++++------------- Source/cmQtAutoGenInitializer.h | 59 +++++++++++++++++++-------------------- Source/cmQtAutoMocUic.h | 5 ++-- Source/cmQtAutoRcc.h | 4 ++- Source/cmcmd.cxx | 8 +++--- 6 files changed, 63 insertions(+), 59 deletions(-) diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 2a28c1e..c8e4203 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -17,7 +17,7 @@ class cmQtAutoGen { public: - /// @brief Integer version + /** Integer version. */ struct IntegerVersion { unsigned int Major = 0; @@ -43,6 +43,7 @@ public: } }; + /** Compiler features. */ class CompilerFeatures { public: @@ -52,7 +53,7 @@ public: }; using CompilerFeaturesHandle = std::shared_ptr; - /// @brief AutoGen generator type + /** AutoGen generator type. */ enum class GenT { GEN, // AUTOGEN diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 3aba19d..0329ac7 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -123,7 +123,7 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin, return cycle; } -/** Sanitizes file search paths */ +/** Sanitizes file search paths. */ class SearchPathSanitizer { public: @@ -353,9 +353,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Include directory this->Dir.Include = cmStrCat(this->Dir.Build, "/include"); - if (this->MultiConfig) { - this->Dir.Include += "_$"; - } // Per config include directories if (this->MultiConfig) { for (std::string const& cfg : this->ConfigsList) { @@ -363,6 +360,10 @@ bool cmQtAutoGenInitializer::InitCustomTargets() dir = cmStrCat(this->Dir.Build, "/include_", cfg); } } + this->Dir.IncludeGenExp = this->Dir.Include; + if (this->MultiConfig) { + this->Dir.IncludeGenExp += "_$"; + } } // Moc, Uic and _autogen target settings @@ -454,7 +455,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Add autogen include directory to the origin target INCLUDE_DIRECTORIES if (this->MocOrUicEnabled() || (this->Rcc.Enabled && this->MultiConfig)) { - this->GenTarget->AddIncludeDirectory(this->Dir.Include, true); + this->GenTarget->AddIncludeDirectory(this->Dir.IncludeGenExp, true); } // Scan files @@ -889,13 +890,15 @@ bool cmQtAutoGenInitializer::InitScanFiles() { cmFilePathChecksum const fpathCheckSum(this->Makefile); for (Qrc& qrc : this->Rcc.Qrcs) { - qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile); - // RCC output file name - qrc.RccFile = cmStrCat(this->Dir.Build, '/', qrc.PathChecksum, "/qrc_", - qrc.QrcName, ".cpp"); + // Path checksum + qrc.QrcPathChecksum = fpathCheckSum.getPart(qrc.QrcFile); + // Output file name + qrc.OutputFile = cmStrCat(this->Dir.Build, '/', qrc.QrcPathChecksum, + "/qrc_", qrc.QrcName, ".cpp"); { - cm::string_view const baseSuffix = - qrc.Unique ? cm::string_view() : cm::string_view(qrc.PathChecksum); + cm::string_view const baseSuffix = qrc.Unique + ? cm::string_view() + : cm::string_view(qrc.QrcPathChecksum); std::string const base = cmStrCat(this->Dir.Info, "/RCC", qrc.QrcName, baseSuffix); qrc.LockFile = cmStrCat(base, ".lock"); @@ -910,7 +913,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() } } } - // RCC options + // rcc options for (Qrc& qrc : this->Rcc.Qrcs) { // Target options std::vector opts = optionsTarget; @@ -920,7 +923,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Replace '-' with '_'. The former is not valid for symbol names. std::replace(name.begin(), name.end(), '-', '_'); if (!qrc.Unique) { - name += cmStrCat('_', qrc.PathChecksum); + name += cmStrCat('_', qrc.QrcPathChecksum); } std::vector nameOpts; nameOpts.emplace_back("-name"); @@ -931,7 +934,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() RccMergeOptions(opts, qrc.Options, modernQt); qrc.Options = std::move(opts); } - // RCC resources + // rcc resources for (Qrc& qrc : this->Rcc.Qrcs) { if (!qrc.Generated) { std::string error; @@ -1099,10 +1102,10 @@ bool cmQtAutoGenInitializer::InitRccTargets() // Register info file as generated by CMake this->Makefile->AddCMakeOutputFile(qrc.InfoFile); // Register file at target - this->AddGeneratedSource(qrc.RccFile, this->Rcc); + this->AddGeneratedSource(qrc.OutputFile, this->Rcc); std::vector ccOutput; - ccOutput.push_back(qrc.RccFile); + ccOutput.push_back(qrc.OutputFile); std::vector ccDepends; // Add the .qrc and info file to the custom command dependencies @@ -1132,7 +1135,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() { ccName = cmStrCat(this->GenTarget->GetName(), "_arcc_", qrc.QrcName); if (!qrc.Unique) { - ccName += cmStrCat('_', qrc.PathChecksum); + ccName += cmStrCat('_', qrc.QrcPathChecksum); } cmTarget* autoRccTarget = this->Makefile->AddUtilityCommand( @@ -1424,9 +1427,9 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() ofs.Write("# Rcc job\n"); ofs.Write("ARCC_LOCK_FILE", qrc.LockFile); ofs.Write("ARCC_SOURCE", qrc.QrcFile); - ofs.Write("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum); + ofs.Write("ARCC_OUTPUT_CHECKSUM", qrc.QrcPathChecksum); ofs.Write("ARCC_OUTPUT_NAME", - cmSystemTools::GetFilenameName(qrc.RccFile)); + cmSystemTools::GetFilenameName(qrc.OutputFile)); ofs.WriteStrings("ARCC_OPTIONS", qrc.Options); ofs.WriteStrings("ARCC_INPUTS", qrc.Resources); } else { diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 7ce9fad..2411936 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -26,29 +26,31 @@ class cmQtAutoGenGlobalInitializer; class cmSourceFile; class cmTarget; -/// @brief Initializes the QtAutoGen generators +/** \class cmQtAutoGenerator + * \brief Initializes the QtAutoGen generators + */ class cmQtAutoGenInitializer : public cmQtAutoGen { public: - /// @brief Rcc job information + /** rcc job. */ class Qrc { public: std::string LockFile; std::string QrcFile; std::string QrcName; - std::string PathChecksum; + std::string QrcPathChecksum; std::string InfoFile; std::string SettingsFile; std::map ConfigSettingsFile; - std::string RccFile; + std::string OutputFile; bool Generated = false; bool Unique = false; std::vector Options; std::vector Resources; }; - /// @brief Moc/Uic file + /** moc and/or uic file. */ struct MUFile { std::string FullPath; @@ -61,7 +63,7 @@ public: }; using MUFileHandle = std::unique_ptr; - /// @brief Abstract moc/uic/rcc generator variables base class + /** Abstract moc/uic/rcc generator variables base class */ struct GenVarsT { bool Enabled = false; @@ -74,20 +76,19 @@ public: std::string Executable; CompilerFeaturesHandle ExecutableFeatures; - /// @brief Constructor GenVarsT(GenT gen) : Gen(gen) , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)){}; }; - /// @brief Writes a CMake info file + /** Writes a CMake info file. */ class InfoWriter { public: - /// @brief Open the given file + /** Open the given file. */ InfoWriter(std::string const& filename); - /// @return True if the file is open + /** @return True if the file is open. */ explicit operator bool() const { return static_cast(Ofs_); } void Write(cm::string_view text) { Ofs_ << text; } @@ -114,7 +115,7 @@ public: }; public: - /// @return The detected Qt version and the required Qt major version + /** @return The detected Qt version and the required Qt major version. */ static std::pair GetQtVersion( cmGeneratorTarget const* genTarget); @@ -128,7 +129,7 @@ public: bool SetupCustomTargets(); private: - /// @brief If moc or uic is enabled, the autogen target will be generated + /** If moc or uic is enabled, the autogen target will be generated. */ bool MocOrUicEnabled() const { return (this->Moc.Enabled || this->Uic.Enabled); @@ -162,7 +163,7 @@ private: cmLocalGenerator* LocalGen = nullptr; cmMakefile* Makefile = nullptr; - // Configuration + // -- Configuration IntegerVersion QtVersion; bool MultiConfig = false; std::string ConfigDefault; @@ -172,7 +173,7 @@ private: bool CMP0071Accept = false; bool CMP0071Warn = false; - /// @brief Common directories + /** Common directories. */ struct { std::string Info; @@ -180,9 +181,10 @@ private: std::string Work; std::string Include; std::map ConfigInclude; + std::string IncludeGenExp; } Dir; - /// @brief Autogen target variables + /** Autogen target variables. */ struct { std::string Name; @@ -204,45 +206,42 @@ private: std::vector FilesGenerated; } AutogenTarget; - /// @brief Moc only variables + /** moc variables. */ struct MocT : public GenVarsT { + MocT() + : GenVarsT(GenT::MOC){}; + std::string PredefsCmd; std::vector Includes; std::map> ConfigIncludes; std::set Defines; std::map> ConfigDefines; std::string MocsCompilation; - - /// @brief Constructor - MocT() - : GenVarsT(GenT::MOC){}; } Moc; - /// @brief Uic only variables + /** uic variables. */ struct UicT : public GenVarsT { + UicT() + : GenVarsT(GenT::UIC){}; + std::set SkipUi; std::vector SearchPaths; std::vector Options; std::map> ConfigOptions; std::vector FileFiles; std::vector> FileOptions; - - /// @brief Constructor - UicT() - : GenVarsT(GenT::UIC){}; } Uic; - /// @brief Rcc only variables + /** rcc variables. */ struct RccT : public GenVarsT { - bool GlobalTarget = false; - std::vector Qrcs; - - /// @brief Constructor RccT() : GenVarsT(GenT::RCC){}; + + bool GlobalTarget = false; + std::vector Qrcs; } Rcc; }; diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 15b66ca..f37d923 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -78,9 +78,8 @@ public: { public: // -- Types - /** - * Entry of the file parsing cache - */ + + /** Entry of the file parsing cache. */ struct FileT { void Clear(); diff --git a/Source/cmQtAutoRcc.h b/Source/cmQtAutoRcc.h index 636a667..5d3bd6a 100644 --- a/Source/cmQtAutoRcc.h +++ b/Source/cmQtAutoRcc.h @@ -14,7 +14,9 @@ class cmMakefile; -// @brief AUTORCC generator +/** \class cmQtAutoRcc + * \brief AUTORCC generator + */ class cmQtAutoRcc : public cmQtAutoGenerator { public: diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 211fd4c..bf856d7 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1058,18 +1058,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) #ifndef CMAKE_BOOTSTRAP if ((args[1] == "cmake_autogen") && (args.size() >= 4)) { cmQtAutoMocUic autoGen; - std::string const& infoDir = args[2]; + std::string const& infoFile = args[2]; std::string const& config = args[3]; - return autoGen.Run(infoDir, config) ? 0 : 1; + return autoGen.Run(infoFile, config) ? 0 : 1; } if ((args[1] == "cmake_autorcc") && (args.size() >= 3)) { - cmQtAutoRcc autoGen; + cmQtAutoRcc autoRcc; std::string const& infoFile = args[2]; std::string config; if (args.size() > 3) { config = args[3]; } - return autoGen.Run(infoFile, config) ? 0 : 1; + return autoRcc.Run(infoFile, config) ? 0 : 1; } #endif -- cgit v0.12