2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2007-11-02 18:55:57 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2007-11-02 18:55:57 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
#ifndef __QCMake_h
|
|
|
|
#define __QCMake_h
|
2007-11-03 19:50:02 +03:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning ( disable : 4127 )
|
|
|
|
#pragma warning ( disable : 4512 )
|
|
|
|
#endif
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2007-11-03 17:30:52 +03:00
|
|
|
#include <QVariant>
|
2007-11-02 18:50:17 +03:00
|
|
|
#include <QList>
|
2007-11-05 21:20:54 +03:00
|
|
|
#include <QStringList>
|
2007-11-02 18:50:17 +03:00
|
|
|
#include <QMetaType>
|
2012-01-02 22:07:43 +04:00
|
|
|
#include <QAtomicInt>
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
class cmake;
|
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
/// struct to represent cmake properties in Qt
|
2007-11-03 17:30:52 +03:00
|
|
|
/// Value is of type String or Bool
|
2008-05-16 03:21:01 +04:00
|
|
|
struct QCMakeProperty
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
|
|
|
enum PropertyType { BOOL, PATH, FILEPATH, STRING };
|
|
|
|
QString Key;
|
2007-11-03 17:30:52 +03:00
|
|
|
QVariant Value;
|
2009-03-12 18:19:27 +03:00
|
|
|
QStringList Strings;
|
2007-11-02 18:50:17 +03:00
|
|
|
QString Help;
|
|
|
|
PropertyType Type;
|
|
|
|
bool Advanced;
|
2012-08-13 21:42:58 +04:00
|
|
|
bool operator==(const QCMakeProperty& other) const
|
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
return this->Key == other.Key;
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
bool operator<(const QCMakeProperty& other) const
|
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
return this->Key < other.Key;
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
// list of properties
|
|
|
|
typedef QList<QCMakeProperty> QCMakePropertyList;
|
|
|
|
|
|
|
|
// allow QVariant to be a property or list of properties
|
|
|
|
Q_DECLARE_METATYPE(QCMakeProperty)
|
|
|
|
Q_DECLARE_METATYPE(QCMakePropertyList)
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
/// Qt API for CMake library.
|
2012-08-13 21:42:58 +04:00
|
|
|
/// Wrapper like class allows for easier integration with
|
2007-11-03 17:30:52 +03:00
|
|
|
/// Qt features such as, signal/slot connections, multi-threading, etc..
|
2007-11-02 18:50:17 +03:00
|
|
|
class QCMake : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMake(QObject* p=0);
|
|
|
|
~QCMake();
|
|
|
|
public slots:
|
2007-11-03 17:30:52 +03:00
|
|
|
/// load the cache file in a directory
|
2007-11-02 18:50:17 +03:00
|
|
|
void loadCache(const QString& dir);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// set the source directory containing the source
|
2007-11-02 18:50:17 +03:00
|
|
|
void setSourceDirectory(const QString& dir);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// set the binary directory to build in
|
2007-11-02 18:50:17 +03:00
|
|
|
void setBinaryDirectory(const QString& dir);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// set the desired generator to use
|
2007-11-02 18:50:17 +03:00
|
|
|
void setGenerator(const QString& generator);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// do the configure step
|
2007-11-02 18:50:17 +03:00
|
|
|
void configure();
|
2007-11-03 17:30:52 +03:00
|
|
|
/// generate the files
|
2007-11-02 18:50:17 +03:00
|
|
|
void generate();
|
2007-11-03 17:30:52 +03:00
|
|
|
/// set the property values
|
2008-05-16 03:21:01 +04:00
|
|
|
void setProperties(const QCMakePropertyList&);
|
2012-01-02 22:07:43 +04:00
|
|
|
/// interrupt the configure or generate process (if connecting, make a direct connection)
|
2007-11-02 18:50:17 +03:00
|
|
|
void interrupt();
|
2007-11-06 09:16:11 +03:00
|
|
|
/// delete the cache in binary directory
|
|
|
|
void deleteCache();
|
|
|
|
/// reload the cache in binary directory
|
|
|
|
void reloadCache();
|
2008-04-03 01:41:24 +04:00
|
|
|
/// set whether to do debug output
|
|
|
|
void setDebugOutput(bool);
|
2008-05-16 03:21:01 +04:00
|
|
|
/// set whether to do suppress dev warnings
|
|
|
|
void setSuppressDevWarnings(bool value);
|
2010-08-25 20:35:40 +04:00
|
|
|
/// set whether to run cmake with warnings about uninitialized variables
|
|
|
|
void setWarnUninitializedMode(bool value);
|
2010-08-25 20:43:02 +04:00
|
|
|
/// set whether to run cmake with warnings about unused variables
|
|
|
|
void setWarnUnusedMode(bool value);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
public:
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the list of cache properties
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList properties() const;
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the current binary directory
|
2007-11-05 21:20:54 +03:00
|
|
|
QString binaryDirectory() const;
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the current source directory
|
2007-11-05 21:20:54 +03:00
|
|
|
QString sourceDirectory() const;
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the current generator
|
2007-11-05 21:20:54 +03:00
|
|
|
QString generator() const;
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the available generators
|
2007-11-05 21:20:54 +03:00
|
|
|
QStringList availableGenerators() const;
|
2008-04-03 01:41:24 +04:00
|
|
|
/// get whether to do debug output
|
|
|
|
bool getDebugOutput() const;
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
signals:
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when properties change (during read from disk or configure process)
|
2008-05-16 03:21:01 +04:00
|
|
|
void propertiesChanged(const QCMakePropertyList& vars);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when the generator changes
|
2007-11-02 18:50:17 +03:00
|
|
|
void generatorChanged(const QString& gen);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when the source directory changes (binary directory already
|
|
|
|
/// containing a CMakeCache.txt file)
|
2007-11-02 18:50:17 +03:00
|
|
|
void sourceDirChanged(const QString& dir);
|
2008-04-08 03:19:50 +04:00
|
|
|
/// signal when the binary directory changes
|
|
|
|
void binaryDirChanged(const QString& dir);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal for progress events
|
2007-11-02 18:50:17 +03:00
|
|
|
void progressChanged(const QString& msg, float percent);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when configure is done
|
2007-11-02 18:50:17 +03:00
|
|
|
void configureDone(int error);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when generate is done
|
2007-11-02 18:50:17 +03:00
|
|
|
void generateDone(int error);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// signal when there is an output message
|
|
|
|
void outputMessage(const QString& msg);
|
2007-11-09 23:18:49 +03:00
|
|
|
/// signal when there is an error message
|
|
|
|
void errorMessage(const QString& msg);
|
2008-04-03 01:41:24 +04:00
|
|
|
/// signal when debug output changes
|
|
|
|
void debugOutputChanged(bool);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
cmake* CMakeInstance;
|
|
|
|
|
2012-01-02 22:07:43 +04:00
|
|
|
static bool interruptCallback(void*);
|
2007-11-02 18:50:17 +03:00
|
|
|
static void progressCallback(const char* msg, float percent, void* cd);
|
2012-08-13 21:42:58 +04:00
|
|
|
static void errorCallback(const char* msg, const char* title,
|
2007-11-05 21:20:54 +03:00
|
|
|
bool&, void* cd);
|
2008-03-12 05:51:56 +03:00
|
|
|
bool SuppressDevWarnings;
|
2010-08-25 20:35:40 +04:00
|
|
|
bool WarnUninitializedMode;
|
2010-08-25 20:43:02 +04:00
|
|
|
bool WarnUnusedMode;
|
|
|
|
bool WarnUnusedAllMode;
|
2007-11-02 18:50:17 +03:00
|
|
|
QString SourceDirectory;
|
|
|
|
QString BinaryDirectory;
|
|
|
|
QString Generator;
|
2007-11-05 21:20:54 +03:00
|
|
|
QStringList AvailableGenerators;
|
2007-11-02 18:50:17 +03:00
|
|
|
QString CMakeExecutable;
|
2012-01-02 22:07:43 +04:00
|
|
|
QAtomicInt InterruptFlag;
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __QCMake_h
|
|
|
|
|