Merge lp:~bzoltan/qtcreator-plugin-cmake/packaging_tunings into lp:qtcreator-plugin-cmake

Proposed by Zoltan Balogh
Status: Merged
Merged at revision: 18
Proposed branch: lp:~bzoltan/qtcreator-plugin-cmake/packaging_tunings
Merge into: lp:qtcreator-plugin-cmake
Diff against target: 3319 lines (+2082/-441)
36 files modified
debian/changelog (+9/-0)
debian/control (+11/-2)
debian/qtcreator-plugin-cmake.install (+5/-2)
debian/rules (+3/-3)
share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt (+4/-0)
share/qtcreator/templates/wizards/plaincapp/cmake/main.c (+7/-0)
share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml (+43/-0)
share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt (+4/-0)
share/qtcreator/templates/wizards/plaincppapp/cmake/main.cpp (+9/-0)
share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml (+43/-0)
src/cmakeprojectmanager/argumentslineedit.cpp (+55/-0)
src/cmakeprojectmanager/argumentslineedit.h (+50/-0)
src/cmakeprojectmanager/cmakeappwizard.cpp (+231/-0)
src/cmakeprojectmanager/cmakeappwizard.h (+82/-0)
src/cmakeprojectmanager/cmakebuildconfiguration.cpp (+131/-11)
src/cmakeprojectmanager/cmakebuildconfiguration.h (+17/-4)
src/cmakeprojectmanager/cmakebuildinfo.h (+1/-1)
src/cmakeprojectmanager/cmakekitinformation.cpp (+161/-0)
src/cmakeprojectmanager/cmakekitinformation.h (+70/-0)
src/cmakeprojectmanager/cmakeopenprojectwizard.cpp (+2/-146)
src/cmakeprojectmanager/cmakeparser.cpp (+2/-0)
src/cmakeprojectmanager/cmakeproject.cpp (+162/-121)
src/cmakeprojectmanager/cmakeproject.h (+23/-5)
src/cmakeprojectmanager/cmakeprojectconstants.h (+3/-0)
src/cmakeprojectmanager/cmakeprojectmanager.cpp (+21/-118)
src/cmakeprojectmanager/cmakeprojectmanager.h (+3/-19)
src/cmakeprojectmanager/cmakeprojectmanager.pro (+16/-6)
src/cmakeprojectmanager/cmakeprojectmanager_global.h (+41/-0)
src/cmakeprojectmanager/cmakeprojectplugin.cpp (+10/-0)
src/cmakeprojectmanager/cmaketool.cpp (+441/-0)
src/cmakeprojectmanager/cmaketool.h (+120/-0)
src/cmakeprojectmanager/cmaketoolmanager.cpp (+97/-0)
src/cmakeprojectmanager/cmaketoolmanager.h (+35/-0)
src/cmakeprojectmanager/generatorinfo.cpp (+127/-0)
src/cmakeprojectmanager/generatorinfo.h (+40/-0)
src/cmakeprojectmanager/makestep.h (+3/-3)
To merge this branch: bzr merge lp:~bzoltan/qtcreator-plugin-cmake/packaging_tunings
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+208745@code.launchpad.net

Commit message

packaging tunings

Description of the change

