packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmQtAutomoc.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2004-2011 Kitware, Inc.
4   Copyright 2011 Alexander Neundorf (neundorf@kde.org)
5
6   Distributed under the OSI-approved BSD License (the "License");
7   see accompanying file Copyright.txt for details.
8
9   This software is distributed WITHOUT ANY WARRANTY; without even the
10   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11   See the License for more information.
12 ============================================================================*/
13
14 #ifndef cmQtAutomoc_h
15 #define cmQtAutomoc_h
16
17 class cmGlobalGenerator;
18 class cmMakefile;
19
20 class cmQtAutomoc
21 {
22 public:
23   cmQtAutomoc();
24   bool Run(const char* targetDirectory, const char *config);
25
26   bool InitializeMocSourceFile(cmTarget* target);
27   void SetupAutomocTarget(cmTarget* target);
28
29 private:
30   cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
31                                            const char* targetDirectory);
32
33   bool ReadAutomocInfoFile(cmMakefile* makefile,
34                            const char* targetDirectory,
35                            const char *config);
36   bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
37                                  const char* targetDirectory);
38   void WriteOldMocDefinitionsFile(const char* targetDirectory);
39
40   std::string MakeCompileSettingsString(cmMakefile* makefile);
41
42   bool RunAutomoc(cmMakefile* makefile);
43   bool GenerateMoc(const std::string& sourceFile,
44                    const std::string& mocFileName);
45   void ParseCppFile(const std::string& absFilename,
46                     const std::vector<std::string>& headerExtensions,
47                     std::map<std::string, std::string>& includedMocs);
48   void StrictParseCppFile(const std::string& absFilename,
49                           const std::vector<std::string>& headerExtensions,
50                           std::map<std::string, std::string>& includedMocs);
51   void SearchHeadersForCppFile(const std::string& absFilename,
52                               const std::vector<std::string>& headerExtensions,
53                               std::set<std::string>& absHeaders);
54
55   void ParseHeaders(const std::set<std::string>& absHeaders,
56                     const std::map<std::string, std::string>& includedMocs,
57                     std::map<std::string, std::string>& notIncludedMocs);
58
59   void Init();
60
61   std::string Join(const std::vector<std::string>& lst, char separator);
62   bool EndsWith(const std::string& str, const std::string& with);
63   bool StartsWith(const std::string& str, const std::string& with);
64   std::string ReadAll(const std::string& filename);
65
66   std::string QtMajorVersion;
67   std::string Sources;
68   std::string Headers;
69   bool IncludeProjectDirsBefore;
70   std::string Srcdir;
71   std::string Builddir;
72   std::string MocExecutable;
73   std::string MocCompileDefinitionsStr;
74   std::string MocIncludesStr;
75   std::string MocOptionsStr;
76   std::string ProjectBinaryDir;
77   std::string ProjectSourceDir;
78   std::string TargetName;
79
80   std::string CurrentCompileSettingsStr;
81   std::string OldCompileSettingsStr;
82
83   std::string OutMocCppFilename;
84   std::list<std::string> MocIncludes;
85   std::list<std::string> MocDefinitions;
86   std::vector<std::string> MocOptions;
87
88   bool Verbose;
89   bool ColorOutput;
90   bool RunMocFailed;
91   bool GenerateAll;
92   bool RelaxedMode;
93
94 };
95
96 #endif