Autogen: Split AutoRcc handling into two methods
The initialize method changes the target, whereas the setup method does not.
This commit is contained in:
parent
2fcafbf613
commit
035b690882
@ -221,6 +221,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
|
|||||||
if (target->GetPropertyAsBool("AUTORCC"))
|
if (target->GetPropertyAsBool("AUTORCC"))
|
||||||
{
|
{
|
||||||
toolNames.push_back("rcc");
|
toolNames.push_back("rcc");
|
||||||
|
this->InitializeAutoRccTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tools = toolNames[0];
|
std::string tools = toolNames[0];
|
||||||
@ -801,14 +802,47 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
|
|||||||
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
|
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target)
|
||||||
|
{
|
||||||
|
cmMakefile *makefile = target->GetMakefile();
|
||||||
|
|
||||||
|
const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
|
||||||
|
|
||||||
|
for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
|
||||||
|
fileIt != srcFiles.end();
|
||||||
|
++fileIt)
|
||||||
|
{
|
||||||
|
cmSourceFile* sf = *fileIt;
|
||||||
|
std::string ext = sf->GetExtension();
|
||||||
|
if (ext == "qrc")
|
||||||
|
{
|
||||||
|
std::string absFile = cmsys::SystemTools::GetRealPath(
|
||||||
|
sf->GetFullPath().c_str());
|
||||||
|
bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
|
||||||
|
|
||||||
|
if (!skip)
|
||||||
|
{
|
||||||
|
std::string basename = cmsys::SystemTools::
|
||||||
|
GetFilenameWithoutLastExtension(absFile);
|
||||||
|
|
||||||
|
std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
|
||||||
|
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||||
|
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||||
|
rcc_output_file.c_str(), false);
|
||||||
|
cmSourceFile* rccCppSource
|
||||||
|
= makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
|
||||||
|
target->AddSourceFile(rccCppSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
|
void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
|
||||||
{
|
{
|
||||||
std::string _rcc_files;
|
std::string _rcc_files;
|
||||||
const char* sepRccFiles = "";
|
const char* sepRccFiles = "";
|
||||||
cmMakefile *makefile = target->GetMakefile();
|
cmMakefile *makefile = target->GetMakefile();
|
||||||
|
|
||||||
std::vector<cmSourceFile*> newFiles;
|
|
||||||
|
|
||||||
const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
|
const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
|
||||||
|
|
||||||
std::string rccFileFiles;
|
std::string rccFileFiles;
|
||||||
@ -841,17 +875,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
|
|||||||
_rcc_files += absFile;
|
_rcc_files += absFile;
|
||||||
sepRccFiles = ";";
|
sepRccFiles = ";";
|
||||||
|
|
||||||
std::string basename = cmsys::SystemTools::
|
|
||||||
GetFilenameWithoutLastExtension(absFile);
|
|
||||||
|
|
||||||
std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
|
|
||||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
|
||||||
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
|
||||||
rcc_output_file.c_str(), false);
|
|
||||||
cmSourceFile* rccCppSource
|
|
||||||
= makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
|
|
||||||
newFiles.push_back(rccCppSource);
|
|
||||||
|
|
||||||
if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
|
if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
|
||||||
{
|
{
|
||||||
std::vector<std::string> optsVec;
|
std::vector<std::string> optsVec;
|
||||||
@ -880,13 +903,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin();
|
|
||||||
fileIt != newFiles.end();
|
|
||||||
++fileIt)
|
|
||||||
{
|
|
||||||
target->AddSourceFile(*fileIt);
|
|
||||||
}
|
|
||||||
|
|
||||||
makefile->AddDefinition("_rcc_files",
|
makefile->AddDefinition("_rcc_files",
|
||||||
cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str());
|
cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str());
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ private:
|
|||||||
std::map<std::string, std::string> &configDefines);
|
std::map<std::string, std::string> &configDefines);
|
||||||
void SetupAutoUicTarget(cmTarget* target,
|
void SetupAutoUicTarget(cmTarget* target,
|
||||||
std::map<std::string, std::string> &configUicOptions);
|
std::map<std::string, std::string> &configUicOptions);
|
||||||
|
void InitializeAutoRccTarget(cmTarget* target);
|
||||||
void SetupAutoRccTarget(cmTarget* target);
|
void SetupAutoRccTarget(cmTarget* target);
|
||||||
|
|
||||||
cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
|
cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user