mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 20:28:37 -06:00
QtAutogen: Rename and sort variables
This commit is contained in:
committed by
Brad King
parent
df74f3ff83
commit
98665c3519
@@ -200,26 +200,35 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
|
|||||||
return false;
|
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");
|
this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
|
||||||
if (this->QtMajorVersion == "") {
|
if (this->QtMajorVersion == "") {
|
||||||
this->QtMajorVersion =
|
this->QtMajorVersion =
|
||||||
makefile->GetSafeDefinition("AM_Qt5Core_VERSION_MAJOR");
|
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->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
|
||||||
this->UicExecutable = makefile->GetSafeDefinition("AM_QT_UIC_EXECUTABLE");
|
this->UicExecutable = makefile->GetSafeDefinition("AM_QT_UIC_EXECUTABLE");
|
||||||
this->RccExecutable = makefile->GetSafeDefinition("AM_QT_RCC_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 compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS";
|
||||||
std::string compileDefsProp = compileDefsPropOrig;
|
std::string compileDefsProp = compileDefsPropOrig;
|
||||||
@@ -244,12 +253,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
|
|||||||
includes ? includes : makefile->GetSafeDefinition(includesPropOrig);
|
includes ? includes : makefile->GetSafeDefinition(includesPropOrig);
|
||||||
}
|
}
|
||||||
this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
|
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 =
|
const char* uicOptionsFiles =
|
||||||
makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
|
makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
|
||||||
@@ -280,6 +286,12 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
|
|||||||
this->UicOptions[*fileIt] = *optionIt;
|
this->UicOptions[*fileIt] = *optionIt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - Rcc
|
||||||
|
{
|
||||||
|
std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES");
|
||||||
|
cmSystemTools::ExpandListArgument(rccSources, this->RccSources);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
const char* rccOptionsFiles =
|
const char* rccOptionsFiles =
|
||||||
makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES");
|
makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES");
|
||||||
@@ -325,8 +337,13 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
|
|||||||
this->RccInputs[*fileIt] = rccInputFiles;
|
this->RccInputs[*fileIt] = rccInputFiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - Settings
|
||||||
this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile);
|
this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile);
|
||||||
|
|
||||||
|
// - Flags
|
||||||
|
this->IncludeProjectDirsBefore =
|
||||||
|
makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
|
||||||
this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE");
|
this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -388,16 +405,17 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
|
|||||||
|
|
||||||
void cmQtAutoGenerators::Init()
|
void cmQtAutoGenerators::Init()
|
||||||
{
|
{
|
||||||
this->TargetBuildSubDir = this->TargetName;
|
this->AutogenBuildSubDir = this->AutogenTargetName;
|
||||||
this->TargetBuildSubDir += "/";
|
this->AutogenBuildSubDir += "/";
|
||||||
|
|
||||||
this->OutMocCppFilenameRel = this->TargetBuildSubDir;
|
this->OutMocCppFilenameRel = this->AutogenBuildSubDir;
|
||||||
this->OutMocCppFilenameRel += "moc_compilation.cpp";
|
this->OutMocCppFilenameRel += "moc_compilation.cpp";
|
||||||
|
|
||||||
this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
|
this->OutMocCppFilenameAbs =
|
||||||
|
this->CurrentBinaryDir + this->OutMocCppFilenameRel;
|
||||||
|
|
||||||
// Init file path checksum generator
|
// Init file path checksum generator
|
||||||
fpathCheckSum.setupParentDirs(this->Srcdir, this->Builddir,
|
fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
|
||||||
this->ProjectSourceDir,
|
this->ProjectSourceDir,
|
||||||
this->ProjectBinaryDir);
|
this->ProjectBinaryDir);
|
||||||
|
|
||||||
@@ -1125,8 +1143,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
|
|||||||
const std::string& subDirPrefix)
|
const std::string& subDirPrefix)
|
||||||
{
|
{
|
||||||
const std::string mocFileRel =
|
const std::string mocFileRel =
|
||||||
this->TargetBuildSubDir + subDirPrefix + mocFileName;
|
this->AutogenBuildSubDir + subDirPrefix + mocFileName;
|
||||||
const std::string mocFileAbs = this->Builddir + mocFileRel;
|
const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel;
|
||||||
int sourceNewerThanMoc = 0;
|
int sourceNewerThanMoc = 0;
|
||||||
bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
|
bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
|
||||||
&sourceNewerThanMoc);
|
&sourceNewerThanMoc);
|
||||||
@@ -1246,8 +1264,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
|
|||||||
const std::string& uiOutputFile)
|
const std::string& uiOutputFile)
|
||||||
{
|
{
|
||||||
const std::string uicFileRel =
|
const std::string uicFileRel =
|
||||||
this->TargetBuildSubDir + "include/" + uiOutputFile;
|
this->AutogenBuildSubDir + "include/" + uiOutputFile;
|
||||||
const std::string uicFileAbs = this->Builddir + uicFileRel;
|
const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel;
|
||||||
|
|
||||||
int sourceNewerThanUi = 0;
|
int sourceNewerThanUi = 0;
|
||||||
bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs,
|
bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs,
|
||||||
@@ -1328,7 +1346,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
|
|||||||
si != this->RccSources.end(); ++si) {
|
si != this->RccSources.end(); ++si) {
|
||||||
const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
|
const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
|
||||||
if (ext == ".qrc") {
|
if (ext == ".qrc") {
|
||||||
qrcGenMap[*si] = this->TargetBuildSubDir + fpathCheckSum.getPart(*si) +
|
qrcGenMap[*si] = this->AutogenBuildSubDir + fpathCheckSum.getPart(*si) +
|
||||||
"/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) +
|
"/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) +
|
||||||
".cpp";
|
".cpp";
|
||||||
}
|
}
|
||||||
@@ -1379,7 +1397,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
|
|||||||
// file names but not for symbol names.
|
// file names but not for symbol names.
|
||||||
std::replace(symbolName.begin(), symbolName.end(), '-', '_');
|
std::replace(symbolName.begin(), symbolName.end(), '-', '_');
|
||||||
|
|
||||||
const std::string qrcBuildFile = this->Builddir + qrcOutputFile;
|
const std::string qrcBuildFile = this->CurrentBinaryDir + qrcOutputFile;
|
||||||
|
|
||||||
int sourceNewerThanQrc = 0;
|
int sourceNewerThanQrc = 0;
|
||||||
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(
|
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(
|
||||||
|
|||||||
@@ -102,41 +102,47 @@ private:
|
|||||||
bool InputFilesNewerThanQrc(const std::string& qrcFile,
|
bool InputFilesNewerThanQrc(const std::string& qrcFile,
|
||||||
const std::string& rccOutput);
|
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 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 MocExecutable;
|
||||||
std::string UicExecutable;
|
std::string UicExecutable;
|
||||||
std::string RccExecutable;
|
std::string RccExecutable;
|
||||||
|
// - File lists
|
||||||
|
std::string Sources;
|
||||||
|
std::string Headers;
|
||||||
|
// - Moc
|
||||||
|
std::string SkipMoc;
|
||||||
std::string MocCompileDefinitionsStr;
|
std::string MocCompileDefinitionsStr;
|
||||||
std::string MocIncludesStr;
|
std::string MocIncludesStr;
|
||||||
std::string MocOptionsStr;
|
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 OutMocCppFilenameRel;
|
||||||
std::string OutMocCppFilenameAbs;
|
std::string OutMocCppFilenameAbs;
|
||||||
std::list<std::string> MocIncludes;
|
std::list<std::string> MocIncludes;
|
||||||
std::list<std::string> MocDefinitions;
|
std::list<std::string> MocDefinitions;
|
||||||
std::vector<std::string> MocOptions;
|
std::vector<std::string> MocOptions;
|
||||||
|
// - Uic
|
||||||
|
std::string SkipUic;
|
||||||
std::vector<std::string> UicTargetOptions;
|
std::vector<std::string> UicTargetOptions;
|
||||||
std::map<std::string, std::string> UicOptions;
|
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::string> RccOptions;
|
||||||
std::map<std::string, std::vector<std::string> > RccInputs;
|
std::map<std::string, std::vector<std::string> > RccInputs;
|
||||||
|
// - Settings
|
||||||
|
std::string CurrentCompileSettingsStr;
|
||||||
|
std::string OldCompileSettingsStr;
|
||||||
|
// - Utility
|
||||||
cmFilePathChecksum fpathCheckSum;
|
cmFilePathChecksum fpathCheckSum;
|
||||||
|
// - Flags
|
||||||
bool IncludeProjectDirsBefore;
|
bool IncludeProjectDirsBefore;
|
||||||
bool Verbose;
|
bool Verbose;
|
||||||
bool ColorOutput;
|
bool ColorOutput;
|
||||||
|
|||||||
Reference in New Issue
Block a user