summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutomoc.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-08-07 15:16:00 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-08-14 13:45:13 (GMT)
commitd1c0a5fce6c9adccd1abf6b41ba448976ef895d0 (patch)
tree1095826cdb36ac537cd3719fadb8761e7d4869b8 /Source/cmQtAutomoc.cxx
parenta65011baf109fd0afe759cf3d9e7b6ab7013a805 (diff)
downloadCMake-d1c0a5fce6c9adccd1abf6b41ba448976ef895d0.zip
CMake-d1c0a5fce6c9adccd1abf6b41ba448976ef895d0.tar.gz
CMake-d1c0a5fce6c9adccd1abf6b41ba448976ef895d0.tar.bz2
Start implementing skeleton for automoc in cmake
Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r--Source/cmQtAutomoc.cxx80
1 files changed, 80 insertions, 0 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index efbfc38..26d359d 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -1,3 +1,8 @@
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
#include "cmQtAutomoc.h"
cmQtAutomoc::cmQtAutomoc()
@@ -7,4 +12,79 @@ cmQtAutomoc::cmQtAutomoc()
bool cmQtAutomoc::Run(const char* targetDirectory)
{
+ cmake cm;
+ cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
+ cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
+
+ this->ReadAutomocInfoFile(makefile, targetDirectory);
+ this->ReadOldMocDefinitionsFile(makefile, targetDirectory);
+
+ delete gg;
+ gg = NULL;
+ makefile = NULL;
+
+ if (this->QtMajorVersion == "4")
+ {
+ this->RunAutomocQt4();
+ }
+
+ this->WriteOldMocDefinitionsFile(targetDirectory);
+}
+
+
+cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory)
+{
+ cmGlobalGenerator* gg = new cmGlobalGenerator();
+ gg->SetCMakeInstance(cm);
+
+ cmLocalGenerator* lg = gg->CreateLocalGenerator();
+ lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetHomeDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartDirectory(targetDirectory);
+ gg->SetCurrentLocalGenerator(lg);
+
+ return gg;
+}
+
+
+bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocInfo.cmake";
+
+ if (!makefile->ReadListFile(0, filename.c_str()))
+ {
+ cmSystemTools::Error("Error processing file:", filename.c_str());
+ }
+ return true;
+}
+
+
+bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocOldMocDefinitions.cmake";
+
+ if (!makefile->ReadListFile(0, filename.c_str()))
+ {
+ cmSystemTools::Error("Error processing file:", filename.c_str());
+ }
+ return true;
+}
+
+
+bool cmQtAutomoc::RunAutomocQt4()
+{
+ return true;
+}
+
+
+void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
+{
}