summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmQtAutomoc.cxx80
-rw-r--r--Source/cmQtAutomoc.h18
-rw-r--r--Source/cmake.cxx3
3 files changed, 100 insertions, 1 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)
+{
}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index 657b208..d6f809c 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -1,11 +1,29 @@
#ifndef cmQtAutomoc_h
#define cmQtAutomoc_h
+class cmGlobalGenerator;
+class cmMakefile;
+
class cmQtAutomoc
{
public:
cmQtAutomoc();
bool Run(const char* targetDirectory);
+
+private:
+ cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory);
+
+ bool ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ void WriteOldMocDefinitionsFile(const char* targetDirectory);
+
+ bool RunAutomocQt4();
+
+ std::string QtMajorVersion;
+
};
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 47520df..06229e0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1578,7 +1578,8 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
else if (args[1] == "cmake_automoc")
{
cmQtAutomoc automoc;
- automoc.Run("target directory");
+ automoc.Run(args[2].c_str());
+ return 0;
}
// Tar files