Packaging tunings. Feel free to ignore the changelog, but the version scheme should be like this.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-02-18 14:30:29 +0000
3+++ debian/changelog 2014-02-28 08:31:43 +0000
4@@ -0,0 +1,9 @@
5+qtcreator-plugin-cmake (3.0.1-0ubuntu1~trusty1~test7) trusty; urgency=medium
6+
7+ [ Benjamin Zeller ]
8+ * Initial release.
9+
10+ [ Zoltán Balogh ]
11+ * First build
12+
13+ -- Zoltán Balogh <zoltan@bakter.hu> Tue, 25 Feb 2014 09:58:07 +0200
14
15=== modified file 'debian/control'
16--- debian/control 2014-02-18 14:36:32 +0000
17+++ debian/control 2014-02-28 08:31:43 +0000
18@@ -9,7 +9,7 @@
19 qt5-qmake (>= 5.2.1~),
20 qtcreator-dev (>= 3.0.1),
21 qttools5-dev-tools (>= 5.2.1~),
22- qtxmlpatterns5-dev-tools
23+ qtxmlpatterns5-dev-tools,
24 Standards-Version: 3.9.4
25 Homepage: https://launchpad.net/qtcreator-plugin-cmake
26 # If you aren't a member of ~ubuntu-sdk-team but need to upload packaging changes,
27@@ -18,7 +18,7 @@
28
29 Package: qtcreator-plugin-cmake
30 Architecture: any
31-Depends: qtcreator (>= 3.0.1)
32+Depends: qtcreator (>= 3.0.1),
33 ${misc:Depends}
34 Description: CMake plugin for Qt Creator IDE
35 Qt Creator is a new, lightweight, cross-platform integrated development
36@@ -27,3 +27,12 @@
37 .
38 This package contains the CMake plugin for Qt Creator, providing
39 support for compiling and running CMake projects.
40+
41+Package: qtcreator-plugin-cmake-dev
42+Architecture: all
43+Depends: qtcreator-plugin-cmake (= ${binary:Version}),
44+ ${misc:Depends},
45+Description: Qt Creator cmake plugin development files
46+ This package contains the developer files for Qt
47+ Creator cmake plugin evelopment
48+
49
50=== renamed file 'debian/qtcreator-plugin-ubuntu.install' => 'debian/qtcreator-plugin-cmake.install'
51--- debian/qtcreator-plugin-ubuntu.install 2014-02-18 14:30:29 +0000
52+++ debian/qtcreator-plugin-cmake.install 2014-02-28 08:31:43 +0000
53@@ -1,2 +1,5 @@
54-usr/lib/*/qtcreator/plugins/Canonical/UbuntuCMakeProjectManager.pluginspec
55-usr/lib/*/qtcreator/plugins/Canonical/libUbuntuCMakeProjectManager.so
56+usr/lib/*/qtcreator/plugins/QtProject/CMakeProjectManager.pluginspec
57+usr/lib/*/qtcreator/plugins/QtProject/libCMakeProjectManager.so
58+usr/share/qtcreator/templates/wizards/plaincppapp
59+usr/share/qtcreator/templates/wizards/plaincapp
60+
61
62=== modified file 'debian/rules'
63--- debian/rules 2014-02-18 14:30:29 +0000
64+++ debian/rules 2014-02-28 08:31:43 +0000
65@@ -1,7 +1,7 @@
66 #!/usr/bin/make -f
67
68 # Uncomment this to turn on verbose mode.
69-#export DH_VERBOSE=1
70+export DH_VERBOSE=1
71
72 export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
73 export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
74@@ -24,5 +24,5 @@
75 cp -r $(CURDIR)/share $(CURDIR)/debian/tmp/usr
76 dh_auto_install --destdir=debian/tmp/usr
77
78-override_dh_shlibdeps:
79- dh_shlibdeps -XlibUbuntu.so
80+override_dh_shlibdeps:
81+ dh_shlibdeps -XlibCMakeProjectManager.so
82
83=== added directory 'share'
84=== added directory 'share/qtcreator'
85=== added directory 'share/qtcreator/templates'
86=== added directory 'share/qtcreator/templates/wizards'
87=== added directory 'share/qtcreator/templates/wizards/plaincapp'
88=== added directory 'share/qtcreator/templates/wizards/plaincapp/cmake'
89=== added file 'share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt'
90--- share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt 1970-01-01 00:00:00 +0000
91+++ share/qtcreator/templates/wizards/plaincapp/cmake/CMakeLists.txt 2014-02-28 08:31:43 +0000
92@@ -0,0 +1,4 @@
93+project(%ProjectName%)
94+cmake_minimum_required(VERSION 2.8)
95+aux_source_directory(. SRC_LIST)
96+add_executable(${PROJECT_NAME} ${SRC_LIST})
97
98=== added file 'share/qtcreator/templates/wizards/plaincapp/cmake/console.png'
99Binary files share/qtcreator/templates/wizards/plaincapp/cmake/console.png 1970-01-01 00:00:00 +0000 and share/qtcreator/templates/wizards/plaincapp/cmake/console.png 2014-02-28 08:31:43 +0000 differ
100=== added file 'share/qtcreator/templates/wizards/plaincapp/cmake/main.c'
101--- share/qtcreator/templates/wizards/plaincapp/cmake/main.c 1970-01-01 00:00:00 +0000
102+++ share/qtcreator/templates/wizards/plaincapp/cmake/main.c 2014-02-28 08:31:43 +0000
103@@ -0,0 +1,7 @@
104+#include <stdio.h>
105+
106+int main(void)
107+{
108+ printf("Hello World!\n");
109+ return 0;
110+}
111
112=== added file 'share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml'
113--- share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml 1970-01-01 00:00:00 +0000
114+++ share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml 2014-02-28 08:31:43 +0000
115@@ -0,0 +1,43 @@
116+<?xml version="1.0" encoding="UTF-8"?>
117+<!--
118+/****************************************************************************
119+**
120+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
121+** Contact: http://www.qt-project.org/legal
122+**
123+** This file is part of Qt Creator.
124+**
125+** Commercial License Usage
126+** Licensees holding valid commercial Qt licenses may use this file in
127+** accordance with the commercial license agreement provided with the
128+** Software or, alternatively, in accordance with the terms contained in
129+** a written agreement between you and Digia. For licensing terms and
130+** conditions see http://qt.digia.com/licensing. For further information
131+** use the contact form at http://qt.digia.com/contact-us.
132+**
133+** GNU Lesser General Public License Usage
134+** Alternatively, this file may be used under the terms of the GNU Lesser
135+** General Public License version 2.1 as published by the Free Software
136+** Foundation and appearing in the file LICENSE.LGPL included in the
137+** packaging of this file. Please review the following information to
138+** ensure the GNU Lesser General Public License version 2.1 requirements
139+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
140+**
141+** In addition, as a special exception, Digia gives you certain additional
142+** rights. These rights are described in the Digia Qt LGPL Exception
143+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
144+**
145+****************************************************************************/
146+-->
147+<wizard version="1" kind="project" firstpage="10" id="S.Plain C (CMake)" category="I.Projects"
148+ platformIndependent="true" featuresRequired="CMake.CMakeSupport"
149+ class="cmakeapp-project">
150+ <icon>console.png</icon>
151+ <description>Creates a plain C project using CMake, not using the Qt library.</description>
152+ <displayname>Plain C Project (Ubuntu CMake Build)</displayname>;
153+ <displaycategory>Non-Qt Project</displaycategory>
154+ <files>
155+ <file source="main.c" target="main.c" openeditor="true"/>
156+ <file source="CMakeLists.txt" openproject="true"/>
157+ </files>
158+</wizard>
159
160=== added directory 'share/qtcreator/templates/wizards/plaincppapp'
161=== added directory 'share/qtcreator/templates/wizards/plaincppapp/cmake'
162=== added file 'share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt'
163--- share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt 1970-01-01 00:00:00 +0000
164+++ share/qtcreator/templates/wizards/plaincppapp/cmake/CMakeLists.txt 2014-02-28 08:31:43 +0000
165@@ -0,0 +1,4 @@
166+project(%ProjectName%)
167+cmake_minimum_required(VERSION 2.8)
168+aux_source_directory(. SRC_LIST)
169+add_executable(${PROJECT_NAME} ${SRC_LIST})
170
171=== added file 'share/qtcreator/templates/wizards/plaincppapp/cmake/console.png'
172Binary files share/qtcreator/templates/wizards/plaincppapp/cmake/console.png 1970-01-01 00:00:00 +0000 and share/qtcreator/templates/wizards/plaincppapp/cmake/console.png 2014-02-28 08:31:43 +0000 differ
173=== added file 'share/qtcreator/templates/wizards/plaincppapp/cmake/main.cpp'
174--- share/qtcreator/templates/wizards/plaincppapp/cmake/main.cpp 1970-01-01 00:00:00 +0000
175+++ share/qtcreator/templates/wizards/plaincppapp/cmake/main.cpp 2014-02-28 08:31:43 +0000
176@@ -0,0 +1,9 @@
177+#include <iostream>
178+
179+using namespace std;
180+
181+int main()
182+{
183+ cout << "Hello World!" << endl;
184+ return 0;
185+}
186
187=== added file 'share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml'
188--- share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml 1970-01-01 00:00:00 +0000
189+++ share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml 2014-02-28 08:31:43 +0000
190@@ -0,0 +1,43 @@
191+<?xml version="1.0" encoding="UTF-8"?>
192+<!--
193+/****************************************************************************
194+**
195+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
196+** Contact: http://www.qt-project.org/legal
197+**
198+** This file is part of Qt Creator.
199+**
200+** Commercial License Usage
201+** Licensees holding valid commercial Qt licenses may use this file in
202+** accordance with the commercial license agreement provided with the
203+** Software or, alternatively, in accordance with the terms contained in
204+** a written agreement between you and Digia. For licensing terms and
205+** conditions see http://qt.digia.com/licensing. For further information
206+** use the contact form at http://qt.digia.com/contact-us.
207+**
208+** GNU Lesser General Public License Usage
209+** Alternatively, this file may be used under the terms of the GNU Lesser
210+** General Public License version 2.1 as published by the Free Software
211+** Foundation and appearing in the file LICENSE.LGPL included in the
212+** packaging of this file. Please review the following information to
213+** ensure the GNU Lesser General Public License version 2.1 requirements
214+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
215+**
216+** In addition, as a special exception, Digia gives you certain additional
217+** rights. These rights are described in the Digia Qt LGPL Exception
218+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
219+**
220+****************************************************************************/
221+-->
222+<wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (CMake)2n'" category="I.Projects"
223+ platformIndependent="true" featuresRequired="CMake.CMakeSupport"
224+ class="cmakeapp-project">
225+ <icon>console.png</icon>
226+ <description>Creates a plain C++ project using CMake, not using the Qt library.</description>
227+ <displayname>Plain C++ Project (Ubuntu CMake Build)</displayname>;
228+ <displaycategory>Non-Qt Project</displaycategory>
229+ <files>
230+ <file source="main.cpp" target="main.cpp" openeditor="true"/>
231+ <file source="CMakeLists.txt" openproject="true"/>
232+ </files>
233+</wizard>
234
235=== added file 'src/cmakeprojectmanager/argumentslineedit.cpp'
236--- src/cmakeprojectmanager/argumentslineedit.cpp 1970-01-01 00:00:00 +0000
237+++ src/cmakeprojectmanager/argumentslineedit.cpp 2014-02-28 08:31:43 +0000
238@@ -0,0 +1,55 @@
239+/****************************************************************************
240+**
241+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
242+** Contact: http://www.qt-project.org/legal
243+**
244+** This file is part of Qt Creator.
245+**
246+** Commercial License Usage
247+** Licensees holding valid commercial Qt licenses may use this file in
248+** accordance with the commercial license agreement provided with the
249+** Software or, alternatively, in accordance with the terms contained in
250+** a written agreement between you and Digia. For licensing terms and
251+** conditions see http://qt.digia.com/licensing. For further information
252+** use the contact form at http://qt.digia.com/contact-us.
253+**
254+** GNU Lesser General Public License Usage
255+** Alternatively, this file may be used under the terms of the GNU Lesser
256+** General Public License version 2.1 as published by the Free Software
257+** Foundation and appearing in the file LICENSE.LGPL included in the
258+** packaging of this file. Please review the following information to
259+** ensure the GNU Lesser General Public License version 2.1 requirements
260+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
261+**
262+** In addition, as a special exception, Digia gives you certain additional
263+** rights. These rights are described in the Digia Qt LGPL Exception
264+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
265+**
266+****************************************************************************/
267+
268+#include "argumentslineedit.h"
269+#include <utils/qtcprocess.h>
270+
271+namespace CMakeProjectManager {
272+
273+ArgumentsLineEdit::ArgumentsLineEdit(QWidget *parent) :
274+ Utils::BaseValidatingLineEdit(parent)
275+{
276+}
277+
278+bool ArgumentsLineEdit::validate(const QString &value, QString *errorMessage) const
279+{
280+ Utils::QtcProcess::SplitError err = Utils::QtcProcess::SplitOk;
281+ Utils::QtcProcess::splitArgs(value,false,&err);
282+
283+ if(err != Utils::QtcProcess::SplitOk) {
284+ if(err == Utils::QtcProcess::BadQuoting)
285+ *errorMessage = tr("Command contains quoting errors");
286+ else if(err == Utils::QtcProcess::FoundMeta)
287+ *errorMessage = tr("Command contains complex shell constructs");
288+ return false;
289+ }
290+ return true;
291+}
292+
293+} // namespace CMakeProjectManager
294
295=== added file 'src/cmakeprojectmanager/argumentslineedit.h'
296--- src/cmakeprojectmanager/argumentslineedit.h 1970-01-01 00:00:00 +0000
297+++ src/cmakeprojectmanager/argumentslineedit.h 2014-02-28 08:31:43 +0000
298@@ -0,0 +1,50 @@
299+/****************************************************************************
300+**
301+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
302+** Contact: http://www.qt-project.org/legal
303+**
304+** This file is part of Qt Creator.
305+**
306+** Commercial License Usage
307+** Licensees holding valid commercial Qt licenses may use this file in
308+** accordance with the commercial license agreement provided with the
309+** Software or, alternatively, in accordance with the terms contained in
310+** a written agreement between you and Digia. For licensing terms and
311+** conditions see http://qt.digia.com/licensing. For further information
312+** use the contact form at http://qt.digia.com/contact-us.
313+**
314+** GNU Lesser General Public License Usage
315+** Alternatively, this file may be used under the terms of the GNU Lesser
316+** General Public License version 2.1 as published by the Free Software
317+** Foundation and appearing in the file LICENSE.LGPL included in the
318+** packaging of this file. Please review the following information to
319+** ensure the GNU Lesser General Public License version 2.1 requirements
320+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
321+**
322+** In addition, as a special exception, Digia gives you certain additional
323+** rights. These rights are described in the Digia Qt LGPL Exception
324+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
325+**
326+****************************************************************************/
327+
328+#ifndef CMAKEPROJECTMANAGER_ARGUMENTSLINEEDIT_H
329+#define CMAKEPROJECTMANAGER_ARGUMENTSLINEEDIT_H
330+
331+#include "cmakeprojectmanager_global.h"
332+#include <utils/basevalidatinglineedit.h>
333+
334+namespace CMakeProjectManager {
335+
336+class CMAKEPROJECTMANAGER_EXPORT ArgumentsLineEdit : public Utils::BaseValidatingLineEdit
337+{
338+ Q_OBJECT
339+public:
340+ explicit ArgumentsLineEdit(QWidget* parent = 0);
341+protected:
342+ virtual bool validate(const QString &value, QString *errorMessage) const;
343+
344+};
345+
346+} // namespace CMakeProjectManager
347+
348+#endif // CMAKEPROJECTMANAGER_ARGUMENTSLINEEDIT_H
349
350=== added file 'src/cmakeprojectmanager/cmakeappwizard.cpp'
351--- src/cmakeprojectmanager/cmakeappwizard.cpp 1970-01-01 00:00:00 +0000
352+++ src/cmakeprojectmanager/cmakeappwizard.cpp 2014-02-28 08:31:43 +0000
353@@ -0,0 +1,231 @@
354+#include "cmakeappwizard.h"
355+#include "cmakekitinformation.h"
356+#include "cmakeprojectmanager.h"
357+#include "cmakeproject.h"
358+#include "cmaketoolmanager.h"
359+
360+#include <utils/qtcassert.h>
361+#include <utils/pathchooser.h>
362+#include <qtsupport/qtkitinformation.h>
363+#include <qtsupport/qtsupportconstants.h>
364+#include <projectexplorer/kitmanager.h>
365+#include <extensionsystem/pluginmanager.h>
366+
367+#include <QDir>
368+#include <QScrollArea>
369+#include <QLabel>
370+#include <QVBoxLayout>
371+#include <QDebug>
372+#include <QLabel>
373+#include <QFormLayout>
374+
375+namespace CMakeProjectManager {
376+
377+using namespace Internal;
378+
379+CMakeAppWizard::CMakeAppWizard()
380+{
381+}
382+
383+QWizard *CMakeAppWizard::createWizardDialog (QWidget *parent, const Core::WizardDialogParameters &wizardDialogParameters) const
384+{
385+ QTC_ASSERT(!parameters().isNull(), return 0);
386+ CMakeAppWizardDialog *projectDialog = new CMakeAppWizardDialog(parent, wizardDialogParameters);
387+
388+ int firstPage = 1;
389+ if(!CMakeToolManager::defaultCMakeTool()->isValid()) {
390+ projectDialog->addChooseCMakePage(firstPage);
391+ firstPage++;
392+ }
393+ projectDialog->addTargetSetupPage(firstPage);
394+
395+ initProjectWizardDialog(projectDialog,
396+ wizardDialogParameters.defaultPath(),
397+ wizardDialogParameters.extensionPages());
398+
399+ projectDialog->setIntroDescription(tr("This wizard generates a Application project using CMake."));
400+ return projectDialog;
401+}
402+
403+bool CMakeAppWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
404+{
405+ const CMakeAppWizardDialog *dialog = qobject_cast<const CMakeAppWizardDialog *>(w);
406+
407+ // Generate user settings
408+ foreach (const Core::GeneratedFile &file, l)
409+ if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
410+ dialog->writeUserFile(file.path());
411+ break;
412+ }
413+
414+ // Post-Generate: Open the projects/editors
415+ return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l ,errorMessage);
416+}
417+
418+void CMakeAppWizard::registerSelf()
419+{
420+ ProjectExplorer::CustomWizard::registerFactory<CMakeAppWizard>(QLatin1String("cmakeapp-project"));
421+}
422+
423+CMakeAppWizardDialog::CMakeAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters &parameters)
424+ : ProjectExplorer::BaseProjectWizardDialog(parent,parameters)
425+ , m_targetSetupPage(0)
426+ , m_cmakePage(0)
427+{
428+ init();
429+}
430+
431+CMakeAppWizardDialog::~CMakeAppWizardDialog()
432+{
433+ if (m_targetSetupPage && !m_targetSetupPage->parent())
434+ delete m_targetSetupPage;
435+
436+ if (m_cmakePage && !m_cmakePage->parent())
437+ delete m_cmakePage;
438+}
439+
440+bool CMakeAppWizardDialog::writeUserFile(const QString &cmakeFileName) const
441+{
442+ if (!m_targetSetupPage)
443+ return false;
444+
445+ CMakeManager *manager = ExtensionSystem::PluginManager::getObject<CMakeManager>();
446+ Q_ASSERT(manager);
447+
448+ CMakeProject *pro = new CMakeProject(manager, cmakeFileName);
449+ bool success = m_targetSetupPage->setupProject(pro);
450+ if (success)
451+ pro->saveSettings();
452+ delete pro;
453+ return success;
454+}
455+
456+
457+void CMakeAppWizardDialog::init()
458+{
459+ connect(this, SIGNAL(projectParametersChanged(QString,QString)),
460+ this, SLOT(generateProfileName(QString,QString)));
461+}
462+
463+int CMakeAppWizardDialog::addTargetSetupPage(int id)
464+{
465+ m_targetSetupPage = new ProjectExplorer::TargetSetupPage;
466+ const QString platform = selectedPlatform();
467+
468+ //prefer Qt Desktop or Platform Kit
469+ Core::FeatureSet features = Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP);
470+ if (platform.isEmpty())
471+ m_targetSetupPage->setPreferredKitMatcher(new QtSupport::QtVersionKitMatcher(features));
472+ else
473+ m_targetSetupPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
474+
475+ //make sure only CMake compatible Kits are shown
476+ m_targetSetupPage->setRequiredKitMatcher(new CMakeKitMatcher());
477+
478+ resize(900, 450);
479+ if (id >= 0)
480+ setPage(id, m_targetSetupPage);
481+ else
482+ id = addPage(m_targetSetupPage);
483+
484+ wizardProgress()->item(id)->setTitle(tr("Kits"));
485+ return id;
486+}
487+
488+int CMakeAppWizardDialog::addChooseCMakePage(int id)
489+{
490+ m_cmakePage = new ChooseCMakePage;
491+
492+ if (id >= 0)
493+ setPage(id, m_cmakePage);
494+ else
495+ id = addPage(m_cmakePage);
496+
497+ wizardProgress()->item(id)->setTitle(tr("CMake"));
498+ return id;
499+}
500+
501+QList<Core::Id> CMakeAppWizardDialog::selectedKits() const
502+{
503+ if(m_targetSetupPage)
504+ return m_targetSetupPage->selectedKits();
505+
506+ return QList<Core::Id>();
507+}
508+
509+void CMakeAppWizardDialog::generateProfileName(const QString &name, const QString &path)
510+{
511+ if (!m_targetSetupPage)
512+ return;
513+
514+ const QString proFile =
515+ QDir::cleanPath(path + QLatin1Char('/') + name + QLatin1Char('/') + QLatin1String("CMakeLists.txt"));
516+
517+ m_targetSetupPage->setProjectPath(proFile);
518+}
519+
520+ChooseCMakePage::ChooseCMakePage(QWidget *parent)
521+ : QWizardPage(parent)
522+{
523+ QFormLayout *fl = new QFormLayout;
524+ fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
525+ setLayout(fl);
526+
527+ m_cmakeLabel = new QLabel;
528+ m_cmakeLabel->setWordWrap(true);
529+ fl->addRow(m_cmakeLabel);
530+ // Show a field for the user to enter
531+ m_cmakeExecutable = new Utils::PathChooser(this);
532+ m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
533+ fl->addRow(tr("CMake Executable:"), m_cmakeExecutable);
534+
535+ connect(m_cmakeExecutable, SIGNAL(editingFinished()),
536+ this, SLOT(cmakeExecutableChanged()));
537+ connect(m_cmakeExecutable, SIGNAL(browsingFinished()),
538+ this, SLOT(cmakeExecutableChanged()));
539+
540+ setTitle(tr("Choose CMake Executable"));
541+ updateErrorText();
542+}
543+
544+void ChooseCMakePage::updateErrorText()
545+{
546+ CMakeTool* cmake = CMakeToolManager::defaultCMakeTool();
547+ QString cmakeExecutable = CMakeToolManager::defaultCMakeTool()->cmakeExecutable();
548+ if (cmake->isValid()) {
549+ m_cmakeLabel->setText(tr("Used CMake: %0.").arg(cmakeExecutable));
550+ } else {
551+ QString text = tr("Specify the path to the CMake executable. No CMake executable was found in the path.");
552+ if (!cmakeExecutable.isEmpty()) {
553+ text += QLatin1Char(' ');
554+ QFileInfo fi(cmakeExecutable);
555+ if (!fi.exists())
556+ text += tr("The CMake executable (%1) does not exist.").arg(cmakeExecutable);
557+ else if (!fi.isExecutable())
558+ text += tr("The path %1 is not an executable.").arg(cmakeExecutable);
559+ else
560+ text += tr("The path %1 is not a valid CMake executable.").arg(cmakeExecutable);
561+ }
562+ m_cmakeLabel->setText(text);
563+ }
564+}
565+
566+void ChooseCMakePage::cmakeExecutableChanged()
567+{
568+ CMakeToolManager::setUserCmakePath(m_cmakeExecutable->path());
569+ updateErrorText();
570+ emit completeChanged();
571+}
572+
573+bool ChooseCMakePage::isComplete() const
574+{
575+ return CMakeToolManager::defaultCMakeTool()->isValid();
576+}
577+
578+ChooseCMakeWizard::ChooseCMakeWizard()
579+{
580+ addPage(new ChooseCMakePage(this));
581+ setWindowTitle(tr("Choose CMake Wizard"));
582+}
583+
584+} // namespace CMakeProjectManager
585
586=== added file 'src/cmakeprojectmanager/cmakeappwizard.h'
587--- src/cmakeprojectmanager/cmakeappwizard.h 1970-01-01 00:00:00 +0000
588+++ src/cmakeprojectmanager/cmakeappwizard.h 2014-02-28 08:31:43 +0000
589@@ -0,0 +1,82 @@
590+#ifndef CMAKEPROJECTMANAGER_CMAKEAPPWIZARD_H
591+#define CMAKEPROJECTMANAGER_CMAKEAPPWIZARD_H
592+
593+#include "cmakeprojectmanager_global.h"
594+#include <projectexplorer/baseprojectwizarddialog.h>
595+#include <projectexplorer/customwizard/customwizard.h>
596+#include <projectexplorer/targetsetuppage.h>
597+
598+QT_BEGIN_NAMESPACE
599+class QLabel;
600+QT_END_NAMESPACE
601+
602+namespace Utils {
603+class PathChooser;
604+}
605+
606+namespace CMakeProjectManager {
607+
608+class ChooseCMakePage;
609+
610+class CMAKEPROJECTMANAGER_EXPORT CMakeAppWizard : public ProjectExplorer::CustomProjectWizard
611+{
612+ Q_OBJECT
613+
614+public:
615+ CMakeAppWizard();
616+ static void registerSelf();
617+
618+private:
619+ QWizard *createWizardDialog(QWidget *parent,
620+ const Core::WizardDialogParameters &wizardDialogParameters) const;
621+ bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
622+
623+private:
624+ enum { targetPageId = 1 };
625+};
626+
627+class CMAKEPROJECTMANAGER_EXPORT CMakeAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
628+{
629+ Q_OBJECT
630+public:
631+ explicit CMakeAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters &parameters);
632+ virtual ~CMakeAppWizardDialog();
633+
634+ int addTargetSetupPage(int id = -1);
635+ int addChooseCMakePage(int id = -1);
636+
637+ QList<Core::Id> selectedKits() const;
638+ bool writeUserFile(const QString &cmakeFileName) const;
639+private slots:
640+ void generateProfileName(const QString &name, const QString &path);
641+private:
642+ ProjectExplorer::TargetSetupPage *m_targetSetupPage;
643+ ChooseCMakePage* m_cmakePage;
644+ void init();
645+};
646+
647+class CMAKEPROJECTMANAGER_EXPORT ChooseCMakePage : public QWizardPage
648+{
649+ Q_OBJECT
650+public:
651+ ChooseCMakePage(QWidget *parent = 0);
652+
653+ virtual bool isComplete() const;
654+public slots:
655+ void cmakeExecutableChanged();
656+private:
657+ void updateErrorText();
658+ QLabel *m_cmakeLabel;
659+ Utils::PathChooser *m_cmakeExecutable;
660+};
661+
662+class ChooseCMakeWizard : public Utils::Wizard
663+{
664+ Q_OBJECT
665+public:
666+ ChooseCMakeWizard();
667+};
668+
669+} // namespace CMakeProjectManager
670+
671+#endif // CMAKEPROJECTMANAGER_CMAKEAPPWIZARD_H
672
673=== modified file 'src/cmakeprojectmanager/cmakebuildconfiguration.cpp'
674--- src/cmakeprojectmanager/cmakebuildconfiguration.cpp 2014-02-18 14:30:29 +0000
675+++ src/cmakeprojectmanager/cmakebuildconfiguration.cpp 2014-02-28 08:31:43 +0000
676@@ -30,9 +30,10 @@
677 #include "cmakebuildconfiguration.h"
678
679 #include "cmakebuildinfo.h"
680-#include "cmakeopenprojectwizard.h"
681 #include "cmakeproject.h"
682 #include "cmakeprojectconstants.h"
683+#include "cmaketoolmanager.h"
684+#include "generatorinfo.h"
685
686 #include <coreplugin/icore.h>
687 #include <coreplugin/mimedatabase.h>
688@@ -40,8 +41,10 @@
689 #include <projectexplorer/kit.h>
690 #include <projectexplorer/projectexplorerconstants.h>
691 #include <projectexplorer/target.h>
692+#include <extensionsystem/pluginmanager.h>
693
694 #include <utils/qtcassert.h>
695+#include <utils/qtcprocess.h>
696
697 #include <QInputDialog>
698
699@@ -50,15 +53,23 @@
700
701 namespace {
702 const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
703+const char USER_ARGS_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UserArguments";
704 } // namespace
705
706 CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
707 BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)), m_useNinja(false)
708 {
709 CMakeProject *project = static_cast<CMakeProject *>(parent->project());
710+
711+
712 setBuildDirectory(Utils::FileName::fromString(project->shadowBuildDirectory(project->projectFilePath(),
713 parent->kit(),
714 displayName())));
715+
716+
717+ connect(this,SIGNAL(argumentsChanged(QStringList)),this,SLOT(runCMake()));
718+ connect(this,SIGNAL(buildDirectoryChanged()),this,SLOT(runCMake()));
719+ connect(this,SIGNAL(useNinjaChanged(bool)),this,SLOT(cleanAndRunCMake()));
720 }
721
722 CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
723@@ -69,12 +80,20 @@
724 {
725 Q_ASSERT(parent);
726 cloneSteps(source);
727+
728+ connect(this,SIGNAL(argumentsChanged(QStringList)),this,SLOT(runCMake()));
729+ connect(this,SIGNAL(buildDirectoryChanged()),this,SLOT(runCMake()));
730+ connect(this,SIGNAL(useNinjaChanged(bool)),this,SLOT(cleanAndRunCMake()));
731 }
732
733 QVariantMap CMakeBuildConfiguration::toMap() const
734 {
735 QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
736 map.insert(QLatin1String(USE_NINJA_KEY), m_useNinja);
737+
738+ if(m_arguments.size())
739+ map.insert(QLatin1String(USER_ARGS_KEY),Utils::QtcProcess::joinArgs(m_arguments));
740+
741 return map;
742 }
743
744@@ -83,11 +102,49 @@
745 if (!BuildConfiguration::fromMap(map))
746 return false;
747
748+ CMakeProject* project = static_cast<CMakeProject*>(this->target()->project());
749+
750 m_useNinja = map.value(QLatin1String(USE_NINJA_KEY), false).toBool();
751+ if(map.contains(QLatin1String(USER_ARGS_KEY)))
752+ m_arguments = Utils::QtcProcess::splitArgs(map.value(QLatin1String(USER_ARGS_KEY)).toString());
753+
754+ /*
755+ * If this evaluates to true, it means there was a in source build before and
756+ * was cleaned out by the user. Instead of querying the user for some build
757+ * directory we just use the default one, the user can always change this if
758+ * he does not like it
759+ */
760+ if(this->buildDirectory() == Utils::FileName::fromString(project->projectDirectory()) && !project->hasInSourceBuild()) {
761+ this->setBuildDirectory(Utils::FileName::fromString(
762+ CMakeProject::shadowBuildDirectory(project->projectFilePath()
763+ ,this->target()->kit()
764+ ,this->displayName())));
765+ }
766
767 return true;
768 }
769
770+void CMakeBuildConfiguration::setBuildDirectory(const Utils::FileName &directory)
771+{
772+ if (directory == buildDirectory())
773+ return;
774+ BuildConfiguration::setBuildDirectory(directory);
775+}
776+
777+void CMakeBuildConfiguration::cleanAndRunCMake()
778+{
779+ QDir dir(buildDirectory().toString());
780+ dir.removeRecursively();
781+
782+ runCMake();
783+}
784+
785+void CMakeBuildConfiguration::runCMake()
786+{
787+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(target()->kit());
788+ cmake->runCMake(target());
789+}
790+
791 bool CMakeBuildConfiguration::useNinja() const
792 {
793 return m_useNinja;
794@@ -101,6 +158,22 @@
795 }
796 }
797
798+QStringList CMakeBuildConfiguration::arguments() const
799+{
800+ return m_arguments;
801+}
802+
803+void CMakeBuildConfiguration::setArguments(const QStringList &args)
804+{
805+ m_arguments = args;
806+ emit argumentsChanged(m_arguments);
807+}
808+
809+QByteArray CMakeBuildConfiguration::generator() const
810+{
811+ return cachedGeneratorFromFile(buildDirectory().toString() + QLatin1String("/CMakeCache.txt"));
812+}
813+
814 CMakeBuildConfiguration::~CMakeBuildConfiguration()
815 { }
816
817@@ -109,6 +182,29 @@
818 return new CMakeBuildSettingsWidget(this);
819 }
820
821+QByteArray CMakeBuildConfiguration::cachedGeneratorFromFile(const QString &cache)
822+{
823+ QFile fi(cache);
824+ if (fi.exists()) {
825+ // Cache exists, then read it...
826+ if (fi.open(QIODevice::ReadOnly | QIODevice::Text)) {
827+ while (!fi.atEnd()) {
828+ QByteArray line = fi.readLine();
829+ if (line.startsWith("CMAKE_GENERATOR:INTERNAL=")) {
830+ int splitpos = line.indexOf('=');
831+ if (splitpos != -1) {
832+ QByteArray cachedGenerator = line.mid(splitpos + 1).trimmed();
833+ if (!cachedGenerator.isEmpty())
834+ return cachedGenerator;
835+ }
836+ }
837+ }
838+ }
839+ }
840+ return QByteArray();
841+}
842+
843+
844 /*!
845 \class CMakeBuildConfigurationFactory
846 */
847@@ -133,6 +229,13 @@
848
849 CMakeBuildInfo *info = createBuildInfo(parent->kit(),
850 parent->project()->projectDirectory());
851+
852+
853+ info->buildDirectory = Utils::FileName::fromString(CMakeProject::shadowBuildDirectory(parent->project()->projectFilePath(),
854+ parent->kit(),
855+ info->displayName));
856+
857+
858 result << info;
859 return result;
860 }
861@@ -150,10 +253,13 @@
862 CMakeBuildInfo *info = createBuildInfo(k, ProjectExplorer::Project::projectDirectory(projectPath));
863 //: The name of the build configuration created by default for a cmake project.
864 info->displayName = tr("Default");
865+
866 info->buildDirectory
867- = Utils::FileName::fromString(CMakeProject::shadowBuildDirectory(projectPath, k,
868+ = Utils::FileName::fromString(CMakeProject::shadowBuildDirectory(projectPath,k,
869 info->displayName));
870+
871 result << info;
872+
873 return result;
874 }
875
876@@ -173,10 +279,6 @@
877 parent->kit(),
878 copy.displayName));
879
880- CMakeOpenProjectWizard copw(project->projectManager(), CMakeOpenProjectWizard::ChangeDirectory, &copy);
881- if (copw.exec() != QDialog::Accepted)
882- return 0;
883-
884 CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
885 bc->setDisplayName(copy.displayName);
886 bc->setDefaultDisplayName(copy.displayName);
887@@ -192,8 +294,8 @@
888 cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
889 cleanMakeStep->setClean(true);
890
891- bc->setBuildDirectory(Utils::FileName::fromString(copw.buildDirectory()));
892- bc->setUseNinja(copw.useNinja());
893+ bc->setBuildDirectory(Utils::FileName::fromString(copy.buildDirectory.toString()));
894+ bc->setUseNinja(copy.useNinja);
895
896 // Default to all
897 if (project->hasBuildTarget(QLatin1String("all")))
898@@ -246,14 +348,32 @@
899 CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExplorer::Kit *k,
900 const QString &sourceDir) const
901 {
902+ //this is safe, because the kit will not be changed and the generator not used outside this function
903+ ProjectExplorer::Kit* otherK = const_cast<ProjectExplorer::Kit*>(k);
904+
905+ CMakeManager *manager = ExtensionSystem::PluginManager::getObject<CMakeManager>();
906+ Q_ASSERT(manager);
907+
908+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(k);
909+ if(!cmake)
910+ return 0;
911+
912+ //there should always be a generator when we reach this stage
913+ QList<GeneratorInfo> generators = GeneratorInfo::generatorInfosFor(otherK
914+ ,GeneratorInfo::OfferNinja
915+ ,manager->preferNinja()
916+ ,cmake->hasCodeBlocksMsvcGenerator());
917+
918 CMakeBuildInfo *info = new CMakeBuildInfo(this);
919 info->typeName = tr("Build");
920 info->kitId = k->id();
921 info->environment = Utils::Environment::systemEnvironment();
922 k->addToEnvironment(info->environment);
923- info->useNinja = false;
924 info->sourceDirectory = sourceDir;
925- info->supportsShadowBuild = true;
926+ info->supportsShadowBuild = !CMakeProject::hasInSourceBuild(info->sourceDirectory);
927+
928+ //if the first generator is ninja, that is the preferred one
929+ info->useNinja = (generators.size() > 0) ? generators.first().isNinja() : false;
930
931 return info;
932 }
933@@ -276,7 +396,7 @@
934
935 // Cover all common CMake build types
936 if (cmakeBuildType.compare(QLatin1String("Release"), Qt::CaseInsensitive) == 0
937- || cmakeBuildType.compare(QLatin1String("MinSizeRel"), Qt::CaseInsensitive) == 0)
938+ || cmakeBuildType.compare(QLatin1String("MinSizeRel"), Qt::CaseInsensitive) == 0)
939 {
940 return Release;
941 } else if (cmakeBuildType.compare(QLatin1String("Debug"), Qt::CaseInsensitive) == 0
942
943=== modified file 'src/cmakeprojectmanager/cmakebuildconfiguration.h'
944--- src/cmakeprojectmanager/cmakebuildconfiguration.h 2014-02-18 14:30:29 +0000
945+++ src/cmakeprojectmanager/cmakebuildconfiguration.h 2014-02-28 08:31:43 +0000
946@@ -30,6 +30,7 @@
947 #ifndef CMAKEBUILDCONFIGURATION_H
948 #define CMAKEBUILDCONFIGURATION_H
949
950+#include "cmakeprojectmanager_global.h"
951 #include <projectexplorer/buildconfiguration.h>
952 #include <projectexplorer/abi.h>
953
954@@ -42,10 +43,11 @@
955
956 namespace Internal {
957 class CMakeProject;
958+}
959
960 class CMakeBuildConfigurationFactory;
961
962-class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
963+class CMAKEPROJECTMANAGER_EXPORT CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
964 {
965 Q_OBJECT
966 friend class CMakeBuildConfigurationFactory;
967@@ -59,25 +61,37 @@
968 QVariantMap toMap() const;
969
970 BuildType buildType() const;
971-
972 bool useNinja() const;
973 void setUseNinja(bool);
974
975+ QStringList arguments() const;
976+ void setArguments (const QStringList &args);
977+
978+ QByteArray generator () const;
979+
980+ static QByteArray cachedGeneratorFromFile(const QString &cache);
981+ void setBuildDirectory(const Utils::FileName &directory);
982 signals:
983 void useNinjaChanged(bool);
984+ void argumentsChanged(const QStringList& list);
985
986 protected:
987 CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
988 bool fromMap(const QVariantMap &map);
989
990+protected slots:
991+ void cleanAndRunCMake();
992+ void runCMake();
993+
994 private:
995+ QStringList m_arguments;
996 QString m_msvcVersion;
997 bool m_useNinja;
998
999 friend class CMakeProject;
1000 };
1001
1002-class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
1003+class CMAKEPROJECTMANAGER_EXPORT CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
1004 {
1005 Q_OBJECT
1006
1007@@ -103,7 +117,6 @@
1008 CMakeBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const QString &sourceDir) const;
1009 };
1010
1011-} // namespace Internal
1012 } // namespace CMakeProjectManager
1013
1014 #endif // CMAKEBUILDCONFIGURATION_H
1015
1016=== modified file 'src/cmakeprojectmanager/cmakebuildinfo.h'
1017--- src/cmakeprojectmanager/cmakebuildinfo.h 2014-02-18 14:30:29 +0000
1018+++ src/cmakeprojectmanager/cmakebuildinfo.h 2014-02-28 08:31:43 +0000
1019@@ -47,7 +47,7 @@
1020 CMakeBuildInfo(const ProjectExplorer::IBuildConfigurationFactory *f) :
1021 ProjectExplorer::BuildInfo(f), useNinja(false) { }
1022
1023- CMakeBuildInfo(const Internal::CMakeBuildConfiguration *bc) :
1024+ CMakeBuildInfo(const CMakeBuildConfiguration *bc) :
1025 ProjectExplorer::BuildInfo(ProjectExplorer::IBuildConfigurationFactory::find(bc->target()))
1026 {
1027 displayName = bc->displayName();
1028
1029=== added file 'src/cmakeprojectmanager/cmakekitinformation.cpp'
1030--- src/cmakeprojectmanager/cmakekitinformation.cpp 1970-01-01 00:00:00 +0000
1031+++ src/cmakeprojectmanager/cmakekitinformation.cpp 2014-02-28 08:31:43 +0000
1032@@ -0,0 +1,161 @@
1033+#include "cmakekitinformation.h"
1034+#include "cmaketool.h"
1035+#include "cmaketoolmanager.h"
1036+#include "cmakeprojectconstants.h"
1037+#include "generatorinfo.h"
1038+
1039+#include <utils/elidinglabel.h>
1040+
1041+using namespace ProjectExplorer;
1042+using namespace Utils;
1043+
1044+namespace CMakeProjectManager {
1045+
1046+CMakeKitInformation::CMakeKitInformation()
1047+{
1048+ setId(CMakeKitInformation::id());
1049+}
1050+
1051+QVariant CMakeKitInformation::defaultValue(Kit *kit) const
1052+{
1053+ Q_UNUSED(kit);
1054+ return QString::fromLatin1(Constants::CMAKE_TOOL_ID);
1055+}
1056+
1057+QList<Task> CMakeKitInformation::validate(const Kit *) const
1058+{
1059+ return QList<Task>();
1060+}
1061+
1062+KitInformation::ItemList CMakeKitInformation::toUserOutput(const Kit *kit) const
1063+{
1064+ return KitInformation::ItemList()
1065+ << qMakePair(tr("CMake Tool"), cmakeTool(kit)->displayName());
1066+}
1067+
1068+KitConfigWidget *CMakeKitInformation::createConfigWidget(Kit *kit) const
1069+{
1070+ return new CMakeKitInformationWidget(kit, this);
1071+}
1072+
1073+Core::Id CMakeKitInformation::id()
1074+{
1075+ return "CMakeProjectManager.KitInformation";
1076+}
1077+
1078+bool CMakeKitInformation::hasSpecialCMakeTool(const Kit *kit)
1079+{
1080+ QString id(kit->value(CMakeKitInformation::id()).toString());
1081+ if(id.isNull())
1082+ return false;
1083+
1084+ if(id == QString::fromLatin1(Constants::CMAKE_TOOL_ID))
1085+ return false;
1086+
1087+ return true;
1088+}
1089+
1090+ICMakeTool* CMakeKitInformation::cmakeTool(const Kit *kit)
1091+{
1092+ Core::Id id = cmakeToolId(kit);
1093+
1094+ qDebug()<<"Kit "<<kit->displayName()<<" requests "<<id.toString();
1095+
1096+ if(!id.isValid() || id == Constants::CMAKE_TOOL_ID)
1097+ return CMakeToolManager::defaultCMakeTool();
1098+
1099+ ICMakeTool* tool = CMakeToolManager::cmakeTool(id);
1100+ //the cmake tool id is not known, fall back to default tool
1101+ //should we also remove the ID from the KIT?
1102+ if(!tool) {
1103+ return CMakeToolManager::defaultCMakeTool();
1104+ }
1105+ return tool;
1106+}
1107+
1108+Core::Id CMakeKitInformation::cmakeToolId(const Kit *kit)
1109+{
1110+ Core::Id test = Core::Id::fromSetting(kit->value(CMakeKitInformation::id()));
1111+ qDebug()<<"Id for kit: "<<kit->displayName()<<" "<<test.toString()<<" "<<test.uniqueIdentifier();
1112+ return test;
1113+}
1114+
1115+void CMakeKitInformation::setCMakeTool(Kit *kit, const Core::Id &toolId)
1116+{
1117+ kit->setValue(CMakeKitInformation::id(), toolId.toSetting());
1118+}
1119+
1120+///////////////
1121+// CMakeKitInformationWidget
1122+///////////////
1123+
1124+
1125+CMakeKitInformationWidget::CMakeKitInformationWidget(Kit *kit, const KitInformation *ki)
1126+ : KitConfigWidget(kit, ki),
1127+ m_label(new ElidingLabel)
1128+{
1129+ refresh();
1130+}
1131+
1132+CMakeKitInformationWidget::~CMakeKitInformationWidget()
1133+{
1134+ delete m_label;
1135+}
1136+
1137+QString CMakeKitInformationWidget::displayName() const
1138+{
1139+ return tr("CMake Tool");
1140+}
1141+
1142+QString CMakeKitInformationWidget::toolTip() const
1143+{
1144+ return tr("The CMake Tool used for this Kit.");
1145+}
1146+
1147+void CMakeKitInformationWidget::makeReadOnly()
1148+{
1149+}
1150+
1151+void CMakeKitInformationWidget::refresh()
1152+{
1153+ m_label->setText(CMakeKitInformation::cmakeTool(m_kit)->displayName());
1154+}
1155+
1156+bool CMakeKitInformationWidget::visibleInKit()
1157+{
1158+ Core::Id toolId = CMakeKitInformation::cmakeToolId(m_kit);
1159+ if(!toolId.isValid() || toolId == Constants::CMAKE_TOOL_ID)
1160+ return false;
1161+ return true;
1162+}
1163+
1164+QWidget *CMakeKitInformationWidget::mainWidget() const
1165+{
1166+ return m_label;
1167+}
1168+
1169+QWidget *CMakeKitInformationWidget::buttonWidget() const
1170+{
1171+ return 0;
1172+}
1173+
1174+bool CMakeKitMatcher::matches(const ProjectExplorer::Kit *k) const
1175+{
1176+ //this is safe, since the returned list is not used for more than checking
1177+ //if there are any results
1178+ ProjectExplorer::Kit* otherKit = const_cast<ProjectExplorer::Kit*>(k);
1179+
1180+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(k);
1181+ if(!cmake)
1182+ return false;
1183+
1184+ QList<Internal::GeneratorInfo> infos = Internal::GeneratorInfo::generatorInfosFor(otherKit
1185+ ,Internal::GeneratorInfo::OfferNinja
1186+ ,false //not relevant at this place
1187+ ,cmake->hasCodeBlocksMsvcGenerator());
1188+
1189+ qDebug()<<"Found "<<infos.size()<<"Kits for "<<k->displayName();
1190+ return (infos.size() > 0);
1191+}
1192+
1193+} // namespace CMakeProjectManager
1194
1195=== added file 'src/cmakeprojectmanager/cmakekitinformation.h'
1196--- src/cmakeprojectmanager/cmakekitinformation.h 1970-01-01 00:00:00 +0000
1197+++ src/cmakeprojectmanager/cmakekitinformation.h 2014-02-28 08:31:43 +0000
1198@@ -0,0 +1,70 @@
1199+#ifndef CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
1200+#define CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
1201+
1202+#include "cmakeprojectmanager_global.h"
1203+#include <projectexplorer/kitmanager.h>
1204+#include <projectexplorer/kitinformation.h>
1205+#include <projectexplorer/kitconfigwidget.h>
1206+
1207+QT_BEGIN_NAMESPACE
1208+class QLabel;
1209+class QPushButton;
1210+QT_END_NAMESPACE
1211+
1212+namespace CMakeProjectManager {
1213+
1214+class ICMakeTool;
1215+
1216+class CMAKEPROJECTMANAGER_EXPORT CMakeKitInformationWidget : public ProjectExplorer::KitConfigWidget
1217+{
1218+ Q_OBJECT
1219+public:
1220+ CMakeKitInformationWidget(ProjectExplorer::Kit *kit,
1221+ const ProjectExplorer::KitInformation *ki);
1222+ ~CMakeKitInformationWidget();
1223+
1224+ QString displayName() const;
1225+ QString toolTip() const;
1226+ void makeReadOnly();
1227+ void refresh();
1228+ bool visibleInKit();
1229+
1230+ QWidget *mainWidget() const;
1231+ QWidget *buttonWidget() const;
1232+
1233+private:
1234+ QLabel *m_label;
1235+ QPushButton *m_button;
1236+};
1237+
1238+class CMAKEPROJECTMANAGER_EXPORT CMakeKitInformation : public ProjectExplorer::KitInformation
1239+{
1240+ Q_OBJECT
1241+public:
1242+ CMakeKitInformation();
1243+
1244+ QVariant defaultValue(ProjectExplorer::Kit *) const;
1245+
1246+ QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *) const;
1247+
1248+ ItemList toUserOutput(const ProjectExplorer::Kit *) const;
1249+
1250+ ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *) const;
1251+
1252+ static Core::Id id();
1253+ static bool hasSpecialCMakeTool(const ProjectExplorer::Kit *kit);
1254+ static ICMakeTool* cmakeTool(const ProjectExplorer::Kit *kit);
1255+ static Core::Id cmakeToolId(const ProjectExplorer::Kit *kit);
1256+ static void setCMakeTool(ProjectExplorer::Kit *kit, const Core::Id &toolId);
1257+};
1258+
1259+class CMAKEPROJECTMANAGER_EXPORT CMakeKitMatcher : public ProjectExplorer::KitMatcher
1260+{
1261+public:
1262+ explicit CMakeKitMatcher() { }
1263+ bool matches(const ProjectExplorer::Kit *k) const;
1264+};
1265+
1266+} // namespace CMakeProjectManager
1267+
1268+#endif // CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
1269
1270=== modified file 'src/cmakeprojectmanager/cmakeopenprojectwizard.cpp'
1271--- src/cmakeprojectmanager/cmakeopenprojectwizard.cpp 2014-02-18 14:30:29 +0000
1272+++ src/cmakeprojectmanager/cmakeopenprojectwizard.cpp 2014-02-28 08:31:43 +0000
1273@@ -31,19 +31,16 @@
1274 #include "cmakeprojectmanager.h"
1275 #include "cmakebuildconfiguration.h"
1276 #include "cmakebuildinfo.h"
1277+#include "generatorinfo.h"
1278
1279 #include <coreplugin/icore.h>
1280 #include <utils/hostosinfo.h>
1281 #include <utils/pathchooser.h>
1282 #include <utils/fancylineedit.h>
1283 #include <utils/historycompleter.h>
1284-#include <projectexplorer/kitinformation.h>
1285 #include <projectexplorer/kitmanager.h>
1286-#include <projectexplorer/toolchain.h>
1287-#include <projectexplorer/abi.h>
1288 #include <projectexplorer/projectexplorerconstants.h>
1289 #include <texteditor/fontsettings.h>
1290-#include <remotelinux/remotelinux_constants.h>
1291
1292 #include <QVBoxLayout>
1293 #include <QFormLayout>
1294@@ -69,147 +66,6 @@
1295 // |--> Already existing cbp file (and new enough) --> Page: Ready to load the project
1296 // |--> Page: Ask for cmd options, run generator
1297
1298-
1299-namespace CMakeProjectManager {
1300-namespace Internal {
1301- class GeneratorInfo
1302- {
1303- Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::GeneratorInfo)
1304- public:
1305- enum Ninja { NoNinja, OfferNinja, ForceNinja };
1306- static QList<GeneratorInfo> generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks);
1307-
1308- GeneratorInfo();
1309- explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false);
1310-
1311- ProjectExplorer::Kit *kit() const;
1312- bool isNinja() const;
1313-
1314- QString displayName() const;
1315- QByteArray generatorArgument() const;
1316- QByteArray generator() const;
1317-
1318- private:
1319- ProjectExplorer::Kit *m_kit;
1320- bool m_isNinja;
1321- };
1322-}
1323-}
1324-
1325-Q_DECLARE_METATYPE(CMakeProjectManager::Internal::GeneratorInfo);
1326-
1327-GeneratorInfo::GeneratorInfo()
1328- : m_kit(0), m_isNinja(false)
1329-{}
1330-
1331-GeneratorInfo::GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja)
1332- : m_kit(kit), m_isNinja(ninja)
1333-{}
1334-
1335-ProjectExplorer::Kit *GeneratorInfo::kit() const
1336-{
1337- return m_kit;
1338-}
1339-
1340-bool GeneratorInfo::isNinja() const {
1341- return m_isNinja;
1342-}
1343-
1344-QByteArray GeneratorInfo::generator() const
1345-{
1346- if (!m_kit)
1347- return QByteArray();
1348- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit);
1349- ProjectExplorer::Abi targetAbi = tc->targetAbi();
1350- if (m_isNinja) {
1351- return "Ninja";
1352- } else if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
1353- if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
1354- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
1355- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
1356- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
1357- return "NMake Makefiles";
1358- } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
1359- if (Utils::HostOsInfo::isWindowsHost())
1360- return "MinGW Makefiles";
1361- else
1362- return "Unix Makefiles";
1363- }
1364- }
1365- return "Unix Makefiles";
1366-}
1367-
1368-QByteArray GeneratorInfo::generatorArgument() const
1369-{
1370- QByteArray tmp = generator();
1371- if (tmp.isEmpty())
1372- return tmp;
1373- return QByteArray("-GCodeBlocks - ") + tmp;
1374-}
1375-
1376-QString GeneratorInfo::displayName() const
1377-{
1378- if (!m_kit)
1379- return QString();
1380- if (m_isNinja)
1381- return tr("Ninja (%1)").arg(m_kit->displayName());
1382- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit);
1383- ProjectExplorer::Abi targetAbi = tc->targetAbi();
1384- if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
1385- if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
1386- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
1387- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
1388- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
1389- return tr("NMake Generator (%1)").arg(m_kit->displayName());
1390- } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
1391- if (Utils::HostOsInfo::isWindowsHost())
1392- return tr("MinGW Generator (%1)").arg(m_kit->displayName());
1393- else
1394- return tr("Unix Generator (%1)").arg(m_kit->displayName());
1395- }
1396- } else {
1397- // Non windows
1398- return tr("Unix Generator (%1)").arg(m_kit->displayName());
1399- }
1400- return QString();
1401-}
1402-
1403-QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks)
1404-{
1405- QList<GeneratorInfo> results;
1406- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
1407- if (!tc)
1408- return results;
1409- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
1410- if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
1411- && deviceType != RemoteLinux::Constants::GenericLinuxOsType)
1412- return results;
1413- ProjectExplorer::Abi targetAbi = tc->targetAbi();
1414- if (n != ForceNinja) {
1415- if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
1416- if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
1417- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
1418- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
1419- || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
1420- if (hasCodeBlocks)
1421- results << GeneratorInfo(k);
1422- } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
1423- results << GeneratorInfo(k);
1424- }
1425- } else {
1426- // Non windows
1427- results << GeneratorInfo(k);
1428- }
1429- }
1430- if (n != NoNinja) {
1431- if (preferNinja)
1432- results.prepend(GeneratorInfo(k, true));
1433- else
1434- results.append(GeneratorInfo(k, true));
1435- }
1436- return results;
1437-}
1438-
1439 //////////////
1440 /// CMakeOpenProjectWizard
1441 //////////////
1442@@ -751,7 +607,7 @@
1443 connect(m_cmakeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(cmakeReadyReadStandardOutput()));
1444 connect(m_cmakeProcess, SIGNAL(readyReadStandardError()), this, SLOT(cmakeReadyReadStandardError()));
1445 connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished()));
1446- cmakeManager->createXmlFile(m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(),
1447+ cmakeManager->createXmlFile( m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(),
1448 m_buildDirectory, env, QString::fromLatin1(generatorInfo.generatorArgument()));
1449 } else {
1450 m_runCMake->setEnabled(true);
1451
1452=== modified file 'src/cmakeprojectmanager/cmakeparser.cpp'
1453--- src/cmakeprojectmanager/cmakeparser.cpp 2014-02-18 14:30:29 +0000
1454+++ src/cmakeprojectmanager/cmakeparser.cpp 2014-02-28 08:31:43 +0000
1455@@ -188,6 +188,7 @@
1456
1457 void CMakeProjectPlugin::testCMakeParser()
1458 {
1459+#if 0
1460 OutputParserTester testbench;
1461 testbench.appendOutputParser(new CMakeParser);
1462 QFETCH(QString, input);
1463@@ -200,6 +201,7 @@
1464 testbench.testParsing(input, inputChannel,
1465 tasks, childStdOutLines, childStdErrLines,
1466 outputLines);
1467+#endif
1468 }
1469
1470 #endif
1471
1472=== modified file 'src/cmakeprojectmanager/cmakeproject.cpp'
1473--- src/cmakeprojectmanager/cmakeproject.cpp 2014-02-18 14:30:29 +0000
1474+++ src/cmakeprojectmanager/cmakeproject.cpp 2014-02-28 08:31:43 +0000
1475@@ -33,8 +33,12 @@
1476 #include "cmakeprojectconstants.h"
1477 #include "cmakeprojectnodes.h"
1478 #include "cmakerunconfiguration.h"
1479+#include "cmakekitinformation.h"
1480+#include "cmakeappwizard.h"
1481 #include "makestep.h"
1482-#include "cmakeopenprojectwizard.h"
1483+#include "cmaketoolmanager.h"
1484+#include "argumentslineedit.h"
1485+#include "generatorinfo.h"
1486
1487 #include <projectexplorer/projectexplorerconstants.h>
1488 #include <projectexplorer/projectexplorer.h>
1489@@ -58,16 +62,20 @@
1490 #include <utils/qtcassert.h>
1491 #include <utils/stringutils.h>
1492 #include <utils/hostosinfo.h>
1493+#include <utils/qtcprocess.h>
1494+#include <utils/pathchooser.h>
1495 #include <coreplugin/icore.h>
1496 #include <coreplugin/infobar.h>
1497 #include <coreplugin/documentmanager.h>
1498 #include <coreplugin/editormanager/editormanager.h>
1499 #include <coreplugin/variablemanager.h>
1500+#include <coreplugin/modemanager.h>
1501
1502 #include <QDebug>
1503 #include <QDir>
1504 #include <QFormLayout>
1505 #include <QFileSystemWatcher>
1506+#include <QLabel>
1507
1508 using namespace CMakeProjectManager;
1509 using namespace CMakeProjectManager::Internal;
1510@@ -123,32 +131,10 @@
1511 if (!bc)
1512 return;
1513
1514- CMakeBuildConfiguration *cmakebc = static_cast<CMakeBuildConfiguration *>(bc);
1515-
1516- // Pop up a dialog asking the user to rerun cmake
1517- QString cbpFile = CMakeManager::findCbpFile(QDir(bc->buildDirectory().toString()));
1518- QFileInfo cbpFileFi(cbpFile);
1519- CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
1520- if (!cbpFileFi.exists()) {
1521- mode = CMakeOpenProjectWizard::NeedToCreate;
1522- } else {
1523- foreach (const QString &file, m_watchedFiles) {
1524- if (QFileInfo(file).lastModified() > cbpFileFi.lastModified()) {
1525- mode = CMakeOpenProjectWizard::NeedToUpdate;
1526- break;
1527- }
1528- }
1529- }
1530-
1531- if (mode != CMakeOpenProjectWizard::Nothing) {
1532- CMakeBuildInfo info(cmakebc);
1533- CMakeOpenProjectWizard copw(m_manager, mode, &info);
1534- if (copw.exec() == QDialog::Accepted)
1535- cmakebc->setUseNinja(copw.useNinja()); // NeedToCreate can change the Ninja setting
1536- }
1537-
1538- // reparse
1539- parseCMakeLists();
1540+ //@TODO handle no cmake case
1541+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(bc->target()->kit());
1542+ cmake->runCMake(bc->target());
1543+ connect(cmake,SIGNAL(cmakeFinished(ProjectExplorer::Target*)),this,SLOT(parseCMakeLists(ProjectExplorer::Target*)),Qt::UniqueConnection);
1544 }
1545
1546 void CMakeProject::activeTargetWasChanged(Target *target)
1547@@ -184,17 +170,27 @@
1548 const QString projectName = QFileInfo(info.absolutePath()).fileName();
1549 ProjectExplorer::ProjectMacroExpander expander(projectFilePath, projectName, k, bcName);
1550 QDir projectDir = QDir(projectDirectory(projectFilePath));
1551+
1552+ if(hasInSourceBuild(projectDir.absolutePath()))
1553+ return projectDir.absolutePath();
1554+
1555 QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
1556 return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
1557 }
1558
1559-bool CMakeProject::parseCMakeLists()
1560+bool CMakeProject::parseCMakeLists(Target *t)
1561 {
1562+ qDebug()<<"Running parseCMakeLists";
1563+
1564 if (!activeTarget() ||
1565- !activeTarget()->activeBuildConfiguration()) {
1566+ !activeTarget()->activeBuildConfiguration()) {
1567 return false;
1568 }
1569
1570+ //parse only if active target
1571+ if(t && t != activeTarget())
1572+ return false;
1573+
1574 CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
1575 foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments())
1576 if (isProjectFile(document->filePath()))
1577@@ -255,13 +251,13 @@
1578
1579 //qDebug()<<"Adding Targets";
1580 m_buildTargets = cbpparser.buildTargets();
1581-// qDebug()<<"Printing targets";
1582-// foreach (CMakeBuildTarget ct, m_buildTargets) {
1583-// qDebug()<<ct.title<<" with executable:"<<ct.executable;
1584-// qDebug()<<"WD:"<<ct.workingDirectory;
1585-// qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
1586-// qDebug()<<"";
1587-// }
1588+ // qDebug()<<"Printing targets";
1589+ // foreach (CMakeBuildTarget ct, m_buildTargets) {
1590+ // qDebug()<<ct.title<<" with executable:"<<ct.executable;
1591+ // qDebug()<<"WD:"<<ct.workingDirectory;
1592+ // qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
1593+ // qDebug()<<"";
1594+ // }
1595
1596 updateApplicationAndDeploymentTargets();
1597
1598@@ -368,11 +364,49 @@
1599 return true;
1600 }
1601
1602+KitMatcher *CMakeProject::createRequiredKitMatcher() const
1603+{
1604+ return new CMakeKitMatcher();
1605+}
1606+
1607+bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const
1608+{
1609+ CMakeKitMatcher matcher;
1610+ if(matcher.matches(k))
1611+ return true;
1612+ if(errorMessage)
1613+ *errorMessage = QLatin1String("Could not find compatible CMake Generators");
1614+ return false;
1615+}
1616+
1617+bool CMakeProject::supportsNoTargetPanel() const
1618+{
1619+ return true;
1620+}
1621+
1622+bool CMakeProject::needsConfiguration() const
1623+{
1624+ return targets().isEmpty();
1625+}
1626+
1627 bool CMakeProject::isProjectFile(const QString &fileName)
1628 {
1629 return m_watchedFiles.contains(fileName);
1630 }
1631
1632+bool CMakeProject::hasInSourceBuild() const
1633+{
1634+ return hasInSourceBuild(projectDirectory());
1635+}
1636+
1637+bool CMakeProject::hasInSourceBuild(const QString &sourcePath)
1638+{
1639+ QFileInfo fi(sourcePath + QLatin1String("/CMakeCache.txt"));
1640+ if (fi.exists())
1641+ return true;
1642+ return false;
1643+}
1644+
1645 QList<CMakeBuildTarget> CMakeProject::buildTargets() const
1646 {
1647 return m_buildTargets;
1648@@ -454,7 +488,7 @@
1649
1650 // add added nodes
1651 foreach (ProjectExplorer::FileNode *fn, added) {
1652-// qDebug()<<"added"<<fn->path();
1653+ // qDebug()<<"added"<<fn->path();
1654 // Get relative path to rootNode
1655 QString parentDir = QFileInfo(fn->path()).absolutePath();
1656 ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
1657@@ -464,7 +498,7 @@
1658 // remove old file nodes and check whether folder nodes can be removed
1659 foreach (ProjectExplorer::FileNode *fn, deleted) {
1660 ProjectExplorer::FolderNode *parent = fn->parentFolderNode();
1661-// qDebug()<<"removed"<<fn->path();
1662+ // qDebug()<<"removed"<<fn->path();
1663 rootNode->removeFileNodes(QList<ProjectExplorer::FileNode *>() << fn, parent);
1664 // Check for empty parent
1665 while (parent->subFolderNodes().isEmpty() && parent->fileNodes().isEmpty()) {
1666@@ -544,61 +578,32 @@
1667 if (!Project::fromMap(map))
1668 return false;
1669
1670+ //make sure there is always a cmake available
1671+ if(!CMakeToolManager::defaultCMakeTool()->isValid()) {
1672+ ChooseCMakeWizard wiz;
1673+ if(wiz.exec() != QDialog::Accepted)
1674+ return false;
1675+
1676+ if(!CMakeToolManager::defaultCMakeTool()->isValid())
1677+ return false;
1678+ }
1679+
1680+ //if there is no user file, just leave a empty project
1681+ //the configure project pane will pup up for the rescue
1682 bool hasUserFile = activeTarget();
1683- if (!hasUserFile) {
1684- CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
1685- if (copw.exec() != QDialog::Accepted)
1686- return false;
1687- Kit *k = copw.kit();
1688- Target *t = new Target(this, k);
1689- CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
1690- bc->setDefaultDisplayName(QLatin1String("all"));
1691- bc->setUseNinja(copw.useNinja());
1692- bc->setBuildDirectory(Utils::FileName::fromString(copw.buildDirectory()));
1693- ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
1694- ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
1695-
1696- // Now create a standard build configuration
1697- buildSteps->insertStep(0, new MakeStep(buildSteps));
1698-
1699- MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
1700- cleanSteps->insertStep(0, cleanMakeStep);
1701- cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
1702- cleanMakeStep->setClean(true);
1703-
1704- t->addBuildConfiguration(bc);
1705-
1706- t->updateDefaultDeployConfigurations();
1707-
1708- addTarget(t);
1709- } else {
1710+ if ( hasUserFile ) {
1711 // We have a user file, but we could still be missing the cbp file
1712 // or simply run createXml with the saved settings
1713- QFileInfo sourceFileInfo(m_fileName);
1714 CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
1715 if (!activeBC)
1716- return false;
1717- QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory().toString()));
1718- QFileInfo cbpFileFi(cbpFile);
1719-
1720- CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
1721- if (!cbpFileFi.exists())
1722- mode = CMakeOpenProjectWizard::NeedToCreate;
1723- else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
1724- mode = CMakeOpenProjectWizard::NeedToUpdate;
1725-
1726- if (mode != CMakeOpenProjectWizard::Nothing) {
1727- CMakeBuildInfo info(activeBC);
1728- CMakeOpenProjectWizard copw(m_manager, mode, &info);
1729- if (copw.exec() != QDialog::Accepted)
1730- return false;
1731- else
1732- activeBC->setUseNinja(copw.useNinja());
1733- }
1734+ return true; //give the user a chance to setup a cmake target
1735+
1736+ //@TODO handle no cmake case
1737+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(activeBC->target()->kit());
1738+ cmake->runCMake(activeBC->target());
1739+ connect(cmake,SIGNAL(cmakeFinished(ProjectExplorer::Target*)),this,SLOT(parseCMakeLists(ProjectExplorer::Target*)),Qt::UniqueConnection);
1740 }
1741
1742- parseCMakeLists();
1743-
1744 m_activeTarget = activeTarget();
1745 if (m_activeTarget)
1746 connect(m_activeTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
1747@@ -832,43 +837,65 @@
1748 return true;
1749 }
1750
1751-CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) : m_buildConfiguration(0)
1752+CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) : m_buildConfiguration(bc)
1753 {
1754 QFormLayout *fl = new QFormLayout(this);
1755 fl->setContentsMargins(20, -1, 0, -1);
1756 fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
1757 setLayout(fl);
1758
1759- QPushButton *runCmakeButton = new QPushButton(tr("Run cmake"));
1760- connect(runCmakeButton, SIGNAL(clicked()),
1761- this, SLOT(runCMake()));
1762- fl->addRow(tr("Reconfigure project:"), runCmakeButton);
1763-
1764- m_pathLineEdit = new QLineEdit(this);
1765- m_pathLineEdit->setReadOnly(true);
1766-
1767- QHBoxLayout *hbox = new QHBoxLayout();
1768- hbox->addWidget(m_pathLineEdit);
1769-
1770- m_changeButton = new QPushButton(this);
1771- m_changeButton->setText(tr("&Change"));
1772- connect(m_changeButton, SIGNAL(clicked()), this, SLOT(openChangeBuildDirectoryDialog()));
1773- hbox->addWidget(m_changeButton);
1774-
1775- fl->addRow(tr("Build directory:"), hbox);
1776-
1777- m_buildConfiguration = bc;
1778- m_pathLineEdit->setText(m_buildConfiguration->rawBuildDirectory().toString());
1779- if (m_buildConfiguration->buildDirectory().toString() == bc->target()->project()->projectDirectory())
1780- m_changeButton->setEnabled(false);
1781- else
1782- m_changeButton->setEnabled(true);
1783+ bool inSource = CMakeProject::hasInSourceBuild(bc->target()->project()->projectDirectory());
1784+ if(inSource) {
1785+ QLabel* inSourceLabel = new QLabel(this);
1786+ inSourceLabel->setWordWrap(true);
1787+ inSourceLabel->setText(tr("Qt Creator has detected an <b>in-source-build in %1</b> "
1788+ "which prevents shadow builds. Qt Creator will not allow you to change the build directory. "
1789+ "If you want a shadow build, clean your source directory and re-open the project.")
1790+ .arg(bc->target()->project()->projectDirectory()));
1791+ fl->addRow(inSourceLabel);
1792+ }
1793+
1794+ if(!inSource) {
1795+ m_pathChooser = new Utils::PathChooser(this);
1796+ m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory().toString());
1797+ fl->addRow(tr("Build directory:"), m_pathChooser);
1798+
1799+ connect(m_pathChooser->lineEdit(),SIGNAL(editingFinished()),this,SLOT(onBuilddirChanged()));
1800+ }
1801+
1802+ m_userArguments = new ArgumentsLineEdit(this);
1803+ fl->addRow(tr("CMake arguments:"),m_userArguments);
1804+ m_userArguments->setText(Utils::QtcProcess::joinArgs(m_buildConfiguration->arguments()));
1805+ m_userArguments->setHistoryCompleter(QLatin1String("CMakeArgumentsLineEdit"));
1806+ connect(m_userArguments,SIGNAL(editingFinished()),this,SLOT(onArgumentsChanged()));
1807+
1808+
1809+ m_generatorBox = new QComboBox(this);
1810+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(bc->target()->kit());
1811+ QList<GeneratorInfo> infos = GeneratorInfo::generatorInfosFor(bc->target()->kit(),
1812+ cmake->hasCodeBlocksNinjaGenerator() ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja,
1813+ CMakeManager::preferNinja(),
1814+ cmake->hasCodeBlocksMsvcGenerator());
1815+
1816+ int idx = -1;
1817+ QByteArray cachedGenerator = bc->generator();
1818+ for(int i = 0; i < infos.size(); i++) {
1819+ const GeneratorInfo &info = infos.at(i);
1820+ m_generatorBox->addItem(info.displayName(), qVariantFromValue(info));
1821+ if(info.generator() == cachedGenerator) idx = i;
1822+ }
1823+
1824+ if(idx >= 0)
1825+ m_generatorBox->setCurrentIndex(idx);
1826+ connect(m_generatorBox,SIGNAL(currentIndexChanged(int)),this,SLOT(onGeneratorSelected()));
1827+ fl->addRow(tr("Generator:"),m_generatorBox);
1828
1829 setDisplayName(tr("CMake"));
1830 }
1831
1832 void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
1833 {
1834+#if 0
1835 CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
1836 CMakeBuildInfo info(m_buildConfiguration);
1837 CMakeOpenProjectWizard copw(project->projectManager(), CMakeOpenProjectWizard::ChangeDirectory,
1838@@ -878,18 +905,32 @@
1839 m_buildConfiguration->setUseNinja(copw.useNinja());
1840 m_pathLineEdit->setText(m_buildConfiguration->rawBuildDirectory().toString());
1841 }
1842+#endif
1843 }
1844
1845-void CMakeBuildSettingsWidget::runCMake()
1846+void CMakeBuildSettingsWidget::onArgumentsChanged()
1847 {
1848- if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
1849+ if(!m_userArguments->isValid())
1850 return;
1851- CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
1852- CMakeBuildInfo info(m_buildConfiguration);
1853- CMakeOpenProjectWizard copw(project->projectManager(),
1854- CMakeOpenProjectWizard::WantToUpdate, &info);
1855- if (copw.exec() == QDialog::Accepted)
1856- project->parseCMakeLists();
1857+
1858+ QStringList args = Utils::QtcProcess::splitArgs(m_userArguments->text());
1859+
1860+ if(m_buildConfiguration->arguments() != args)
1861+ m_buildConfiguration->setArguments(args);
1862+}
1863+
1864+void CMakeBuildSettingsWidget::onBuilddirChanged()
1865+{
1866+ qDebug()<<"Changing builddir to: "<<m_pathChooser->fileName().toString();
1867+ m_buildConfiguration->setBuildDirectory(m_pathChooser->fileName());
1868+}
1869+
1870+void CMakeBuildSettingsWidget::onGeneratorSelected()
1871+{
1872+ int curr = m_generatorBox->currentIndex();
1873+ GeneratorInfo info = m_generatorBox->itemData(curr).value<GeneratorInfo>();
1874+
1875+ m_buildConfiguration->setUseNinja(info.isNinja());
1876 }
1877
1878 /////
1879@@ -1130,8 +1171,8 @@
1880 bool generated = false;
1881 QString onlyFileName = QFileInfo(fileName).fileName();
1882 if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
1883- || (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
1884- || (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
1885+ || (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
1886+ || (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
1887 generated = true;
1888
1889 if (fileName.endsWith(QLatin1String(".qrc")))
1890
1891=== modified file 'src/cmakeprojectmanager/cmakeproject.h'
1892--- src/cmakeprojectmanager/cmakeproject.h 2014-02-18 14:30:29 +0000
1893+++ src/cmakeprojectmanager/cmakeproject.h 2014-02-28 08:31:43 +0000
1894@@ -42,10 +42,12 @@
1895 #include <coreplugin/idocument.h>
1896 #include <coreplugin/editormanager/editormanager.h>
1897 #include <coreplugin/editormanager/ieditor.h>
1898+#include <utils/pathchooser.h>
1899
1900 #include <QXmlStreamReader>
1901 #include <QPushButton>
1902 #include <QLineEdit>
1903+#include <QComboBox>
1904
1905 QT_BEGIN_NAMESPACE
1906 class QFileSystemWatcher;
1907@@ -54,6 +56,9 @@
1908 namespace ProjectExplorer { class Target; }
1909
1910 namespace CMakeProjectManager {
1911+
1912+class ArgumentsLineEdit;
1913+
1914 namespace Internal {
1915
1916 class CMakeFile;
1917@@ -97,8 +102,18 @@
1918 const QString &bcName);
1919
1920 bool isProjectFile(const QString &fileName);
1921-
1922- bool parseCMakeLists();
1923+ bool hasInSourceBuild() const;
1924+
1925+ static bool hasInSourceBuild (const QString &sourcePath);
1926+
1927+ // Project interface
1928+ ProjectExplorer::KitMatcher *createRequiredKitMatcher() const;
1929+ bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const;
1930+ bool supportsNoTargetPanel() const;
1931+ bool needsConfiguration() const;
1932+
1933+public slots:
1934+ bool parseCMakeLists(ProjectExplorer::Target* t = 0);
1935
1936 signals:
1937 /// emitted after parsing
1938@@ -215,10 +230,13 @@
1939
1940 private slots:
1941 void openChangeBuildDirectoryDialog();
1942- void runCMake();
1943+ void onArgumentsChanged();
1944+ void onBuilddirChanged();
1945+ void onGeneratorSelected();
1946 private:
1947- QLineEdit *m_pathLineEdit;
1948- QPushButton *m_changeButton;
1949+ Utils::PathChooser *m_pathChooser;
1950+ ArgumentsLineEdit *m_userArguments;
1951+ QComboBox* m_generatorBox;
1952 CMakeBuildConfiguration *m_buildConfiguration;
1953 };
1954
1955
1956=== modified file 'src/cmakeprojectmanager/cmakeprojectconstants.h'
1957--- src/cmakeprojectmanager/cmakeprojectconstants.h 2014-02-18 14:30:29 +0000
1958+++ src/cmakeprojectmanager/cmakeprojectconstants.h 2014-02-28 08:31:43 +0000
1959@@ -51,6 +51,9 @@
1960 // Menu
1961 const char M_CONTEXT[] = "CMakeEditor.ContextMenu";
1962
1963+// CMake Tool
1964+const char CMAKE_TOOL_ID[] = "CMakeProjectManager.DefaultCMakeTool";
1965+
1966 } // namespace Constants
1967 } // namespace CMakeProjectManager
1968
1969
1970=== modified file 'src/cmakeprojectmanager/cmakeprojectmanager.cpp'
1971--- src/cmakeprojectmanager/cmakeprojectmanager.cpp 2014-02-18 14:30:29 +0000
1972+++ src/cmakeprojectmanager/cmakeprojectmanager.cpp 2014-02-28 08:31:43 +0000
1973@@ -28,9 +28,9 @@
1974 ****************************************************************************/
1975
1976 #include "cmakeprojectmanager.h"
1977-#include "cmakeopenprojectwizard.h"
1978 #include "cmakeprojectconstants.h"
1979 #include "cmakeproject.h"
1980+#include "cmaketoolmanager.h"
1981
1982 #include <utils/synchronousprocess.h>
1983 #include <utils/qtcprocess.h>
1984@@ -43,7 +43,7 @@
1985 #include <projectexplorer/projectexplorerconstants.h>
1986 #include <projectexplorer/projectexplorer.h>
1987 #include <projectexplorer/target.h>
1988-#include <utils/QtConcurrentTools>
1989+//#include <utils/QtConcurrentTools>
1990 #include <QtConcurrentRun>
1991 #include <QCoreApplication>
1992 #include <QSettings>
1993@@ -58,9 +58,12 @@
1994
1995 using namespace CMakeProjectManager::Internal;
1996
1997+CMakeManager* CMakeManager::m_instance = 0;
1998+
1999 CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage)
2000 : m_settingsPage(cmakeSettingsPage)
2001 {
2002+ m_instance = this;
2003 ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
2004 connect(projectExplorer, SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)),
2005 this, SLOT(updateContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)));
2006@@ -118,14 +121,9 @@
2007 if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
2008 return;
2009
2010- CMakeBuildConfiguration *bc
2011- = static_cast<CMakeBuildConfiguration *>(cmakeProject->activeTarget()->activeBuildConfiguration());
2012-
2013- CMakeBuildInfo info(bc);
2014-
2015- CMakeOpenProjectWizard copw(this, CMakeOpenProjectWizard::WantToUpdate, &info);
2016- if (copw.exec() == QDialog::Accepted)
2017- cmakeProject->parseCMakeLists();
2018+ ICMakeTool* cmake = CMakeToolManager::cmakeToolForKit(cmakeProject->activeTarget()->kit());
2019+ cmake->runCMake(cmakeProject->activeTarget());
2020+ connect(cmake,SIGNAL(cmakeFinished(ProjectExplorer::Target*)),cmakeProject,SLOT(parseCMakeLists(ProjectExplorer::Target*)),Qt::UniqueConnection);
2021 }
2022
2023 ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
2024@@ -145,63 +143,9 @@
2025 return QLatin1String(Constants::CMAKEMIMETYPE);
2026 }
2027
2028-QString CMakeManager::cmakeExecutable() const
2029-{
2030- return m_settingsPage->cmakeExecutable();
2031-}
2032-
2033-bool CMakeManager::isCMakeExecutableValid() const
2034-{
2035- return m_settingsPage->isCMakeExecutableValid();
2036-}
2037-
2038-void CMakeManager::setCMakeExecutable(const QString &executable)
2039-{
2040- m_settingsPage->setCMakeExecutable(executable);
2041-}
2042-
2043-bool CMakeManager::hasCodeBlocksMsvcGenerator() const
2044-{
2045- return m_settingsPage->hasCodeBlocksMsvcGenerator();
2046-}
2047-
2048-bool CMakeManager::hasCodeBlocksNinjaGenerator() const
2049-{
2050- return m_settingsPage->hasCodeBlocksNinjaGenerator();
2051-}
2052-
2053-bool CMakeManager::preferNinja() const
2054-{
2055- return m_settingsPage->preferNinja();
2056-}
2057-
2058-// need to refactor this out
2059-// we probably want the process instead of this function
2060-// cmakeproject then could even run the cmake process in the background, adding the files afterwards
2061-// sounds like a plan
2062-void CMakeManager::createXmlFile(Utils::QtcProcess *proc, const QString &arguments,
2063- const QString &sourceDirectory, const QDir &buildDirectory,
2064- const Utils::Environment &env, const QString &generator)
2065-{
2066- // We create a cbp file, only if we didn't find a cbp file in the base directory
2067- // Yet that can still override cbp files in subdirectories
2068- // And we are creating tons of files in the source directories
2069- // All of that is not really nice.
2070- // The mid term plan is to move away from the CodeBlocks Generator and use our own
2071- // QtCreator generator, which actually can be very similar to the CodeBlock Generator
2072- QString buildDirectoryPath = buildDirectory.absolutePath();
2073- buildDirectory.mkpath(buildDirectoryPath);
2074- proc->setWorkingDirectory(buildDirectoryPath);
2075- proc->setEnvironment(env);
2076-
2077- const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ?
2078- QString(QLatin1Char('.')) : sourceDirectory;
2079- QString args;
2080- Utils::QtcProcess::addArg(&args, srcdir);
2081- Utils::QtcProcess::addArgs(&args, arguments);
2082- Utils::QtcProcess::addArg(&args, generator);
2083- proc->setCommand(cmakeExecutable(), args);
2084- proc->start();
2085+bool CMakeManager::preferNinja()
2086+{
2087+ return m_instance->m_settingsPage->preferNinja();
2088 }
2089
2090 QString CMakeManager::findCbpFile(const QDir &directory)
2091@@ -263,27 +207,15 @@
2092 setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
2093 ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_TR_CATEGORY));
2094 setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
2095-
2096- QSettings *settings = Core::ICore::settings();
2097- settings->beginGroup(QLatin1String("CMakeSettings"));
2098- m_cmakeValidatorForUser.setCMakeExecutable(settings->value(QLatin1String("cmakeExecutable")).toString());
2099- settings->endGroup();
2100-
2101- m_cmakeValidatorForSystem.setCMakeExecutable(findCmakeExecutable());
2102 }
2103
2104 bool CMakeSettingsPage::isCMakeExecutableValid() const
2105 {
2106- if (m_cmakeValidatorForUser.isValid())
2107- return true;
2108-
2109- return m_cmakeValidatorForSystem.isValid();
2110+ return CMakeToolManager::defaultCMakeTool()->isValid();
2111 }
2112
2113 CMakeSettingsPage::~CMakeSettingsPage()
2114 {
2115- m_cmakeValidatorForUser.cancel();
2116- m_cmakeValidatorForSystem.cancel();
2117 }
2118
2119 QString CMakeSettingsPage::findCmakeExecutable() const
2120@@ -300,7 +232,7 @@
2121 m_pathchooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
2122 formLayout->addRow(tr("Executable:"), m_pathchooser);
2123 formLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
2124- m_pathchooser->setPath(m_cmakeValidatorForUser.cmakeExecutable());
2125+ m_pathchooser->setPath(CMakeToolManager::userCMakePath());
2126
2127 m_preferNinja = new QCheckBox(tr("Prefer Ninja generator (CMake 2.8.9 or higher required)"));
2128 m_preferNinja->setChecked(preferNinja());
2129@@ -313,7 +245,7 @@
2130 {
2131 QSettings *settings = Core::ICore::settings();
2132 settings->beginGroup(QLatin1String("CMakeSettings"));
2133- settings->setValue(QLatin1String("cmakeExecutable"), m_cmakeValidatorForUser.cmakeExecutable());
2134+ settings->setValue(QLatin1String("cmakeExecutable"), CMakeToolManager::userCMakePath());
2135 settings->setValue(QLatin1String("preferNinja"), m_preferNinja->isChecked());
2136 settings->endGroup();
2137 }
2138@@ -322,8 +254,8 @@
2139 {
2140 if (!m_pathchooser) // page was never shown
2141 return;
2142- if (m_cmakeValidatorForUser.cmakeExecutable() != m_pathchooser->path())
2143- m_cmakeValidatorForUser.setCMakeExecutable(m_pathchooser->path());
2144+ if (CMakeToolManager::userCMakePath() != m_pathchooser->path())
2145+ CMakeToolManager::setUserCmakePath(m_pathchooser->path());
2146 saveSettings();
2147 }
2148
2149@@ -332,41 +264,14 @@
2150
2151 }
2152
2153-QString CMakeSettingsPage::cmakeExecutable() const
2154-{
2155- if (!isCMakeExecutableValid())
2156- return QString();
2157-
2158- if (m_cmakeValidatorForUser.isValid())
2159- return m_cmakeValidatorForUser.cmakeExecutable();
2160- if (m_cmakeValidatorForSystem.isValid())
2161- return m_cmakeValidatorForSystem.cmakeExecutable();
2162- return QString();
2163-}
2164-
2165-void CMakeSettingsPage::setCMakeExecutable(const QString &executable)
2166-{
2167- if (m_cmakeValidatorForUser.cmakeExecutable() == executable)
2168- return;
2169- m_cmakeValidatorForUser.setCMakeExecutable(executable);
2170-}
2171-
2172 bool CMakeSettingsPage::hasCodeBlocksMsvcGenerator() const
2173 {
2174- if (m_cmakeValidatorForUser.isValid())
2175- return m_cmakeValidatorForUser.hasCodeBlocksMsvcGenerator();
2176- if (m_cmakeValidatorForSystem.isValid())
2177- return m_cmakeValidatorForSystem.hasCodeBlocksMsvcGenerator();
2178- return false;
2179+ return CMakeToolManager::defaultCMakeTool()->hasCodeBlocksMsvcGenerator();
2180 }
2181
2182 bool CMakeSettingsPage::hasCodeBlocksNinjaGenerator() const
2183 {
2184- if (m_cmakeValidatorForUser.isValid())
2185- return m_cmakeValidatorForUser.hasCodeBlocksNinjaGenerator();
2186- if (m_cmakeValidatorForSystem.isValid())
2187- return m_cmakeValidatorForSystem.hasCodeBlocksNinjaGenerator();
2188- return false;
2189+ return CMakeToolManager::defaultCMakeTool()->hasCodeBlocksNinjaGenerator();
2190 }
2191
2192 bool CMakeSettingsPage::preferNinja() const
2193@@ -380,11 +285,9 @@
2194
2195 TextEditor::Keywords CMakeSettingsPage::keywords()
2196 {
2197- if (m_cmakeValidatorForUser.isValid())
2198- return m_cmakeValidatorForUser.keywords();
2199-
2200- if (m_cmakeValidatorForSystem.isValid())
2201- return m_cmakeValidatorForSystem.keywords();
2202+ ICMakeTool* defTool = CMakeToolManager::defaultCMakeTool();
2203+ if(defTool->isValid())
2204+ return defTool->keywords();
2205
2206 return TextEditor::Keywords(QStringList(), QStringList(), QMap<QString, QStringList>());
2207 }
2208
2209=== modified file 'src/cmakeprojectmanager/cmakeprojectmanager.h'
2210--- src/cmakeprojectmanager/cmakeprojectmanager.h 2014-02-18 14:30:29 +0000
2211+++ src/cmakeprojectmanager/cmakeprojectmanager.h 2014-02-28 08:31:43 +0000
2212@@ -69,22 +69,8 @@
2213 virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);
2214 virtual QString mimeType() const;
2215
2216- QString cmakeExecutable() const;
2217- bool isCMakeExecutableValid() const;
2218-
2219- void setCMakeExecutable(const QString &executable);
2220-
2221- void createXmlFile(Utils::QtcProcess *process,
2222- const QString &arguments,
2223- const QString &sourceDirectory,
2224- const QDir &buildDirectory,
2225- const Utils::Environment &env,
2226- const QString &generator);
2227- bool hasCodeBlocksMsvcGenerator() const;
2228- bool hasCodeBlocksNinjaGenerator() const;
2229- bool preferNinja() const;
2230+ static bool preferNinja();
2231 static QString findCbpFile(const QDir &);
2232-
2233 static QString findDumperLibrary(const Utils::Environment &env);
2234 private slots:
2235 void updateContextMenu(ProjectExplorer::Project *project, ProjectExplorer::Node *node);
2236@@ -98,6 +84,8 @@
2237 QAction *m_runCMakeAction;
2238 QAction *m_runCMakeActionContextMenu;
2239 ProjectExplorer::Project *m_contextProject;
2240+
2241+ static CMakeManager* m_instance;
2242 };
2243
2244 class CMakeSettingsPage : public Core::IOptionsPage
2245@@ -112,8 +100,6 @@
2246 void apply();
2247 void finish();
2248
2249- QString cmakeExecutable() const;
2250- void setCMakeExecutable(const QString &executable);
2251 bool isCMakeExecutableValid() const;
2252 bool hasCodeBlocksMsvcGenerator() const;
2253 bool hasCodeBlocksNinjaGenerator() const;
2254@@ -127,8 +113,6 @@
2255
2256 Utils::PathChooser *m_pathchooser;
2257 QCheckBox *m_preferNinja;
2258- CMakeValidator m_cmakeValidatorForUser;
2259- CMakeValidator m_cmakeValidatorForSystem;
2260 };
2261
2262 } // namespace Internal
2263
2264=== modified file 'src/cmakeprojectmanager/cmakeprojectmanager.pro'
2265--- src/cmakeprojectmanager/cmakeprojectmanager.pro 2014-02-18 14:30:29 +0000
2266+++ src/cmakeprojectmanager/cmakeprojectmanager.pro 2014-02-28 08:31:43 +0000
2267@@ -4,11 +4,11 @@
2268 cmakeproject.h \
2269 cmakeprojectplugin.h \
2270 cmakeprojectmanager.h \
2271+ cmakeprojectmanager_global.h \
2272 cmakeprojectconstants.h \
2273 cmakeprojectnodes.h \
2274 makestep.h \
2275 cmakerunconfiguration.h \
2276- cmakeopenprojectwizard.h \
2277 cmakebuildconfiguration.h \
2278 cmakeeditorfactory.h \
2279 cmakeeditor.h \
2280@@ -16,8 +16,13 @@
2281 cmakehighlighterfactory.h \
2282 cmakelocatorfilter.h \
2283 cmakefilecompletionassist.h \
2284- cmakevalidator.h \
2285- cmakeparser.h
2286+ cmakeparser.h \
2287+ generatorinfo.h \
2288+ cmakeappwizard.h \
2289+ cmakekitinformation.h \
2290+ cmaketool.h \
2291+ argumentslineedit.h \
2292+ cmaketoolmanager.h
2293
2294 SOURCES = cmakeproject.cpp \
2295 cmakeprojectplugin.cpp \
2296@@ -25,7 +30,6 @@
2297 cmakeprojectnodes.cpp \
2298 makestep.cpp \
2299 cmakerunconfiguration.cpp \
2300- cmakeopenprojectwizard.cpp \
2301 cmakebuildconfiguration.cpp \
2302 cmakeeditorfactory.cpp \
2303 cmakeeditor.cpp \
2304@@ -33,8 +37,14 @@
2305 cmakehighlighterfactory.cpp \
2306 cmakelocatorfilter.cpp \
2307 cmakefilecompletionassist.cpp \
2308- cmakevalidator.cpp \
2309- cmakeparser.cpp
2310+ cmakeparser.cpp \
2311+ generatorinfo.cpp \
2312+ cmakeappwizard.cpp \
2313+ cmakekitinformation.cpp \
2314+ cmaketool.cpp \
2315+ argumentslineedit.cpp \
2316+ cmaketoolmanager.cpp
2317
2318
2319 RESOURCES += cmakeproject.qrc
2320+DEFINES += CMAKEPROJECTMANAGER_LIBRARY
2321
2322=== added file 'src/cmakeprojectmanager/cmakeprojectmanager_global.h'
2323--- src/cmakeprojectmanager/cmakeprojectmanager_global.h 1970-01-01 00:00:00 +0000
2324+++ src/cmakeprojectmanager/cmakeprojectmanager_global.h 2014-02-28 08:31:43 +0000
2325@@ -0,0 +1,41 @@
2326+/****************************************************************************
2327+**
2328+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2329+** Contact: http://www.qt-project.org/legal
2330+**
2331+** This file is part of Qt Creator.
2332+**
2333+** Commercial License Usage
2334+** Licensees holding valid commercial Qt licenses may use this file in
2335+** accordance with the commercial license agreement provided with the
2336+** Software or, alternatively, in accordance with the terms contained in
2337+** a written agreement between you and Digia. For licensing terms and
2338+** conditions see http://qt.digia.com/licensing. For further information
2339+** use the contact form at http://qt.digia.com/contact-us.
2340+**
2341+** GNU Lesser General Public License Usage
2342+** Alternatively, this file may be used under the terms of the GNU Lesser
2343+** General Public License version 2.1 as published by the Free Software
2344+** Foundation and appearing in the file LICENSE.LGPL included in the
2345+** packaging of this file. Please review the following information to
2346+** ensure the GNU Lesser General Public License version 2.1 requirements
2347+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
2348+**
2349+** In addition, as a special exception, Digia gives you certain additional
2350+** rights. These rights are described in the Digia Qt LGPL Exception
2351+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
2352+**
2353+****************************************************************************/
2354+
2355+#ifndef CMAKEPROJECTMANAGER_GLOBAL_H
2356+#define CMAKEPROJECTMANAGER_GLOBAL_H
2357+
2358+#include <qglobal.h>
2359+
2360+#if defined(CMAKEPROJECTMANAGER_LIBRARY)
2361+# define CMAKEPROJECTMANAGER_EXPORT Q_DECL_EXPORT
2362+#else
2363+# define CMAKEPROJECTMANAGER_EXPORT Q_DECL_IMPORT
2364+#endif
2365+
2366+#endif // QMAKEPROJECTMANAGER_GLOBAL_H
2367
2368=== modified file 'src/cmakeprojectmanager/cmakeprojectplugin.cpp'
2369--- src/cmakeprojectmanager/cmakeprojectplugin.cpp 2014-02-18 14:30:29 +0000
2370+++ src/cmakeprojectmanager/cmakeprojectplugin.cpp 2014-02-28 08:31:43 +0000
2371@@ -37,10 +37,14 @@
2372 #include "cmakelocatorfilter.h"
2373 #include "cmakefilecompletionassist.h"
2374 #include "cmakehighlighterfactory.h"
2375+#include "cmakeappwizard.h"
2376+#include "cmaketoolmanager.h"
2377+#include "cmakekitinformation.h"
2378
2379 #include <coreplugin/featureprovider.h>
2380 #include <coreplugin/mimedatabase.h>
2381 #include <texteditor/texteditoractionhandler.h>
2382+#include <projectexplorer/kitmanager.h>
2383
2384 #include <QtPlugin>
2385 #include <QDebug>
2386@@ -70,6 +74,8 @@
2387 {
2388 if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"), errorMessage))
2389 return false;
2390+
2391+ addAutoReleasedObject(new CMakeToolManager);
2392 CMakeSettingsPage *cmp = new CMakeSettingsPage();
2393 addAutoReleasedObject(cmp);
2394 CMakeManager *manager = new CMakeManager(cmp);
2395@@ -83,6 +89,10 @@
2396 addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp));
2397 addAutoReleasedObject(new CMakeFeatureProvider);
2398 addAutoReleasedObject(new CMakeHighlighterFactory);
2399+
2400+ CMakeAppWizard::registerSelf();
2401+ ProjectExplorer::KitManager::registerKitInformation(new CMakeKitInformation());
2402+
2403 return true;
2404 }
2405
2406
2407=== added file 'src/cmakeprojectmanager/cmaketool.cpp'
2408--- src/cmakeprojectmanager/cmaketool.cpp 1970-01-01 00:00:00 +0000
2409+++ src/cmakeprojectmanager/cmaketool.cpp 2014-02-28 08:31:43 +0000
2410@@ -0,0 +1,441 @@
2411+#include "cmaketool.h"
2412+#include "cmakeprojectmanager.h"
2413+#include "cmakeprojectconstants.h"
2414+#include "cmakebuildconfiguration.h"
2415+#include "generatorinfo.h"
2416+
2417+#include <QProcess>
2418+#include <QFileInfo>
2419+#include <QDir>
2420+#include <extensionsystem/pluginmanager.h>
2421+#include <projectexplorer/target.h>
2422+#include <projectexplorer/kit.h>
2423+#include <utils/qtcprocess.h>
2424+#include <coreplugin/messagemanager.h>
2425+#include <coreplugin/progressmanager/futureprogress.h>
2426+#include <coreplugin/progressmanager/progressmanager.h>
2427+
2428+using namespace CMakeProjectManager;
2429+using namespace Internal;
2430+
2431+/*!
2432+ * \class ICMakeTool
2433+ * Generic interface for starting cmake to create the buildfiles
2434+ * Can be linked to a specific Kit
2435+ */
2436+ICMakeTool::ICMakeTool(QObject *parent)
2437+ : QObject(parent)
2438+{
2439+
2440+}
2441+
2442+ICMakeTool::~ICMakeTool()
2443+{
2444+
2445+}
2446+
2447+void ICMakeTool::addToEnvironment(Utils::Environment &env) const
2448+{
2449+
2450+}
2451+
2452+CMakeTool::CMakeTool(QObject *parent)
2453+ : ICMakeTool(parent)
2454+ , m_state(CMakeTool::RunningBasic)
2455+ , m_process(0)
2456+ , m_hasCodeBlocksMsvcGenerator(false)
2457+ , m_hasCodeBlocksNinjaGenerator(false)
2458+ , m_futureInterface(0)
2459+{
2460+ setId(Constants::CMAKE_TOOL_ID);
2461+}
2462+
2463+CMakeTool::~CMakeTool()
2464+{
2465+ cancel();
2466+}
2467+
2468+void CMakeTool::cancel()
2469+{
2470+ if (m_process) {
2471+ if(m_futureInterface){
2472+ m_futureInterface->reportCanceled();
2473+ m_futureInterface->reportFinished();
2474+ }
2475+
2476+ disconnect(m_process, SIGNAL(finished(int)));
2477+ m_process->waitForFinished();
2478+ delete m_process;
2479+ m_process = 0;
2480+
2481+ if(m_state != CMakeTool::RunningDone && m_state != CMakeTool::RunningProject)
2482+ m_state = CMakeTool::Invalid;
2483+ }
2484+
2485+ m_pendingRuns.clear();
2486+}
2487+
2488+void CMakeTool::setCMakeExecutable(const QString &executable)
2489+{
2490+ cancel();
2491+ createProcessIfNotExists();
2492+
2493+ m_executable = executable;
2494+ QFileInfo fi(m_executable);
2495+ if (fi.exists() && fi.isExecutable()) {
2496+ // Run it to find out more
2497+ m_state = CMakeTool::RunningBasic;
2498+ if (!startProcess(QStringList(QLatin1String("--help"))))
2499+ m_state = CMakeTool::Invalid;
2500+ } else {
2501+ m_state = CMakeTool::Invalid;
2502+ }
2503+}
2504+
2505+void CMakeTool::finished(int exitCode)
2506+{
2507+ if (exitCode && m_state != CMakeTool::RunningProject) {
2508+ flushOutput();
2509+ m_state = CMakeTool::Invalid;
2510+ return;
2511+ }
2512+ if (m_state == CMakeTool::RunningBasic) {
2513+ QByteArray response = m_process->readAll();
2514+
2515+ m_hasCodeBlocksMsvcGenerator = response.contains("CodeBlocks - NMake Makefiles");
2516+ m_hasCodeBlocksNinjaGenerator = response.contains("CodeBlocks - Ninja");
2517+
2518+ if (response.isEmpty()) {
2519+ m_state = CMakeTool::Invalid;
2520+ } else {
2521+ m_state = CMakeTool::RunningFunctionList;
2522+ if (!startProcess(QStringList(QLatin1String("--help-command-list"))))
2523+ finished(0); // should never happen, just continue
2524+ }
2525+ } else if (m_state == CMakeTool::RunningFunctionList) {
2526+ parseFunctionOutput(m_process->readAll());
2527+ m_state = CMakeTool::RunningFunctionDetails;
2528+ if (!startProcess(QStringList(QLatin1String("--help-commands"))))
2529+ finished(0); // should never happen, just continue
2530+ } else if (m_state == CMakeTool::RunningFunctionDetails) {
2531+ parseFunctionDetailsOutput(m_process->readAll());
2532+ m_state = CMakeTool::RunningPropertyList;
2533+ if (!startProcess(QStringList(QLatin1String("--help-property-list"))))
2534+ finished(0); // should never happen, just continue
2535+ } else if (m_state == CMakeTool::RunningPropertyList) {
2536+ parseVariableOutput(m_process->readAll());
2537+ m_state = CMakeTool::RunningVariableList;
2538+ if (!startProcess(QStringList(QLatin1String("--help-variable-list"))))
2539+ finished(0); // should never happen, just continue
2540+ } else if (m_state == CMakeTool::RunningVariableList) {
2541+ parseVariableOutput(m_process->readAll());
2542+ parseDone();
2543+ m_state = CMakeTool::RunningDone;
2544+ }else if (m_state == CMakeTool::RunningProject) {
2545+ //cmake run is finished no matter if we were successful or not
2546+ m_currentRun.clear();
2547+ m_state = CMakeTool::RunningDone;
2548+
2549+ if(m_futureInterface) {
2550+ if(exitCode) m_futureInterface->reportCanceled();
2551+ m_futureInterface->reportFinished();
2552+ }
2553+
2554+ flushOutput();
2555+ emit cmakeFinished(m_currentRun.data());
2556+ }
2557+
2558+ if(m_state == CMakeTool::RunningDone )
2559+ startNextRun();
2560+}
2561+
2562+void CMakeTool::onProcessReadyRead()
2563+{
2564+ //we only care about cmake project building output
2565+ if(m_state != CMakeTool::RunningProject)
2566+ return;
2567+
2568+ QString stderr = QString::fromLocal8Bit(m_process->readAllStandardError());
2569+ QString stdout = QString::fromLocal8Bit(m_process->readAllStandardOutput());
2570+ if (!stderr.isEmpty()) {
2571+ Core::MessageManager::write(QString(QLatin1String("%0")).arg(stderr),Core::MessageManager::ModeSwitch);
2572+ }
2573+ if (!stdout.isEmpty()) {
2574+ Core::MessageManager::write(QString(QLatin1String("%0")).arg(stdout),Core::MessageManager::NoModeSwitch);
2575+ }
2576+}
2577+
2578+void CMakeTool::flushOutput()
2579+{
2580+ QString errorMsg = QString::fromLocal8Bit(m_process->readAllStandardError());
2581+ if (errorMsg.trimmed().length()>0) Core::MessageManager::write(errorMsg,Core::MessageManager::ModeSwitch);
2582+ QString msg = QString::fromLocal8Bit(m_process->readAllStandardOutput());
2583+ if (msg.trimmed().length()>0) Core::MessageManager::write(msg,Core::MessageManager::NoModeSwitch);
2584+}
2585+
2586+void CMakeTool::createProcessIfNotExists()
2587+{
2588+ if(!m_process) {
2589+ m_process = new Utils::QtcProcess();
2590+ connect(m_process, SIGNAL(finished(int)),
2591+ this, SLOT(finished(int)));
2592+ connect(m_process,SIGNAL(readyRead()),
2593+ this,SLOT(onProcessReadyRead()));
2594+ }
2595+}
2596+
2597+bool CMakeTool::isValid() const
2598+{
2599+ if (m_state == CMakeTool::Invalid)
2600+ return false;
2601+ if (m_state == CMakeTool::RunningBasic)
2602+ m_process->waitForFinished();
2603+ return (m_state != CMakeTool::Invalid);
2604+}
2605+
2606+bool CMakeTool::startProcess(const QStringList &args, Utils::Environment env)
2607+{
2608+ QString argsStr = Utils::QtcProcess::joinArgs(args);
2609+
2610+ //add custom cmake environment vars
2611+ addToEnvironment(env);
2612+
2613+ qDebug()<<"Starting process: "
2614+ <<m_executable
2615+ <<argsStr;
2616+
2617+ m_process->setEnvironment(env);
2618+ m_process->setCommand(m_executable, argsStr);
2619+ m_process->start();
2620+ return m_process->waitForStarted(2000);
2621+}
2622+
2623+QString CMakeTool::cmakeExecutable() const
2624+{
2625+ return m_executable;
2626+}
2627+
2628+bool CMakeTool::hasCodeBlocksMsvcGenerator() const
2629+{
2630+ if (!isValid())
2631+ return false;
2632+ return m_hasCodeBlocksMsvcGenerator;
2633+}
2634+
2635+bool CMakeTool::hasCodeBlocksNinjaGenerator() const
2636+{
2637+ if (!isValid())
2638+ return false;
2639+ return m_hasCodeBlocksNinjaGenerator;
2640+}
2641+
2642+TextEditor::Keywords CMakeTool::keywords()
2643+{
2644+ while (m_state != RunningDone && m_state != CMakeTool::Invalid) {
2645+ m_process->waitForFinished();
2646+ }
2647+
2648+ if (m_state == CMakeTool::Invalid)
2649+ return TextEditor::Keywords(QStringList(), QStringList(), QMap<QString, QStringList>());
2650+
2651+ return TextEditor::Keywords(m_variables, m_functions, m_functionArgs);
2652+}
2653+
2654+void CMakeTool::runCMake( ProjectExplorer::Target* target )
2655+{
2656+ if(!isValid())
2657+ return;
2658+
2659+ QPointer<ProjectExplorer::Target> ptrTarget(target);
2660+
2661+ if(!m_pendingRuns.contains(ptrTarget))
2662+ m_pendingRuns.append(ptrTarget);
2663+
2664+ if(m_state != CMakeTool::RunningDone)
2665+ return;
2666+
2667+ return startNextRun();
2668+}
2669+
2670+QString CMakeTool::displayName()
2671+{
2672+ return QString::fromLatin1("Default");
2673+}
2674+
2675+void CMakeTool::startNextRun()
2676+{
2677+ QPointer<ProjectExplorer::Target> ptrMyTarget;
2678+ while(!m_pendingRuns.isEmpty() && ptrMyTarget.isNull())
2679+ ptrMyTarget = m_pendingRuns.dequeue();
2680+
2681+ if(!ptrMyTarget)
2682+ return;
2683+
2684+ // We create a cbp file, only if we didn't find a cbp file in the base directory
2685+ // Yet that can still override cbp files in subdirectories
2686+ // And we are creating tons of files in the source directories
2687+ // All of that is not really nice.
2688+ // The mid term plan is to move away from the CodeBlocks Generator and use our own
2689+ // QtCreator generator, which actually can be very similar to the CodeBlock Generator
2690+ CMakeBuildConfiguration* config = qobject_cast<CMakeBuildConfiguration*>(ptrMyTarget->activeBuildConfiguration());
2691+ if(!config)
2692+ return;
2693+
2694+ Utils::Environment env = config->environment();
2695+ QDir buildDirectory(config->buildDirectory().toString());
2696+
2697+ QString buildDirectoryPath = buildDirectory.absolutePath();
2698+ buildDirectory.mkpath(buildDirectoryPath);
2699+
2700+ //user chose the kit on project creation
2701+ ptrMyTarget->kit()->addToEnvironment(env);
2702+
2703+ createProcessIfNotExists();
2704+ m_state = CMakeTool::RunningProject;
2705+
2706+ GeneratorInfo gInfo(ptrMyTarget->kit(),config->useNinja());
2707+
2708+ QStringList args;
2709+ args << ptrMyTarget->project()->projectDirectory()
2710+ << config->arguments()
2711+ << QLatin1String(gInfo.generatorArgument());
2712+
2713+ m_process->setWorkingDirectory(buildDirectoryPath);
2714+
2715+ if(m_futureInterface)
2716+ delete m_futureInterface;
2717+
2718+ m_futureInterface = new QFutureInterface<void>();
2719+ m_futureInterface->setProgressRange(0,1);
2720+
2721+ Core::FutureProgress* futureProgress = Core::ProgressManager::addTask(m_futureInterface->future()
2722+ ,tr("Parsing ProjectFile")
2723+ ,Core::Id("CMakeProjectManager.CMakeTaskID"));
2724+ connect(futureProgress,SIGNAL(canceled()),this,SLOT(cancel()));
2725+
2726+ m_futureInterface->reportStarted();
2727+ startProcess(args,env);
2728+}
2729+
2730+static void extractKeywords(const QByteArray &input, QStringList *destination)
2731+{
2732+ if (!destination)
2733+ return;
2734+
2735+ QString keyword;
2736+ int ignoreZone = 0;
2737+ for (int i = 0; i < input.count(); ++i) {
2738+ const QChar chr = QLatin1Char(input.at(i));
2739+ if (chr == QLatin1Char('{'))
2740+ ++ignoreZone;
2741+ if (chr == QLatin1Char('}'))
2742+ --ignoreZone;
2743+ if (ignoreZone == 0) {
2744+ if ((chr.isLetterOrNumber() && chr.isUpper())
2745+ || chr == QLatin1Char('_')) {
2746+ keyword += chr;
2747+ } else {
2748+ if (!keyword.isEmpty()) {
2749+ if (keyword.size() > 1)
2750+ *destination << keyword;
2751+ keyword.clear();
2752+ }
2753+ }
2754+ }
2755+ }
2756+ if (keyword.size() > 1)
2757+ *destination << keyword;
2758+}
2759+
2760+void CMakeTool::parseFunctionOutput(const QByteArray &output)
2761+{
2762+ QList<QByteArray> cmakeFunctionsList = output.split('\n');
2763+ m_functions.clear();
2764+ if (!cmakeFunctionsList.isEmpty()) {
2765+ cmakeFunctionsList.removeFirst(); //remove version string
2766+ foreach (const QByteArray &function, cmakeFunctionsList)
2767+ m_functions << QString::fromLocal8Bit(function.trimmed());
2768+ }
2769+}
2770+
2771+QString CMakeTool::formatFunctionDetails(const QString &command, const QString &args)
2772+{
2773+ return QString::fromLatin1("<table><tr><td><b>%1</b></td><td>%2</td></tr>")
2774+ .arg(Qt::escape(command)).arg(Qt::escape(args));
2775+}
2776+
2777+void CMakeTool::parseFunctionDetailsOutput(const QByteArray &output)
2778+{
2779+ QStringList cmakeFunctionsList = m_functions;
2780+ QList<QByteArray> cmakeCommandsHelp = output.split('\n');
2781+ for (int i = 0; i < cmakeCommandsHelp.count(); ++i) {
2782+ QByteArray lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
2783+ if (cmakeFunctionsList.isEmpty())
2784+ break;
2785+ if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
2786+ QStringList commandSyntaxes;
2787+ QString currentCommandSyntax;
2788+ QString currentCommand = cmakeFunctionsList.takeFirst();
2789+ ++i;
2790+ for (; i < cmakeCommandsHelp.count(); ++i) {
2791+ lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
2792+
2793+ if (!cmakeFunctionsList.isEmpty() && cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
2794+ //start of next function in output
2795+ if (!currentCommandSyntax.isEmpty())
2796+ commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
2797+ --i;
2798+ break;
2799+ }
2800+ if (lineTrimmed.startsWith(currentCommand.toLatin1() + "(")) {
2801+ if (!currentCommandSyntax.isEmpty())
2802+ commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
2803+
2804+ QByteArray argLine = lineTrimmed.mid(currentCommand.length());
2805+ extractKeywords(argLine, &m_variables);
2806+ currentCommandSyntax = formatFunctionDetails(currentCommand, QString::fromUtf8(argLine));
2807+ } else {
2808+ if (!currentCommandSyntax.isEmpty()) {
2809+ if (lineTrimmed.isEmpty()) {
2810+ commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
2811+ currentCommandSyntax.clear();
2812+ } else {
2813+ extractKeywords(lineTrimmed, &m_variables);
2814+ currentCommandSyntax += QString::fromLatin1("<tr><td>&nbsp;</td><td>%1</td></tr>")
2815+ .arg(Qt::escape(QString::fromLocal8Bit(lineTrimmed)));
2816+ }
2817+ }
2818+ }
2819+ }
2820+ m_functionArgs[currentCommand] = commandSyntaxes;
2821+ }
2822+ }
2823+ m_functions = m_functionArgs.keys();
2824+}
2825+
2826+void CMakeTool::parseVariableOutput(const QByteArray &output)
2827+{
2828+ QList<QByteArray> variableList = output.split('\n');
2829+ if (!variableList.isEmpty()) {
2830+ variableList.removeFirst(); //remove version string
2831+ foreach (const QByteArray &variable, variableList) {
2832+ if (variable.contains("_<CONFIG>")) {
2833+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<CONFIG>"), QLatin1String("_DEBUG"));
2834+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<CONFIG>"), QLatin1String("_RELEASE"));
2835+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<CONFIG>"), QLatin1String("_MINSIZEREL"));
2836+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<CONFIG>"), QLatin1String("_RELWITHDEBINFO"));
2837+ } else if (variable.contains("_<LANG>")) {
2838+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<LANG>"), QLatin1String("_C"));
2839+ m_variables << QString::fromLocal8Bit(variable).replace(QLatin1String("_<LANG>"), QLatin1String("_CXX"));
2840+ } else if (!variable.contains("_<") && !variable.contains('[')) {
2841+ m_variables << QString::fromLocal8Bit(variable);
2842+ }
2843+ }
2844+ }
2845+}
2846+
2847+void CMakeTool::parseDone()
2848+{
2849+ m_variables.sort();
2850+ m_variables.removeDuplicates();
2851+}
2852
2853=== added file 'src/cmakeprojectmanager/cmaketool.h'
2854--- src/cmakeprojectmanager/cmaketool.h 1970-01-01 00:00:00 +0000
2855+++ src/cmakeprojectmanager/cmaketool.h 2014-02-28 08:31:43 +0000
2856@@ -0,0 +1,120 @@
2857+#ifndef CMAKETOOL_H
2858+#define CMAKETOOL_H
2859+
2860+#include "cmakeprojectmanager_global.h"
2861+
2862+#include <QObject>
2863+#include <QString>
2864+#include <QStringList>
2865+#include <QQueue>
2866+#include <QPointer>
2867+#include <QFutureInterface>
2868+#include <texteditor/codeassist/keywordscompletionassist.h>
2869+
2870+#include <projectexplorer/project.h>
2871+#include <utils/environment.h>
2872+
2873+namespace Utils {
2874+ QT_FORWARD_DECLARE_CLASS(QtcProcess)
2875+}
2876+
2877+class QProcess;
2878+
2879+namespace CMakeProjectManager {
2880+
2881+class CMAKEPROJECTMANAGER_EXPORT ICMakeTool: public QObject
2882+{
2883+ Q_OBJECT
2884+public:
2885+ ICMakeTool(QObject * parent);
2886+ virtual ~ICMakeTool();
2887+ virtual void cancel() = 0;
2888+ virtual QString displayName () = 0;
2889+ virtual bool isValid() const = 0;
2890+ virtual bool hasCodeBlocksMsvcGenerator() const = 0;
2891+ virtual bool hasCodeBlocksNinjaGenerator() const = 0;
2892+ virtual TextEditor::Keywords keywords() = 0;
2893+ virtual void runCMake (ProjectExplorer::Target* target) = 0;
2894+ virtual void addToEnvironment(Utils::Environment &env) const;
2895+
2896+ Core::Id id() const { return m_id; }
2897+
2898+signals:
2899+ void cmakeFinished (ProjectExplorer::Target* target);
2900+
2901+protected:
2902+ void setId(Core::Id id) { m_id = id; }
2903+
2904+private:
2905+ Core::Id m_id;
2906+};
2907+
2908+class CMAKEPROJECTMANAGER_EXPORT ICMakeToolFactory : public QObject
2909+{
2910+ Q_OBJECT
2911+public:
2912+ virtual bool canCreate (const Core::Id& id) const = 0;
2913+ virtual ICMakeTool* create (const Core::Id& id) = 0;
2914+};
2915+
2916+
2917+class CMAKEPROJECTMANAGER_EXPORT CMakeTool : public ICMakeTool
2918+{
2919+ Q_OBJECT
2920+public:
2921+ explicit CMakeTool(QObject *parent = 0);
2922+ virtual ~CMakeTool();
2923+
2924+ enum State { Invalid, RunningBasic, RunningFunctionList, RunningFunctionDetails,
2925+ RunningPropertyList, RunningVariableList, RunningDone, RunningProject };
2926+
2927+ bool isValid() const;
2928+
2929+ void setCMakeExecutable(const QString &executable);
2930+ QString cmakeExecutable() const;
2931+ bool hasCodeBlocksMsvcGenerator() const;
2932+ bool hasCodeBlocksNinjaGenerator() const;
2933+ TextEditor::Keywords keywords();
2934+
2935+ virtual void runCMake (ProjectExplorer::Target *target );
2936+ virtual QString displayName ();
2937+
2938+public slots:
2939+ void cancel();
2940+
2941+protected:
2942+ void startNextRun ();
2943+
2944+private slots:
2945+ void finished(int exitCode);
2946+ void onProcessReadyRead();
2947+
2948+private:
2949+ void flushOutput();
2950+ void finishStep();
2951+ void createProcessIfNotExists();
2952+ bool startProcess(const QStringList &args, Utils::Environment env = Utils::Environment::systemEnvironment());
2953+ void parseFunctionOutput(const QByteArray &output);
2954+ void parseFunctionDetailsOutput(const QByteArray &output);
2955+ void parseVariableOutput(const QByteArray &output);
2956+ void parseDone();
2957+ QString formatFunctionDetails(const QString &command, const QString &args);
2958+
2959+ State m_state;
2960+ Utils::QtcProcess *m_process;
2961+ bool m_hasCodeBlocksMsvcGenerator;
2962+ bool m_hasCodeBlocksNinjaGenerator;
2963+ QString m_executable;
2964+
2965+ QMap<QString, QStringList> m_functionArgs;
2966+ QStringList m_variables;
2967+ QStringList m_functions;
2968+
2969+ QQueue< QPointer<ProjectExplorer::Target> > m_pendingRuns;
2970+ QPointer<ProjectExplorer::Target> m_currentRun;
2971+ QFutureInterface<void> *m_futureInterface;
2972+};
2973+
2974+}
2975+
2976+#endif // CMAKETOOL_H
2977
2978=== added file 'src/cmakeprojectmanager/cmaketoolmanager.cpp'
2979--- src/cmakeprojectmanager/cmaketoolmanager.cpp 1970-01-01 00:00:00 +0000
2980+++ src/cmakeprojectmanager/cmaketoolmanager.cpp 2014-02-28 08:31:43 +0000
2981@@ -0,0 +1,97 @@
2982+#include "cmaketoolmanager.h"
2983+#include "cmakeprojectconstants.h"
2984+#include "cmakekitinformation.h"
2985+
2986+#include <coreplugin/icore.h>
2987+#include <extensionsystem/pluginmanager.h>
2988+#include <projectexplorer/kit.h>
2989+#include <utils/environment.h>
2990+
2991+namespace CMakeProjectManager {
2992+
2993+CMakeToolManager* CMakeToolManager::m_instance = 0;
2994+CMakeToolManager::CMakeToolManager()
2995+{
2996+ m_instance = this;
2997+ m_cmakeToolForSystem.setCMakeExecutable(findCmakeExecutable());
2998+
2999+ QSettings *settings = Core::ICore::settings();
3000+ settings->beginGroup(QLatin1String("CMakeSettings"));
3001+ m_cmakeToolForUser.setCMakeExecutable(settings->value(QLatin1String("cmakeExecutable")).toString());
3002+ settings->endGroup();
3003+
3004+}
3005+
3006+CMakeToolManager::~CMakeToolManager()
3007+{
3008+ m_instance = 0;
3009+ m_cmakeToolForSystem.cancel();
3010+ m_cmakeToolForUser.cancel();
3011+
3012+ //clean up created cmake tools
3013+ qDeleteAll(m_cmakeTools.begin(),m_cmakeTools.end());
3014+}
3015+
3016+void CMakeToolManager::setUserCmakePath(const QString &path)
3017+{
3018+ m_instance->m_cmakeToolForUser.setCMakeExecutable(path);
3019+}
3020+
3021+QString CMakeToolManager::userCMakePath()
3022+{
3023+ return m_instance->m_cmakeToolForUser.cmakeExecutable();
3024+}
3025+
3026+/*!
3027+ * \brief CMakeToolManager::defaultCMakeTool
3028+ * Returns a pointer to the internal default cmake tool instance
3029+ */
3030+CMakeTool *CMakeToolManager::defaultCMakeTool()
3031+{
3032+ if(m_instance->m_cmakeToolForUser.isValid())
3033+ return &m_instance->m_cmakeToolForUser;
3034+ return &m_instance->m_cmakeToolForSystem;
3035+}
3036+
3037+bool CMakeToolManager::registerCMakeTool(ICMakeTool *tool)
3038+{
3039+ if(m_instance->m_cmakeTools.contains(tool->id().uniqueIdentifier()))
3040+ return false;
3041+ m_instance->m_cmakeTools.insert(tool->id().uniqueIdentifier(),tool);
3042+ return true;
3043+}
3044+
3045+ICMakeTool *CMakeToolManager::cmakeTool(const Core::Id &id)
3046+{
3047+ if(id == Constants::CMAKE_TOOL_ID)
3048+ return defaultCMakeTool();
3049+
3050+ if(m_instance->m_cmakeTools.contains(id.uniqueIdentifier()))
3051+ return m_instance->m_cmakeTools[id.uniqueIdentifier()];
3052+
3053+ qDebug()<<"Don't know "<<id.toString()<<" Creating and registering it";
3054+
3055+ //try to find a factory that can create the cmake tool
3056+ QList<ICMakeToolFactory*> factories = ExtensionSystem::PluginManager::getObjects<ICMakeToolFactory>();
3057+ foreach(ICMakeToolFactory* factory, factories) {
3058+ if(factory->canCreate(id)) {
3059+ ICMakeTool* cmake = factory->create(id);
3060+ m_instance->m_cmakeTools.insert(id.uniqueIdentifier(),cmake);
3061+
3062+ return cmake;
3063+ }
3064+ }
3065+ return 0;
3066+}
3067+
3068+ICMakeTool *CMakeToolManager::cmakeToolForKit(const ProjectExplorer::Kit *kit)
3069+{
3070+ return CMakeKitInformation::cmakeTool(kit);
3071+}
3072+
3073+QString CMakeToolManager::findCmakeExecutable()
3074+{
3075+ return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake"));
3076+}
3077+
3078+} // namespace CMakeProjectManager
3079
3080=== added file 'src/cmakeprojectmanager/cmaketoolmanager.h'
3081--- src/cmakeprojectmanager/cmaketoolmanager.h 1970-01-01 00:00:00 +0000
3082+++ src/cmakeprojectmanager/cmaketoolmanager.h 2014-02-28 08:31:43 +0000
3083@@ -0,0 +1,35 @@
3084+#ifndef CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
3085+#define CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
3086+
3087+#include "cmakeprojectmanager_global.h"
3088+#include "cmaketool.h"
3089+
3090+#include <coreplugin/id.h>
3091+
3092+namespace CMakeProjectManager {
3093+
3094+class CMAKEPROJECTMANAGER_EXPORT CMakeToolManager : public QObject
3095+{
3096+ Q_OBJECT
3097+public:
3098+ CMakeToolManager ();
3099+ ~CMakeToolManager ();
3100+
3101+ static void setUserCmakePath (const QString &path);
3102+ static QString userCMakePath();
3103+
3104+ static CMakeTool *defaultCMakeTool ();
3105+ static bool registerCMakeTool (ICMakeTool* tool);
3106+ static ICMakeTool *cmakeTool (const Core::Id& id);
3107+ static ICMakeTool *cmakeToolForKit (const ProjectExplorer::Kit *kit);
3108+ static QString findCmakeExecutable();
3109+private:
3110+ static CMakeToolManager *m_instance;
3111+ CMakeTool m_cmakeToolForUser;
3112+ CMakeTool m_cmakeToolForSystem;
3113+ QMap<uint,ICMakeTool*> m_cmakeTools;
3114+};
3115+
3116+} // namespace CMakeProjectManager
3117+
3118+#endif // CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
3119
3120=== added file 'src/cmakeprojectmanager/generatorinfo.cpp'
3121--- src/cmakeprojectmanager/generatorinfo.cpp 1970-01-01 00:00:00 +0000
3122+++ src/cmakeprojectmanager/generatorinfo.cpp 2014-02-28 08:31:43 +0000
3123@@ -0,0 +1,127 @@
3124+#include "generatorinfo.h"
3125+
3126+#include <projectexplorer/projectexplorerconstants.h>
3127+#include <projectexplorer/kitinformation.h>
3128+#include <projectexplorer/kitmanager.h>
3129+#include <projectexplorer/toolchain.h>
3130+#include <projectexplorer/abi.h>
3131+#include <remotelinux/remotelinux_constants.h>
3132+
3133+namespace CMakeProjectManager {
3134+namespace Internal {
3135+
3136+
3137+GeneratorInfo::GeneratorInfo()
3138+ : m_kit(0), m_isNinja(false)
3139+{}
3140+
3141+GeneratorInfo::GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja)
3142+ : m_kit(kit), m_isNinja(ninja)
3143+{}
3144+
3145+ProjectExplorer::Kit *GeneratorInfo::kit() const
3146+{
3147+ return m_kit;
3148+}
3149+
3150+bool GeneratorInfo::isNinja() const {
3151+ return m_isNinja;
3152+}
3153+
3154+QByteArray GeneratorInfo::generator() const
3155+{
3156+ if (!m_kit)
3157+ return QByteArray();
3158+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit);
3159+ ProjectExplorer::Abi targetAbi = tc->targetAbi();
3160+ if (m_isNinja) {
3161+ return "Ninja";
3162+ } else if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
3163+ if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
3164+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
3165+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
3166+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
3167+ return "NMake Makefiles";
3168+ } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
3169+ if (Utils::HostOsInfo::isWindowsHost())
3170+ return "MinGW Makefiles";
3171+ else
3172+ return "Unix Makefiles";
3173+ }
3174+ }
3175+ return "Unix Makefiles";
3176+}
3177+
3178+QByteArray GeneratorInfo::generatorArgument() const
3179+{
3180+ QByteArray tmp = generator();
3181+ if (tmp.isEmpty())
3182+ return tmp;
3183+ return QByteArray("-GCodeBlocks - ") + tmp;
3184+}
3185+
3186+QString GeneratorInfo::displayName() const
3187+{
3188+ if (!m_kit)
3189+ return QString();
3190+ if (m_isNinja)
3191+ return tr("Ninja (%1)").arg(m_kit->displayName());
3192+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit);
3193+ ProjectExplorer::Abi targetAbi = tc->targetAbi();
3194+ if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
3195+ if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
3196+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
3197+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
3198+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
3199+ return tr("NMake Generator (%1)").arg(m_kit->displayName());
3200+ } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
3201+ if (Utils::HostOsInfo::isWindowsHost())
3202+ return tr("MinGW Generator (%1)").arg(m_kit->displayName());
3203+ else
3204+ return tr("Unix Generator (%1)").arg(m_kit->displayName());
3205+ }
3206+ } else {
3207+ // Non windows
3208+ return tr("Unix Generator (%1)").arg(m_kit->displayName());
3209+ }
3210+ return QString();
3211+}
3212+
3213+QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks)
3214+{
3215+ QList<GeneratorInfo> results;
3216+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
3217+ if (!tc)
3218+ return results;
3219+ Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
3220+ if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
3221+ && deviceType != RemoteLinux::Constants::GenericLinuxOsType)
3222+ return results;
3223+ ProjectExplorer::Abi targetAbi = tc->targetAbi();
3224+ if (n != ForceNinja) {
3225+ if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
3226+ if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
3227+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
3228+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
3229+ || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
3230+ if (hasCodeBlocks)
3231+ results << GeneratorInfo(k);
3232+ } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
3233+ results << GeneratorInfo(k);
3234+ }
3235+ } else {
3236+ // Non windows
3237+ results << GeneratorInfo(k);
3238+ }
3239+ }
3240+ if (n != NoNinja) {
3241+ if (preferNinja)
3242+ results.prepend(GeneratorInfo(k, true));
3243+ else
3244+ results.append(GeneratorInfo(k, true));
3245+ }
3246+ return results;
3247+}
3248+
3249+} // namespace Internal
3250+} // namespace CMake
3251
3252=== added file 'src/cmakeprojectmanager/generatorinfo.h'
3253--- src/cmakeprojectmanager/generatorinfo.h 1970-01-01 00:00:00 +0000
3254+++ src/cmakeprojectmanager/generatorinfo.h 2014-02-28 08:31:43 +0000
3255@@ -0,0 +1,40 @@
3256+#ifndef CMAKE_INTERNAL_GENERATORINFO_H
3257+#define CMAKE_INTERNAL_GENERATORINFO_H
3258+
3259+#include <QCoreApplication>
3260+#include <QMetaType>
3261+
3262+#include <projectexplorer/kit.h>
3263+#include "cmakeprojectmanager.h"
3264+
3265+namespace CMakeProjectManager {
3266+namespace Internal {
3267+
3268+class GeneratorInfo
3269+{
3270+ Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::GeneratorInfo)
3271+public:
3272+ enum Ninja { NoNinja, OfferNinja, ForceNinja };
3273+ static QList<GeneratorInfo> generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks);
3274+
3275+ GeneratorInfo();
3276+ explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false);
3277+
3278+ ProjectExplorer::Kit *kit() const;
3279+ bool isNinja() const;
3280+
3281+ QString displayName() const;
3282+ QByteArray generatorArgument() const;
3283+ QByteArray generator() const;
3284+
3285+private:
3286+ ProjectExplorer::Kit *m_kit;
3287+ bool m_isNinja;
3288+};
3289+
3290+} // namespace Internal
3291+} // namespace CMake
3292+
3293+Q_DECLARE_METATYPE(CMakeProjectManager::Internal::GeneratorInfo);
3294+
3295+#endif // CMAKE_INTERNAL_GENERATORINFO_H
3296
3297=== modified file 'src/cmakeprojectmanager/makestep.h'
3298--- src/cmakeprojectmanager/makestep.h 2014-02-18 14:30:29 +0000
3299+++ src/cmakeprojectmanager/makestep.h 2014-02-28 08:31:43 +0000
3300@@ -43,9 +43,9 @@
3301 }
3302
3303 namespace CMakeProjectManager {
3304+class CMakeBuildConfiguration;
3305+
3306 namespace Internal {
3307-
3308-class CMakeBuildConfiguration;
3309 class MakeStepFactory;
3310
3311 class MakeStep : public ProjectExplorer::AbstractProcessStep
3312@@ -75,7 +75,7 @@
3313 QString additionalArguments() const;
3314 void setAdditionalArguments(const QString &list);
3315
3316- QString makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const;
3317+ virtual QString makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const;
3318
3319 void setClean(bool clean);
3320

Subscribers

People subscribed via source and target branches