1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
6 Date: $Date: 2009-03-12 15:19:27 $
7 Version: $Revision: 1.13 $
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
};
45 bool operator==(const QCMakeProperty
& other
) const
47 return this->Key
== other
.Key
;
49 bool operator<(const QCMakeProperty
& other
) const
51 return this->Key
< other
.Key
;
56 typedef QList
<QCMakeProperty
> QCMakePropertyList
;
58 // allow QVariant to be a property or list of properties
59 Q_DECLARE_METATYPE(QCMakeProperty
)
60 Q_DECLARE_METATYPE(QCMakePropertyList
)
62 /// Qt API for CMake library.
63 /// Wrapper like class allows for easier integration with
64 /// Qt features such as, signal/slot connections, multi-threading, etc..
65 class QCMake
: public QObject
72 /// load the cache file in a directory
73 void loadCache(const QString
& dir
);
74 /// set the source directory containing the source
75 void setSourceDirectory(const QString
& dir
);
76 /// set the binary directory to build in
77 void setBinaryDirectory(const QString
& dir
);
78 /// set the desired generator to use
79 void setGenerator(const QString
& generator
);
80 /// do the configure step
82 /// generate the files
84 /// set the property values
85 void setProperties(const QCMakePropertyList
&);
86 /// interrupt the configure or generate process
88 /// delete the cache in binary directory
90 /// reload the cache in binary directory
92 /// set whether to do debug output
93 void setDebugOutput(bool);
94 /// set whether to do suppress dev warnings
95 void setSuppressDevWarnings(bool value
);
98 /// get the list of cache properties
99 QCMakePropertyList
properties() const;
100 /// get the current binary directory
101 QString
binaryDirectory() const;
102 /// get the current source directory
103 QString
sourceDirectory() const;
104 /// get the current generator
105 QString
generator() const;
106 /// get the available generators
107 QStringList
availableGenerators() const;
108 /// get whether to do debug output
109 bool getDebugOutput() const;
112 /// signal when properties change (during read from disk or configure process)
113 void propertiesChanged(const QCMakePropertyList
& vars
);
114 /// signal when the generator changes
115 void generatorChanged(const QString
& gen
);
116 /// signal when the source directory changes (binary directory already
117 /// containing a CMakeCache.txt file)
118 void sourceDirChanged(const QString
& dir
);
119 /// signal when the binary directory changes
120 void binaryDirChanged(const QString
& dir
);
121 /// signal for progress events
122 void progressChanged(const QString
& msg
, float percent
);
123 /// signal when configure is done
124 void configureDone(int error
);
125 /// signal when generate is done
126 void generateDone(int error
);
127 /// signal when there is an output message
128 void outputMessage(const QString
& msg
);
129 /// signal when there is an error message
130 void errorMessage(const QString
& msg
);
131 /// signal when debug output changes
132 void debugOutputChanged(bool);
135 cmake
* CMakeInstance
;
137 static void progressCallback(const char* msg
, float percent
, void* cd
);
138 static void errorCallback(const char* msg
, const char* title
,
140 bool SuppressDevWarnings
;
141 QString SourceDirectory
;
142 QString BinaryDirectory
;
144 QStringList AvailableGenerators
;
145 QString CMakeExecutable
;