Imported Upstream version 2.8.9
[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);
25
26   void SetupAutomocTarget(cmTarget* target);
27
28 private:
29   cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
30                                            const char* targetDirectory);
31
32   bool ReadAutomocInfoFile(cmMakefile* makefile,
33                            const char* targetDirectory);
34   bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
35                                  const char* targetDirectory);
36   void WriteOldMocDefinitionsFile(const char* targetDirectory);
37
38   bool RunAutomoc();
39   bool GenerateMoc(const std::string& sourceFile,
40                    const std::string& mocFileName);
41   void ParseCppFile(const std::string& absFilename,
42                     const std::list<std::string>& headerExtensions,
43                     std::map<std::string, std::string>& includedMocs);
44   void StrictParseCppFile(const std::string& absFilename,
45                           const std::list<std::string>& headerExtensions,
46                           std::map<std::string, std::string>& includedMocs);
47   void SearchHeadersForCppFile(const std::string& absFilename,
48                                const std::list<std::string>& headerExtensions,
49                                std::set<std::string>& absHeaders);
50
51   void ParseHeaders(const std::set<std::string>& absHeaders,
52                     const std::map<std::string, std::string>& includedMocs,
53                     std::map<std::string, std::string>& notIncludedMocs);
54
55   void Init();
56
57   std::string Join(const std::list<std::string>& lst, char separator);
58   bool EndsWith(const std::string& str, const std::string& with);
59   bool StartsWith(const std::string& str, const std::string& with);
60   std::string ReadAll(const std::string& filename);
61
62   std::string QtMajorVersion;
63   std::string Sources;
64   std::string Headers;
65   bool IncludeProjectDirsBefore;
66   std::string Srcdir;
67   std::string Builddir;
68   std::string MocExecutable;
69   std::string MocCompileDefinitionsStr;
70   std::string MocDefinitionsStr;
71   std::string MocIncludesStr;
72   std::string MocOptionsStr;
73   std::string ProjectBinaryDir;
74   std::string ProjectSourceDir;
75   std::string TargetName;
76
77   std::string OldMocDefinitionsStr;
78
79   std::string OutMocCppFilename;
80   std::list<std::string> MocIncludes;
81   std::list<std::string> MocDefinitions;
82   std::vector<std::string> MocOptions;
83
84   bool Verbose;
85   bool ColorOutput;
86   bool RunMocFailed;
87   bool GenerateAll;
88   bool RelaxedMode;
89
90 };
91
92 #endif