Autogen: Qrc processing: Generate single map with final input / output names
This commit is contained in:
parent
bc4c7751ab
commit
840b830bc6
|
@ -1351,37 +1351,66 @@ bool cmQtAutoGenerators::InputFilesNewerThanQrc(const std::string& qrcFile,
|
|||
|
||||
bool cmQtAutoGenerators::GenerateQrcFiles()
|
||||
{
|
||||
// generate single map with input / output names
|
||||
std::map<std::string, std::string> qrcGenMap;
|
||||
for(std::vector<std::string>::const_iterator si = this->RccSources.begin();
|
||||
si != this->RccSources.end(); ++si)
|
||||
{
|
||||
std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
|
||||
|
||||
if (ext != ".qrc")
|
||||
const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
|
||||
if (ext == ".qrc")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::vector<std::string> command;
|
||||
command.push_back(this->RccExecutable);
|
||||
|
||||
std::string basename = cmsys::SystemTools::
|
||||
GetFilenameWithoutLastExtension(*si);
|
||||
|
||||
std::string rcc_output_file = this->Builddir
|
||||
+ "CMakeFiles/" + this->OriginTargetName
|
||||
std::string qrcOutputFile = "CMakeFiles/" + this->OriginTargetName
|
||||
+ ".dir/qrc_" + basename + ".cpp";
|
||||
qrcGenMap[*si] = qrcOutputFile;
|
||||
}
|
||||
}
|
||||
|
||||
// generate qrc files
|
||||
for(std::map<std::string, std::string>::const_iterator
|
||||
si = qrcGenMap.begin(); si != qrcGenMap.end(); ++si)
|
||||
{
|
||||
if (!this->GenerateQrc( si->first, si->second))
|
||||
{
|
||||
if (this->RunRccFailed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cmQtAutoGenerators::GenerateQrc (
|
||||
const std::string& qrcInputFile,
|
||||
const std::string& qrcOutputFile )
|
||||
{
|
||||
const std::string basename = cmsys::SystemTools::
|
||||
GetFilenameWithoutLastExtension(qrcInputFile);
|
||||
const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile;
|
||||
|
||||
int sourceNewerThanQrc = 0;
|
||||
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(*si,
|
||||
rcc_output_file,
|
||||
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(qrcInputFile,
|
||||
qrcBuildFile,
|
||||
&sourceNewerThanQrc);
|
||||
generateQrc = generateQrc || (sourceNewerThanQrc >= 0);
|
||||
generateQrc = generateQrc || this->InputFilesNewerThanQrc(*si,
|
||||
rcc_output_file);
|
||||
generateQrc = generateQrc || this->InputFilesNewerThanQrc(qrcInputFile,
|
||||
qrcBuildFile);
|
||||
|
||||
if (this->GenerateAll || generateQrc)
|
||||
{
|
||||
std::string msg = "Generating ";
|
||||
msg += qrcOutputFile;
|
||||
cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
|
||||
|cmsysTerminal_Color_ForegroundBold,
|
||||
msg.c_str(), true, this->ColorOutput);
|
||||
|
||||
std::vector<std::string> command;
|
||||
command.push_back(this->RccExecutable);
|
||||
|
||||
std::map<std::string, std::string>::const_iterator optionIt
|
||||
= this->RccOptions.find(*si);
|
||||
= this->RccOptions.find(qrcInputFile);
|
||||
if (optionIt != this->RccOptions.end())
|
||||
{
|
||||
cmSystemTools::ExpandListArgument(optionIt->second, command);
|
||||
|
@ -1390,8 +1419,8 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
|
|||
command.push_back("-name");
|
||||
command.push_back(basename);
|
||||
command.push_back("-o");
|
||||
command.push_back(rcc_output_file);
|
||||
command.push_back(*si);
|
||||
command.push_back(qrcBuildFile);
|
||||
command.push_back(qrcInputFile);
|
||||
|
||||
if (this->Verbose)
|
||||
{
|
||||
|
@ -1403,14 +1432,13 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
|
|||
&retVal);
|
||||
if (!result || retVal)
|
||||
{
|
||||
std::cerr << "AUTORCC: error: process for " << rcc_output_file <<
|
||||
std::cerr << "AUTORCC: error: process for " << qrcOutputFile <<
|
||||
" failed:\n" << output << std::endl;
|
||||
this->RunRccFailed = true;
|
||||
cmSystemTools::RemoveFile(rcc_output_file);
|
||||
cmSystemTools::RemoveFile(qrcBuildFile);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ private:
|
|||
const std::string& uiInputFile,
|
||||
const std::string& uiOutputFile );
|
||||
bool GenerateQrcFiles();
|
||||
bool GenerateQrc(const std::string& qrcInputFile,
|
||||
const std::string& qrcOutputFile);
|
||||
void ParseCppFile(const std::string& absFilename,
|
||||
const std::vector<std::string>& headerExtensions,
|
||||
std::map<std::string, std::string>& includedMocs,
|
||||
|
|
Loading…
Reference in New Issue