mirror of
https://github.com/reactos/CMake.git
synced 2025-01-19 01:42:18 +00:00
AUTOGEN: Generators: Use separate header lists for MOC and UIC
This is necessary for the skipMoc and skipUic lists to work properly.
This commit is contained in:
parent
966be439e0
commit
94c319f933
@ -511,7 +511,8 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
|
|||||||
std::map<std::string, std::string> notIncludedMocs;
|
std::map<std::string, std::string> notIncludedMocs;
|
||||||
std::map<std::string, std::vector<std::string> > includedUis;
|
std::map<std::string, std::vector<std::string> > includedUis;
|
||||||
// collects all headers which may need to be mocced
|
// collects all headers which may need to be mocced
|
||||||
std::set<std::string> headerFiles;
|
std::set<std::string> headerFilesMoc;
|
||||||
|
std::set<std::string> headerFilesUic;
|
||||||
|
|
||||||
// Parse sources
|
// Parse sources
|
||||||
{
|
{
|
||||||
@ -527,14 +528,16 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Find additional headers
|
// Find additional headers
|
||||||
this->SearchHeadersForCppFile(absFilename, headerExtensions,
|
this->SearchHeadersForSourceFile(absFilename, headerExtensions,
|
||||||
headerFiles);
|
headerFilesMoc, headerFilesUic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse headers
|
// Parse headers
|
||||||
headerFiles.insert(this->Headers.begin(), this->Headers.end());
|
headerFilesMoc.insert(this->Headers.begin(), this->Headers.end());
|
||||||
this->ParseHeaders(headerFiles, includedMocs, notIncludedMocs, includedUis);
|
headerFilesUic.insert(this->Headers.begin(), this->Headers.end());
|
||||||
|
this->ParseHeaders(headerFilesMoc, headerFilesUic, includedMocs,
|
||||||
|
notIncludedMocs, includedUis);
|
||||||
|
|
||||||
// Generate files
|
// Generate files
|
||||||
if (!this->MocExecutable.empty()) {
|
if (!this->MocExecutable.empty()) {
|
||||||
@ -847,10 +850,10 @@ bool cmQtAutoGenerators::ParseContentForMoc(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmQtAutoGenerators::SearchHeadersForCppFile(
|
void cmQtAutoGenerators::SearchHeadersForSourceFile(
|
||||||
const std::string& absFilename,
|
const std::string& absFilename,
|
||||||
const std::vector<std::string>& headerExtensions,
|
const std::vector<std::string>& headerExtensions,
|
||||||
std::set<std::string>& absHeaders)
|
std::set<std::string>& absHeadersMoc, std::set<std::string>& absHeadersUic)
|
||||||
{
|
{
|
||||||
// search for header files and private header files we may need to moc:
|
// search for header files and private header files we may need to moc:
|
||||||
const std::string basename =
|
const std::string basename =
|
||||||
@ -859,37 +862,64 @@ void cmQtAutoGenerators::SearchHeadersForCppFile(
|
|||||||
cmsys::SystemTools::GetRealPath(absFilename)) +
|
cmsys::SystemTools::GetRealPath(absFilename)) +
|
||||||
'/';
|
'/';
|
||||||
|
|
||||||
|
// Search for regular header
|
||||||
for (std::vector<std::string>::const_iterator ext = headerExtensions.begin();
|
for (std::vector<std::string>::const_iterator ext = headerExtensions.begin();
|
||||||
ext != headerExtensions.end(); ++ext) {
|
ext != headerExtensions.end(); ++ext) {
|
||||||
const std::string headerName = absPath + basename + "." + (*ext);
|
const std::string headerName = absPath + basename + "." + (*ext);
|
||||||
if (cmsys::SystemTools::FileExists(headerName.c_str())) {
|
if (cmsys::SystemTools::FileExists(headerName.c_str())) {
|
||||||
absHeaders.insert(headerName);
|
// Moc headers
|
||||||
|
if (!this->MocExecutable.empty() &&
|
||||||
|
!ListContains(this->SkipMoc, absFilename)) {
|
||||||
|
absHeadersMoc.insert(headerName);
|
||||||
|
}
|
||||||
|
// Uic headers
|
||||||
|
if (!this->UicExecutable.empty() &&
|
||||||
|
!ListContains(this->SkipUic, absFilename)) {
|
||||||
|
absHeadersUic.insert(headerName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Search for private header
|
||||||
for (std::vector<std::string>::const_iterator ext = headerExtensions.begin();
|
for (std::vector<std::string>::const_iterator ext = headerExtensions.begin();
|
||||||
ext != headerExtensions.end(); ++ext) {
|
ext != headerExtensions.end(); ++ext) {
|
||||||
const std::string privateHeaderName = absPath + basename + "_p." + (*ext);
|
const std::string privateHeaderName = absPath + basename + "_p." + (*ext);
|
||||||
if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())) {
|
if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())) {
|
||||||
absHeaders.insert(privateHeaderName);
|
// Moc headers
|
||||||
|
if (!this->MocExecutable.empty() &&
|
||||||
|
!ListContains(this->SkipMoc, absFilename)) {
|
||||||
|
absHeadersMoc.insert(privateHeaderName);
|
||||||
|
}
|
||||||
|
// Uic headers
|
||||||
|
if (!this->UicExecutable.empty() &&
|
||||||
|
!ListContains(this->SkipUic, absFilename)) {
|
||||||
|
absHeadersUic.insert(privateHeaderName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmQtAutoGenerators::ParseHeaders(
|
void cmQtAutoGenerators::ParseHeaders(
|
||||||
const std::set<std::string>& absHeaders,
|
const std::set<std::string>& absHeadersMoc,
|
||||||
|
const std::set<std::string>& absHeadersUic,
|
||||||
const std::map<std::string, std::string>& includedMocs,
|
const std::map<std::string, std::string>& includedMocs,
|
||||||
std::map<std::string, std::string>& notIncludedMocs,
|
std::map<std::string, std::string>& notIncludedMocs,
|
||||||
std::map<std::string, std::vector<std::string> >& includedUis)
|
std::map<std::string, std::vector<std::string> >& includedUis)
|
||||||
{
|
{
|
||||||
for (std::set<std::string>::const_iterator hIt = absHeaders.begin();
|
// Merged header files list to read files only once
|
||||||
hIt != absHeaders.end(); ++hIt) {
|
std::set<std::string> headerFiles;
|
||||||
|
headerFiles.insert(absHeadersMoc.begin(), absHeadersMoc.end());
|
||||||
|
headerFiles.insert(absHeadersUic.begin(), absHeadersUic.end());
|
||||||
|
|
||||||
|
for (std::set<std::string>::const_iterator hIt = headerFiles.begin();
|
||||||
|
hIt != headerFiles.end(); ++hIt) {
|
||||||
const std::string& headerName = *hIt;
|
const std::string& headerName = *hIt;
|
||||||
const std::string contents = ReadAll(headerName);
|
const std::string contents = ReadAll(headerName);
|
||||||
|
|
||||||
// Parse header content for MOC
|
// Parse header content for MOC
|
||||||
if (!this->MocExecutable.empty() &&
|
if (!this->MocExecutable.empty() &&
|
||||||
|
(absHeadersMoc.find(headerName) != absHeadersMoc.end()) &&
|
||||||
(includedMocs.find(headerName) == includedMocs.end())) {
|
(includedMocs.find(headerName) == includedMocs.end())) {
|
||||||
if (ListContains(this->SkipMoc, headerName)) {
|
if (ListContains(this->SkipMoc, headerName)) {
|
||||||
// Skip
|
// Skip
|
||||||
@ -916,7 +946,9 @@ void cmQtAutoGenerators::ParseHeaders(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse header content for UIC
|
// Parse header content for UIC
|
||||||
this->ParseContentForUic(headerName, contents, includedUis);
|
if (absHeadersUic.find(headerName) != absHeadersUic.end()) {
|
||||||
|
this->ParseContentForUic(headerName, contents, includedUis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,13 +55,15 @@ private:
|
|||||||
std::map<std::string, std::string>& includedMocs,
|
std::map<std::string, std::string>& includedMocs,
|
||||||
std::map<std::string, std::vector<std::string> >& includedUis,
|
std::map<std::string, std::vector<std::string> >& includedUis,
|
||||||
bool relaxed);
|
bool relaxed);
|
||||||
void SearchHeadersForCppFile(
|
void SearchHeadersForSourceFile(
|
||||||
const std::string& absFilename,
|
const std::string& absFilename,
|
||||||
const std::vector<std::string>& headerExtensions,
|
const std::vector<std::string>& headerExtensions,
|
||||||
std::set<std::string>& absHeaders);
|
std::set<std::string>& absHeadersMoc,
|
||||||
|
std::set<std::string>& absHeadersUic);
|
||||||
|
|
||||||
void ParseHeaders(
|
void ParseHeaders(
|
||||||
const std::set<std::string>& absHeaders,
|
const std::set<std::string>& absHeadersMoc,
|
||||||
|
const std::set<std::string>& absHeadersUic,
|
||||||
const std::map<std::string, std::string>& includedMocs,
|
const std::map<std::string, std::string>& includedMocs,
|
||||||
std::map<std::string, std::string>& notIncludedMocs,
|
std::map<std::string, std::string>& notIncludedMocs,
|
||||||
std::map<std::string, std::vector<std::string> >& includedUis);
|
std::map<std::string, std::vector<std::string> >& includedUis);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user