forked from qt-creator/qt-creator
Fixes: Create a cbp file if we didn't find one, create All target
Task: - RevBy: - AutoTest: - Details: For now create only one build configuration "AllTargets", build only the "all" target. Create runconfigurations for all targets with option type=4
This commit is contained in:
@@ -50,6 +50,17 @@
|
|||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
|
||||||
|
|
||||||
|
// QtCreator CMake Generator wishlist:
|
||||||
|
// Which make targets we need to build to get all executables
|
||||||
|
// What is the make we need to call
|
||||||
|
// What is the actual compiler executable
|
||||||
|
// DEFINES
|
||||||
|
|
||||||
|
// Open Questions
|
||||||
|
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
|
||||||
|
|
||||||
|
|
||||||
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||||
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
||||||
{
|
{
|
||||||
@@ -57,8 +68,10 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
m_file = new CMakeFile(this, fileName);
|
m_file = new CMakeFile(this, fileName);
|
||||||
QDir dir = QFileInfo(m_fileName).absoluteDir();
|
QDir dir = QFileInfo(m_fileName).absoluteDir();
|
||||||
QString cbpFile = findCbpFile(dir);
|
QString cbpFile = findCbpFile(dir);
|
||||||
if (cbpFile.isEmpty())
|
if (cbpFile.isEmpty()) {
|
||||||
cbpFile = createCbpFile(dir);
|
createCbpFile(dir);
|
||||||
|
cbpFile = findCbpFile(dir);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO move this parsing to a seperate method, which is also called if the CMakeList.txt is updated
|
//TODO move this parsing to a seperate method, which is also called if the CMakeList.txt is updated
|
||||||
CMakeCbpParser cbpparser;
|
CMakeCbpParser cbpparser;
|
||||||
@@ -111,7 +124,7 @@ QString CMakeProject::findCbpFile(const QDir &directory)
|
|||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeProject::createCbpFile(const QDir &directory)
|
void CMakeProject::createCbpFile(const QDir &directory)
|
||||||
{
|
{
|
||||||
// We create a cbp file, only if we didn't find a cbp file in the base directory
|
// We create a cbp file, only if we didn't find a cbp file in the base directory
|
||||||
// Yet that can still override cbp files in subdirectories
|
// Yet that can still override cbp files in subdirectories
|
||||||
@@ -124,8 +137,7 @@ QString CMakeProject::createCbpFile(const QDir &directory)
|
|||||||
QProcess cmake;
|
QProcess cmake;
|
||||||
cmake.setWorkingDirectory(directory.absolutePath());
|
cmake.setWorkingDirectory(directory.absolutePath());
|
||||||
cmake.start("cmake", QStringList() << "-GCodeBlocks - Unix Makefiles");
|
cmake.start("cmake", QStringList() << "-GCodeBlocks - Unix Makefiles");
|
||||||
|
cmake.waitForFinished();
|
||||||
return QString::null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list)
|
void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list)
|
||||||
@@ -261,17 +273,21 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
|||||||
insertBuildStep(0, cmakeStep);
|
insertBuildStep(0, cmakeStep);
|
||||||
insertBuildStep(1, makeStep);
|
insertBuildStep(1, makeStep);
|
||||||
|
|
||||||
|
addBuildConfiguration("AllTargets");
|
||||||
|
setActiveBuildConfiguration("AllTargets");
|
||||||
|
makeStep->setValue("AllTargets", "buildTargets", QStringList() << "all");
|
||||||
|
|
||||||
// Create build configurations of m_targets
|
// Create build configurations of m_targets
|
||||||
qDebug()<<"Create build configurations of m_targets";
|
qDebug()<<"Create build configurations of m_targets";
|
||||||
|
bool setActive = false;
|
||||||
foreach(const CMakeTarget &ct, m_targets) {
|
foreach(const CMakeTarget &ct, m_targets) {
|
||||||
addBuildConfiguration(ct.title);
|
|
||||||
makeStep->setValue(ct.title, "makeCommand", ct.makeCommand);
|
|
||||||
makeStep->setValue(ct.title, "makeCleanCommand", ct.makeCleanCommand);
|
|
||||||
|
|
||||||
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory));
|
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory));
|
||||||
// TODO set build configuration to build before it can be run
|
|
||||||
addRunConfiguration(rc);
|
addRunConfiguration(rc);
|
||||||
setActiveRunConfiguration(rc); // TODO what exactly shall be the active run configuration?
|
// The first one gets the honour of beeing the active one
|
||||||
|
if (!setActive) {
|
||||||
|
setActiveRunConfiguration(rc);
|
||||||
|
setActive = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setActiveBuildConfiguration("all");
|
setActiveBuildConfiguration("all");
|
||||||
|
|
||||||
|
@@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString findCbpFile(const QDir &);
|
QString findCbpFile(const QDir &);
|
||||||
QString createCbpFile(const QDir &);
|
void createCbpFile(const QDir &);
|
||||||
|
|
||||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||||
ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory);
|
ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory);
|
||||||
|
@@ -54,7 +54,7 @@ bool MakeStep::init(const QString &buildConfiguration)
|
|||||||
setEnabled(buildConfiguration, true);
|
setEnabled(buildConfiguration, true);
|
||||||
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
||||||
setCommand(buildConfiguration, "make"); // TODO give full path here?
|
setCommand(buildConfiguration, "make"); // TODO give full path here?
|
||||||
setArguments(buildConfiguration, QStringList()); // TODO
|
setArguments(buildConfiguration, value(buildConfiguration, "buildTargets").toStringList()); // TODO
|
||||||
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
||||||
return AbstractProcessStep::init(buildConfiguration);
|
return AbstractProcessStep::init(buildConfiguration);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user