1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
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 =========================================================================*/
21 #pragma warning ( disable : 4127 )
22 #pragma warning ( disable : 4512 )
29 #include <QStringList>
34 /// struct to represent cmake properties in Qt
35 /// Value is of type String or Bool
38 enum PropertyType
{ BOOL
, PATH
, FILEPATH
, STRING
};
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
;
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
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
81 /// generate the files
83 /// set the property values
84 void setProperties(const QCMakePropertyList
&);
85 /// interrupt the configure or generate process
87 /// delete the cache in binary directory
89 /// reload the cache in binary directory
91 /// set whether to do debug output
92 void setDebugOutput(bool);
93 /// set whether to do suppress dev warnings
94 void setSuppressDevWarnings(bool value
);
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;
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);
134 cmake
* CMakeInstance
;
136 static void progressCallback(const char* msg
, float percent
, void* cd
);
137 static void errorCallback(const char* msg
, const char* title
,
139 bool SuppressDevWarnings
;
140 QString SourceDirectory
;
141 QString BinaryDirectory
;
143 QStringList AvailableGenerators
;
144 QString CMakeExecutable
;