2007-11-02 18:55:57 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices 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>
|
|
|
|
|
|
|
|
class cmake;
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
/// struct to represent cache properties in Qt
|
|
|
|
/// Value is of type String or Bool
|
2007-11-02 18:50:17 +03:00
|
|
|
struct QCMakeCacheProperty
|
|
|
|
{
|
|
|
|
enum PropertyType { BOOL, PATH, FILEPATH, STRING };
|
|
|
|
QString Key;
|
2007-11-03 17:30:52 +03:00
|
|
|
QVariant Value;
|
2007-11-02 18:50:17 +03:00
|
|
|
QString Help;
|
|
|
|
PropertyType Type;
|
|
|
|
bool Advanced;
|
2007-11-05 21:20:54 +03:00
|
|
|
bool operator==(const QCMakeCacheProperty& other) const
|
|
|
|
{
|
|
|
|
return this->Key == other.Key;
|
|
|
|
}
|
|
|
|
bool operator<(const QCMakeCacheProperty& other) const
|
|
|
|
{
|
|
|
|
return this->Key < other.Key;
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// make types usable with QVariant
|
|
|
|
Q_DECLARE_METATYPE(QCMakeCacheProperty)
|
|
|
|
typedef QList<QCMakeCacheProperty> QCMakeCachePropertyList;
|
|
|
|
Q_DECLARE_METATYPE(QCMakeCachePropertyList)
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
/// Qt API for CMake library.
|
|
|
|
/// Wrapper like class allows for easier integration with
|
|
|
|
/// 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();
|
2008-03-12 05:51:56 +03:00
|
|
|
void SetSuppressDevWarnings(bool value);
|
2007-11-02 18:50:17 +03:00
|
|
|
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
|
2007-11-02 18:50:17 +03:00
|
|
|
void setProperties(const QCMakeCachePropertyList&);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// interrupt the configure or generate process
|
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();
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
public:
|
2007-11-03 17:30:52 +03:00
|
|
|
/// get the list of cache properties
|
2007-11-05 21:20:54 +03:00
|
|
|
QCMakeCachePropertyList 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;
|
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)
|
2007-11-02 18:50:17 +03:00
|
|
|
void propertiesChanged(const QCMakeCachePropertyList& 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);
|
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);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
cmake* CMakeInstance;
|
|
|
|
|
|
|
|
static void progressCallback(const char* msg, float percent, void* cd);
|
2007-11-05 21:20:54 +03:00
|
|
|
static void errorCallback(const char* msg, const char* title,
|
|
|
|
bool&, void* cd);
|
2008-03-12 05:51:56 +03:00
|
|
|
bool SuppressDevWarnings;
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __QCMake_h
|
|
|
|
|