diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-12-04 10:38:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:24:04 (GMT) |
commit | 98665c35199fffb66ff92f5f15da0e1580625cc0 (patch) | |
tree | 955615c9a6901d94300b48d05e7ab7c453d2fd36 | |
parent | df74f3ff834cacdd46aff7366a479d8317315a7c (diff) | |
download | CMake-98665c35199fffb66ff92f5f15da0e1580625cc0.zip CMake-98665c35199fffb66ff92f5f15da0e1580625cc0.tar.gz CMake-98665c35199fffb66ff92f5f15da0e1580625cc0.tar.bz2 |
QtAutogen: Rename and sort variables
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 74 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 42 |
2 files changed, 70 insertions, 46 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ee5eb11..506c820 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -200,26 +200,35 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( return false; } + // - Target names + this->OriginTargetName = + makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME"); + this->AutogenTargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); + + // - Directories + this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); + this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); + this->CurrentSourceDir = + makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR"); + this->CurrentBinaryDir = + makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR"); + + // - Qt environment this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR"); if (this->QtMajorVersion == "") { this->QtMajorVersion = makefile->GetSafeDefinition("AM_Qt5Core_VERSION_MAJOR"); } - this->Sources = makefile->GetSafeDefinition("AM_SOURCES"); - { - std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES"); - cmSystemTools::ExpandListArgument(rccSources, this->RccSources); - } - this->SkipMoc = makefile->GetSafeDefinition("AM_SKIP_MOC"); - this->SkipUic = makefile->GetSafeDefinition("AM_SKIP_UIC"); - this->Headers = makefile->GetSafeDefinition("AM_HEADERS"); - this->IncludeProjectDirsBefore = - makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"); - this->Srcdir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR"); - this->Builddir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR"); this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE"); this->UicExecutable = makefile->GetSafeDefinition("AM_QT_UIC_EXECUTABLE"); this->RccExecutable = makefile->GetSafeDefinition("AM_QT_RCC_EXECUTABLE"); + + // - File Lists + this->Sources = makefile->GetSafeDefinition("AM_SOURCES"); + this->Headers = makefile->GetSafeDefinition("AM_HEADERS"); + + // - Moc + this->SkipMoc = makefile->GetSafeDefinition("AM_SKIP_MOC"); { std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS"; std::string compileDefsProp = compileDefsPropOrig; @@ -244,12 +253,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( includes ? includes : makefile->GetSafeDefinition(includesPropOrig); } this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); - this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); - this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); - this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); - this->OriginTargetName = - makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME"); + // - Uic + this->SkipUic = makefile->GetSafeDefinition("AM_SKIP_UIC"); { const char* uicOptionsFiles = makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES"); @@ -280,6 +286,12 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( this->UicOptions[*fileIt] = *optionIt; } } + + // - Rcc + { + std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES"); + cmSystemTools::ExpandListArgument(rccSources, this->RccSources); + } { const char* rccOptionsFiles = makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES"); @@ -325,8 +337,13 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( this->RccInputs[*fileIt] = rccInputFiles; } } + + // - Settings this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile); + // - Flags + this->IncludeProjectDirsBefore = + makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"); this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE"); return true; @@ -388,16 +405,17 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile( void cmQtAutoGenerators::Init() { - this->TargetBuildSubDir = this->TargetName; - this->TargetBuildSubDir += "/"; + this->AutogenBuildSubDir = this->AutogenTargetName; + this->AutogenBuildSubDir += "/"; - this->OutMocCppFilenameRel = this->TargetBuildSubDir; + this->OutMocCppFilenameRel = this->AutogenBuildSubDir; this->OutMocCppFilenameRel += "moc_compilation.cpp"; - this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel; + this->OutMocCppFilenameAbs = + this->CurrentBinaryDir + this->OutMocCppFilenameRel; // Init file path checksum generator - fpathCheckSum.setupParentDirs(this->Srcdir, this->Builddir, + fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir, this->ProjectSourceDir, this->ProjectBinaryDir); @@ -1125,8 +1143,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, const std::string& subDirPrefix) { const std::string mocFileRel = - this->TargetBuildSubDir + subDirPrefix + mocFileName; - const std::string mocFileAbs = this->Builddir + mocFileRel; + this->AutogenBuildSubDir + subDirPrefix + mocFileName; + const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel; int sourceNewerThanMoc = 0; bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs, &sourceNewerThanMoc); @@ -1246,8 +1264,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, const std::string& uiOutputFile) { const std::string uicFileRel = - this->TargetBuildSubDir + "include/" + uiOutputFile; - const std::string uicFileAbs = this->Builddir + uicFileRel; + this->AutogenBuildSubDir + "include/" + uiOutputFile; + const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel; int sourceNewerThanUi = 0; bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs, @@ -1328,7 +1346,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles() si != this->RccSources.end(); ++si) { const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si); if (ext == ".qrc") { - qrcGenMap[*si] = this->TargetBuildSubDir + fpathCheckSum.getPart(*si) + + qrcGenMap[*si] = this->AutogenBuildSubDir + fpathCheckSum.getPart(*si) + "/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) + ".cpp"; } @@ -1379,7 +1397,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile, // file names but not for symbol names. std::replace(symbolName.begin(), symbolName.end(), '-', '_'); - const std::string qrcBuildFile = this->Builddir + qrcOutputFile; + const std::string qrcBuildFile = this->CurrentBinaryDir + qrcOutputFile; int sourceNewerThanQrc = 0; bool generateQrc = !cmsys::SystemTools::FileTimeCompare( diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 5fbaf87..c241579 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -102,41 +102,47 @@ private: bool InputFilesNewerThanQrc(const std::string& qrcFile, const std::string& rccOutput); + // - Target names + std::string OriginTargetName; + std::string AutogenTargetName; + // - Directories + std::string ProjectSourceDir; + std::string ProjectBinaryDir; + std::string CurrentSourceDir; + std::string CurrentBinaryDir; + std::string AutogenBuildSubDir; + // - Qt environment std::string QtMajorVersion; - std::string Sources; - std::vector<std::string> RccSources; - std::string SkipMoc; - std::string SkipUic; - std::string Headers; - std::string Srcdir; - std::string Builddir; std::string MocExecutable; std::string UicExecutable; std::string RccExecutable; + // - File lists + std::string Sources; + std::string Headers; + // - Moc + std::string SkipMoc; std::string MocCompileDefinitionsStr; std::string MocIncludesStr; std::string MocOptionsStr; - std::string ProjectBinaryDir; - std::string ProjectSourceDir; - std::string TargetName; - std::string OriginTargetName; - - std::string CurrentCompileSettingsStr; - std::string OldCompileSettingsStr; - - std::string TargetBuildSubDir; std::string OutMocCppFilenameRel; std::string OutMocCppFilenameAbs; std::list<std::string> MocIncludes; std::list<std::string> MocDefinitions; std::vector<std::string> MocOptions; + // - Uic + std::string SkipUic; std::vector<std::string> UicTargetOptions; std::map<std::string, std::string> UicOptions; + // - Rcc + std::vector<std::string> RccSources; std::map<std::string, std::string> RccOptions; std::map<std::string, std::vector<std::string> > RccInputs; - + // - Settings + std::string CurrentCompileSettingsStr; + std::string OldCompileSettingsStr; + // - Utility cmFilePathChecksum fpathCheckSum; - + // - Flags bool IncludeProjectDirsBefore; bool Verbose; bool ColorOutput; |