Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / QtDialog / QCMake.h
blob8d1bb9c08d41f12c2da0edca91e710fc3e60884c
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
5 Language: C++
6 Date: $Date: 2007/11/09 20:18:49 $
7 Version: $Revision: 1.8 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef __QCMake_h
19 #define __QCMake_h
20 #ifdef _MSC_VER
21 #pragma warning ( disable : 4127 )
22 #pragma warning ( disable : 4512 )
23 #endif
25 #include <QObject>
26 #include <QString>
27 #include <QVariant>
28 #include <QList>
29 #include <QStringList>
30 #include <QMetaType>
32 class cmake;
34 /// struct to represent cache properties in Qt
35 /// Value is of type String or Bool
36 struct QCMakeCacheProperty
38 enum PropertyType { BOOL, PATH, FILEPATH, STRING };
39 QString Key;
40 QVariant Value;
41 QString Help;
42 PropertyType Type;
43 bool Advanced;
44 bool operator==(const QCMakeCacheProperty& other) const
46 return this->Key == other.Key;
48 bool operator<(const QCMakeCacheProperty& other) const
50 return this->Key < other.Key;
54 // make types usable with QVariant
55 Q_DECLARE_METATYPE(QCMakeCacheProperty)
56 typedef QList<QCMakeCacheProperty> QCMakeCachePropertyList;
57 Q_DECLARE_METATYPE(QCMakeCachePropertyList)
59 /// Qt API for CMake library.
60 /// Wrapper like class allows for easier integration with
61 /// Qt features such as, signal/slot connections, multi-threading, etc..
62 class QCMake : public QObject
64 Q_OBJECT
65 public:
66 QCMake(QObject* p=0);
67 ~QCMake();
69 public slots:
70 /// load the cache file in a directory
71 void loadCache(const QString& dir);
72 /// set the source directory containing the source
73 void setSourceDirectory(const QString& dir);
74 /// set the binary directory to build in
75 void setBinaryDirectory(const QString& dir);
76 /// set the desired generator to use
77 void setGenerator(const QString& generator);
78 /// do the configure step
79 void configure();
80 /// generate the files
81 void generate();
82 /// set the property values
83 void setProperties(const QCMakeCachePropertyList&);
84 /// interrupt the configure or generate process
85 void interrupt();
86 /// delete the cache in binary directory
87 void deleteCache();
88 /// reload the cache in binary directory
89 void reloadCache();
91 public:
92 /// get the list of cache properties
93 QCMakeCachePropertyList properties() const;
94 /// get the current binary directory
95 QString binaryDirectory() const;
96 /// get the current source directory
97 QString sourceDirectory() const;
98 /// get the current generator
99 QString generator() const;
100 /// get the available generators
101 QStringList availableGenerators() const;
103 signals:
104 /// signal when properties change (during read from disk or configure process)
105 void propertiesChanged(const QCMakeCachePropertyList& vars);
106 /// signal when the generator changes
107 void generatorChanged(const QString& gen);
108 /// signal when the source directory changes (binary directory already
109 /// containing a CMakeCache.txt file)
110 void sourceDirChanged(const QString& dir);
111 /// signal for progress events
112 void progressChanged(const QString& msg, float percent);
113 /// signal when configure is done
114 void configureDone(int error);
115 /// signal when generate is done
116 void generateDone(int error);
117 /// signal when there is an output message
118 void outputMessage(const QString& msg);
119 /// signal when there is an error message
120 void errorMessage(const QString& msg);
122 protected:
123 cmake* CMakeInstance;
125 static void progressCallback(const char* msg, float percent, void* cd);
126 static void errorCallback(const char* msg, const char* title,
127 bool&, void* cd);
129 QString SourceDirectory;
130 QString BinaryDirectory;
131 QString Generator;
132 QStringList AvailableGenerators;
133 QString CMakeExecutable;
136 #endif // __QCMake_h