ENH: Add cross compiling support in the GUI in the same dialog that prompts for
[cmake.git] / Source / QtDialog / QCMake.h
blobce7eb6683e0d2eec5f6b69323a32f03877f552de
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
5 Language: C++
6 Date: $Date: 2008-05-15 23:21:01 $
7 Version: $Revision: 1.12 $
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 cmake properties in Qt
35 /// Value is of type String or Bool
36 struct QCMakeProperty
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 QCMakeProperty& other) const
46 return this->Key == other.Key;
48 bool operator<(const QCMakeProperty& other) const
50 return this->Key < other.Key;
54 // list of properties
55 typedef QList<QCMakeProperty> QCMakePropertyList;
57 // allow QVariant to be a property or list of properties
58 Q_DECLARE_METATYPE(QCMakeProperty)
59 Q_DECLARE_METATYPE(QCMakePropertyList)
61 /// Qt API for CMake library.
62 /// Wrapper like class allows for easier integration with
63 /// Qt features such as, signal/slot connections, multi-threading, etc..
64 class QCMake : public QObject
66 Q_OBJECT
67 public:
68 QCMake(QObject* p=0);
69 ~QCMake();
70 public slots:
71 /// load the cache file in a directory
72 void loadCache(const QString& dir);
73 /// set the source directory containing the source
74 void setSourceDirectory(const QString& dir);
75 /// set the binary directory to build in
76 void setBinaryDirectory(const QString& dir);
77 /// set the desired generator to use
78 void setGenerator(const QString& generator);
79 /// do the configure step
80 void configure();
81 /// generate the files
82 void generate();
83 /// set the property values
84 void setProperties(const QCMakePropertyList&);
85 /// interrupt the configure or generate process
86 void interrupt();
87 /// delete the cache in binary directory
88 void deleteCache();
89 /// reload the cache in binary directory
90 void reloadCache();
91 /// set whether to do debug output
92 void setDebugOutput(bool);
93 /// set whether to do suppress dev warnings
94 void setSuppressDevWarnings(bool value);
96 public:
97 /// get the list of cache properties
98 QCMakePropertyList properties() const;
99 /// get the current binary directory
100 QString binaryDirectory() const;
101 /// get the current source directory
102 QString sourceDirectory() const;
103 /// get the current generator
104 QString generator() const;
105 /// get the available generators
106 QStringList availableGenerators() const;
107 /// get whether to do debug output
108 bool getDebugOutput() const;
110 signals:
111 /// signal when properties change (during read from disk or configure process)
112 void propertiesChanged(const QCMakePropertyList& vars);
113 /// signal when the generator changes
114 void generatorChanged(const QString& gen);
115 /// signal when the source directory changes (binary directory already
116 /// containing a CMakeCache.txt file)
117 void sourceDirChanged(const QString& dir);
118 /// signal when the binary directory changes
119 void binaryDirChanged(const QString& dir);
120 /// signal for progress events
121 void progressChanged(const QString& msg, float percent);
122 /// signal when configure is done
123 void configureDone(int error);
124 /// signal when generate is done
125 void generateDone(int error);
126 /// signal when there is an output message
127 void outputMessage(const QString& msg);
128 /// signal when there is an error message
129 void errorMessage(const QString& msg);
130 /// signal when debug output changes
131 void debugOutputChanged(bool);
133 protected:
134 cmake* CMakeInstance;
136 static void progressCallback(const char* msg, float percent, void* cd);
137 static void errorCallback(const char* msg, const char* title,
138 bool&, void* cd);
139 bool SuppressDevWarnings;
140 QString SourceDirectory;
141 QString BinaryDirectory;
142 QString Generator;
143 QStringList AvailableGenerators;
144 QString CMakeExecutable;
147 #endif // __QCMake_h