Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
acbd4513
Commit
acbd4513
authored
Sep 24, 2009
by
con
Browse files
Changing string based api to BuildConfiguration based api.
Builds, but I'm pretty sure it doesn't *work* :)
parent
30362e10
Changes
30
Hide whitespace changes
Inline
Side-by-side
src/plugins/cmakeprojectmanager/cmakebuildenvironmentwidget.cpp
View file @
acbd4513
...
...
@@ -69,16 +69,17 @@ QString CMakeBuildEnvironmentWidget::displayName() const
return
tr
(
"Build Environment"
);
}
void
CMakeBuildEnvironmentWidget
::
init
(
const
QString
&
buildConfiguration
)
void
CMakeBuildEnvironmentWidget
::
init
(
const
QString
&
buildConfiguration
Name
)
{
if
(
debug
)
qDebug
()
<<
"Qt4BuildConfigWidget::init()"
;
m_buildConfiguration
=
buildConfiguration
;
m_buildConfiguration
=
buildConfiguration
Name
;
m_clearSystemEnvironmentCheckBox
->
setChecked
(
!
m_pro
->
useSystemEnvironment
(
buildConfiguration
));
m_buildEnvironmentWidget
->
setBaseEnvironment
(
m_pro
->
baseEnvironment
(
buildConfiguration
));
m_buildEnvironmentWidget
->
setUserChanges
(
m_pro
->
userEnvironmentChanges
(
buildConfiguration
));
ProjectExplorer
::
BuildConfiguration
*
bc
=
m_pro
->
buildConfiguration
(
buildConfigurationName
);
m_clearSystemEnvironmentCheckBox
->
setChecked
(
!
m_pro
->
useSystemEnvironment
(
bc
));
m_buildEnvironmentWidget
->
setBaseEnvironment
(
m_pro
->
baseEnvironment
(
bc
));
m_buildEnvironmentWidget
->
setUserChanges
(
m_pro
->
userEnvironmentChanges
(
bc
));
m_buildEnvironmentWidget
->
updateButtons
();
}
...
...
@@ -89,6 +90,7 @@ void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
void
CMakeBuildEnvironmentWidget
::
clearSystemEnvironmentCheckBoxClicked
(
bool
checked
)
{
m_pro
->
setUseSystemEnvironment
(
m_buildConfiguration
,
!
checked
);
m_buildEnvironmentWidget
->
setBaseEnvironment
(
m_pro
->
baseEnvironment
(
m_buildConfiguration
));
ProjectExplorer
::
BuildConfiguration
*
bc
=
m_pro
->
buildConfiguration
(
m_buildConfiguration
);
m_pro
->
setUseSystemEnvironment
(
bc
,
!
checked
);
m_buildEnvironmentWidget
->
setBaseEnvironment
(
m_pro
->
baseEnvironment
(
bc
));
}
src/plugins/cmakeprojectmanager/cmakeproject.cpp
View file @
acbd4513
...
...
@@ -48,9 +48,11 @@
#include <QtCore/QProcess>
#include <QtGui/QFormLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QInputDialog>
using
namespace
CMakeProjectManager
;
using
namespace
CMakeProjectManager
::
Internal
;
using
namespace
ProjectExplorer
;
using
ProjectExplorer
::
Environment
;
using
ProjectExplorer
::
EnvironmentItem
;
...
...
@@ -63,10 +65,77 @@ using ProjectExplorer::EnvironmentItem;
// Open Questions
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
/*!
\class CMakeBuildConfigurationFactory
*/
CMakeBuildConfigurationFactory
::
CMakeBuildConfigurationFactory
(
CMakeProject
*
project
)
:
IBuildConfigurationFactory
(
project
),
m_project
(
project
)
{
}
CMakeBuildConfigurationFactory
::~
CMakeBuildConfigurationFactory
()
{
}
QStringList
CMakeBuildConfigurationFactory
::
availableCreationTypes
()
const
{
return
QStringList
()
<<
"Create"
;
}
QString
CMakeBuildConfigurationFactory
::
displayNameForType
(
const
QString
&
type
)
const
{
return
tr
(
"Create"
);
}
QList
<
BuildConfiguration
*>
CMakeBuildConfigurationFactory
::
create
(
const
QString
&
type
)
const
{
QTC_ASSERT
(
type
==
"Create"
,
return
QList
<
BuildConfiguration
*>
());
//TODO configuration name should be part of the cmakeopenprojectwizard
bool
ok
;
QString
buildConfigurationName
=
QInputDialog
::
getText
(
0
,
tr
(
"New configuration"
),
tr
(
"New Configuration Name:"
),
QLineEdit
::
Normal
,
QString
(),
&
ok
);
if
(
!
ok
||
buildConfigurationName
.
isEmpty
())
return
QList
<
BuildConfiguration
*>
();
BuildConfiguration
*
bc
=
new
BuildConfiguration
(
buildConfigurationName
);
// Default to all
//TODO the buildConfigurationName has not been made unique yet
if
(
m_project
->
targets
().
contains
(
"all"
))
m_project
->
makeStep
()
->
setBuildTarget
(
buildConfigurationName
,
"all"
,
true
);
CMakeOpenProjectWizard
copw
(
m_project
->
projectManager
(),
m_project
->
sourceDirectory
(),
m_project
->
buildDirectory
(
bc
),
m_project
->
environment
(
bc
));
if
(
copw
.
exec
()
!=
QDialog
::
Accepted
)
{
delete
bc
;
return
QList
<
BuildConfiguration
*>
();
}
bc
->
setValue
(
"buildDirectory"
,
copw
.
buildDirectory
());
bc
->
setValue
(
"msvcVersion"
,
copw
.
msvcVersion
());
m_project
->
parseCMakeLists
();
return
QList
<
BuildConfiguration
*>
()
<<
bc
;
}
QList
<
BuildConfiguration
*>
CMakeBuildConfigurationFactory
::
createDefaultConfigurations
()
const
{
return
QList
<
BuildConfiguration
*>
()
<<
new
BuildConfiguration
;
}
/*!
\class CMakeProject
*/
CMakeProject
::
CMakeProject
(
CMakeManager
*
manager
,
const
QString
&
fileName
)
:
m_manager
(
manager
),
m_fileName
(
fileName
),
m_buildConfigurationFactory
(
new
CMakeBuildConfigurationFactory
(
this
)),
m_rootNode
(
new
CMakeProjectNode
(
m_fileName
)),
m_toolChain
(
0
),
m_insideFileChanged
(
false
)
...
...
@@ -80,12 +149,18 @@ CMakeProject::~CMakeProject()
delete
m_toolChain
;
}
IBuildConfigurationFactory
*
CMakeProject
::
buildConfigurationFactory
()
const
{
return
m_buildConfigurationFactory
;
}
void
CMakeProject
::
slotActiveBuildConfiguration
()
{
BuildConfiguration
*
activeBC
=
activeBuildConfiguration
();
// Pop up a dialog asking the user to rerun cmake
QFileInfo
sourceFileInfo
(
m_fileName
);
QString
cbpFile
=
CMakeManager
::
findCbpFile
(
QDir
(
buildDirectory
(
activeB
uildConfiguration
()
)));
QString
cbpFile
=
CMakeManager
::
findCbpFile
(
QDir
(
buildDirectory
(
activeB
C
)));
QFileInfo
cbpFileFi
(
cbpFile
);
CMakeOpenProjectWizard
::
Mode
mode
=
CMakeOpenProjectWizard
::
Nothing
;
if
(
!
cbpFileFi
.
exists
())
{
...
...
@@ -102,11 +177,11 @@ void CMakeProject::slotActiveBuildConfiguration()
if
(
mode
!=
CMakeOpenProjectWizard
::
Nothing
)
{
CMakeOpenProjectWizard
copw
(
m_manager
,
sourceFileInfo
.
absolutePath
(),
buildDirectory
(
activeB
uildConfiguration
()
),
buildDirectory
(
activeB
C
),
mode
,
environment
(
activeB
uildConfiguration
()
));
environment
(
activeB
C
));
copw
.
exec
();
setValue
(
activeBuildConfiguration
(),
"msvcVersion"
,
copw
.
msvcVersion
());
activeBC
->
setValue
(
"msvcVersion"
,
copw
.
msvcVersion
());
}
// reparse
parseCMakeLists
();
...
...
@@ -133,7 +208,7 @@ void CMakeProject::updateToolChain(const QString &compiler)
newToolChain
=
ProjectExplorer
::
ToolChain
::
createGccToolChain
(
"gcc"
);
#endif
}
else
if
(
compiler
==
"msvc8"
)
{
newToolChain
=
ProjectExplorer
::
ToolChain
::
createMSVCToolChain
(
value
(
activeBuildConfiguration
()
,
"msvcVersion"
).
toString
(),
false
);
newToolChain
=
ProjectExplorer
::
ToolChain
::
createMSVCToolChain
(
activeBuildConfiguration
()
->
value
(
"msvcVersion"
).
toString
(),
false
);
}
else
{
// TODO other toolchains
qDebug
()
<<
"Not implemented yet!!! Qt Creator doesn't know which toolchain to use for"
<<
compiler
;
...
...
@@ -148,16 +223,16 @@ void CMakeProject::updateToolChain(const QString &compiler)
}
}
ProjectExplorer
::
ToolChain
*
CMakeProject
::
toolChain
(
const
QString
&
buildC
onfiguration
)
const
ProjectExplorer
::
ToolChain
*
CMakeProject
::
toolChain
(
BuildConfiguration
*
c
onfiguration
)
const
{
if
(
buildC
onfiguration
!=
activeBuildConfiguration
())
if
(
c
onfiguration
!=
activeBuildConfiguration
())
qWarning
()
<<
"CMakeProject asked for toolchain of a not active buildconfiguration"
;
return
m_toolChain
;
}
void
CMakeProject
::
changeBuildDirectory
(
const
QString
&
buildC
onfiguration
,
const
QString
&
newBuildDirectory
)
void
CMakeProject
::
changeBuildDirectory
(
BuildConfiguration
*
c
onfiguration
,
const
QString
&
newBuildDirectory
)
{
setValue
(
buildC
onfiguration
,
"buildDirectory"
,
newBuildDirectory
);
c
onfiguration
->
setValue
(
"buildDirectory"
,
newBuildDirectory
);
parseCMakeLists
();
}
...
...
@@ -176,7 +251,7 @@ bool CMakeProject::parseCMakeLists()
CMakeCbpParser
cbpparser
;
// Parsing
//qDebug()<<"Parsing file "<<cbpFile;
if
(
cbpparser
.
parseCbpFile
(
cbpFile
))
{
if
(
cbpparser
.
parseCbpFile
(
cbpFile
))
{
// ToolChain
updateToolChain
(
cbpparser
.
compilerName
());
...
...
@@ -317,11 +392,11 @@ bool CMakeProject::parseCMakeLists()
return
true
;
}
QString
CMakeProject
::
buildParser
(
const
QString
&
buildC
onfiguration
)
const
QString
CMakeProject
::
buildParser
(
BuildConfiguration
*
c
onfiguration
)
const
{
Q_UNUSED
(
buildC
onfiguration
)
Q_UNUSED
(
c
onfiguration
)
// TODO this is actually slightly wrong, but do i care?
// this should call toolchain(
buildC
onfiguration)
// this should call toolchain(
c
onfiguration)
if
(
!
m_toolChain
)
return
QString
::
null
;
if
(
m_toolChain
->
type
()
==
ProjectExplorer
::
ToolChain
::
GCC
...
...
@@ -476,36 +551,37 @@ bool CMakeProject::isApplication() const
return
true
;
}
ProjectExplorer
::
Environment
CMakeProject
::
baseEnvironment
(
const
QString
&
buildC
onfiguration
)
const
ProjectExplorer
::
Environment
CMakeProject
::
baseEnvironment
(
BuildConfiguration
*
c
onfiguration
)
const
{
Environment
env
=
useSystemEnvironment
(
buildC
onfiguration
)
?
Environment
(
QProcess
::
systemEnvironment
())
:
Environment
();
Environment
env
=
useSystemEnvironment
(
c
onfiguration
)
?
Environment
(
QProcess
::
systemEnvironment
())
:
Environment
();
return
env
;
}
ProjectExplorer
::
Environment
CMakeProject
::
environment
(
const
QString
&
buildC
onfiguration
)
const
ProjectExplorer
::
Environment
CMakeProject
::
environment
(
BuildConfiguration
*
c
onfiguration
)
const
{
Environment
env
=
baseEnvironment
(
buildC
onfiguration
);
env
.
modify
(
userEnvironmentChanges
(
buildC
onfiguration
));
Environment
env
=
baseEnvironment
(
c
onfiguration
);
env
.
modify
(
userEnvironmentChanges
(
c
onfiguration
));
return
env
;
}
void
CMakeProject
::
setUseSystemEnvironment
(
const
QString
&
buildC
onfiguration
,
bool
b
)
void
CMakeProject
::
setUseSystemEnvironment
(
BuildConfiguration
*
c
onfiguration
,
bool
b
)
{
if
(
b
==
useSystemEnvironment
(
buildC
onfiguration
))
if
(
b
==
useSystemEnvironment
(
c
onfiguration
))
return
;
setValue
(
buildC
onfiguration
,
"clearSystemEnvironment"
,
!
b
);
emit
environmentChanged
(
buildC
onfiguration
);
c
onfiguration
->
setValue
(
"clearSystemEnvironment"
,
!
b
);
emit
environmentChanged
(
c
onfiguration
->
name
()
);
}
bool
CMakeProject
::
useSystemEnvironment
(
const
QString
&
buildC
onfiguration
)
const
bool
CMakeProject
::
useSystemEnvironment
(
BuildConfiguration
*
c
onfiguration
)
const
{
bool
b
=
!
(
value
(
buildConfiguration
,
"clearSystemEnvironment"
).
isValid
()
&&
value
(
buildConfiguration
,
"clearSystemEnvironment"
).
toBool
());
bool
b
=
!
(
configuration
->
value
(
"clearSystemEnvironment"
).
isValid
()
&&
configuration
->
value
(
"clearSystemEnvironment"
).
toBool
());
return
b
;
}
QList
<
ProjectExplorer
::
EnvironmentItem
>
CMakeProject
::
userEnvironmentChanges
(
const
QString
&
buildConfig
)
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
CMakeProject
::
userEnvironmentChanges
(
BuildConfiguration
*
configuration
)
const
{
return
EnvironmentItem
::
fromStringList
(
value
(
buildConfig
,
"userEnvironmentChanges"
).
toStringList
());
return
EnvironmentItem
::
fromStringList
(
configuration
->
value
(
"userEnvironmentChanges"
).
toStringList
());
}
void
CMakeProject
::
setUserEnvironmentChanges
(
const
QString
&
buildConfig
,
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
)
...
...
@@ -517,9 +593,9 @@ void CMakeProject::setUserEnvironmentChanges(const QString &buildConfig, const Q
emit
environmentChanged
(
buildConfig
);
}
QString
CMakeProject
::
buildDirectory
(
const
QString
&
buildC
onfiguration
)
const
QString
CMakeProject
::
buildDirectory
(
BuildConfiguration
*
c
onfiguration
)
const
{
QString
buildDirectory
=
value
(
buildC
onfiguration
,
"buildDirectory"
).
toString
();
QString
buildDirectory
=
c
onfiguration
->
value
(
"buildDirectory"
).
toString
();
if
(
buildDirectory
.
isEmpty
())
buildDirectory
=
sourceDirectory
()
+
"/qtcreator-build"
;
return
buildDirectory
;
...
...
@@ -537,21 +613,21 @@ QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
return
list
;
}
bool
CMakeProject
::
newBuildConfiguration
(
const
QString
&
buildConfiguration
)
{
// Default to all
if
(
targets
().
contains
(
"all"
))
makeStep
()
->
setBuildTarget
(
buildConfiguration
,
"all"
,
true
);
CMakeOpenProjectWizard
copw
(
projectManager
(),
sourceDirectory
(),
buildDirectory
(
buildConfiguration
),
environment
(
buildConfiguration
));
if
(
copw
.
exec
()
==
QDialog
::
Accepted
)
{
setValue
(
buildConfiguration
,
"buildDirectory"
,
copw
.
buildDirectory
());
setValue
(
buildConfiguration
,
"msvcVersion"
,
copw
.
msvcVersion
());
parseCMakeLists
();
return
true
;
}
return
false
;
}
//
bool CMakeProject::newBuildConfiguration(const QString &buildConfiguration)
//
{
//
// Default to all
//
if (targets().contains("all"))
//
makeStep()->setBuildTarget(buildConfiguration, "all", true);
//
//
CMakeOpenProjectWizard copw(projectManager(), sourceDirectory(), buildDirectory(buildConfiguration), environment(buildConfiguration));
//
if (copw.exec() == QDialog::Accepted) {
//
setValue(buildConfiguration, "buildDirectory", copw.buildDirectory());
//
setValue(buildConfiguration, "msvcVersion", copw.msvcVersion());
//
parseCMakeLists();
//
return true;
//
}
//
return false;
//
}
ProjectExplorer
::
ProjectNode
*
CMakeProject
::
rootProjectNode
()
const
{
...
...
@@ -600,23 +676,25 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
insertBuildStep
(
0
,
makeStep
);
addBuildConfiguration
(
"all"
);
setValue
(
"all"
,
"msvcVersion"
,
copw
.
msvcVersion
());
ProjectExplorer
::
BuildConfiguration
*
bc
=
new
ProjectExplorer
::
BuildConfiguration
(
"all"
);
addBuildConfiguration
(
bc
);
setValue
(
bc
->
name
(),
"msvcVersion"
,
copw
.
msvcVersion
());
if
(
!
copw
.
buildDirectory
().
isEmpty
())
setValue
(
"all"
,
"buildDirectory"
,
copw
.
buildDirectory
());
setValue
(
bc
->
name
()
,
"buildDirectory"
,
copw
.
buildDirectory
());
//TODO save arguments somewhere copw.arguments()
MakeStep
*
cleanMakeStep
=
new
MakeStep
(
this
);
insertCleanStep
(
0
,
cleanMakeStep
);
cleanMakeStep
->
setValue
(
"clean"
,
true
);
setActiveBuildConfiguration
(
"all"
);
setActiveBuildConfiguration
(
bc
);
}
else
{
// We have a user file, but we could still be missing the cbp file
// or simply run createXml with the saved settings
QFileInfo
sourceFileInfo
(
m_fileName
);
QStringList
needToCreate
;
QStringList
needToUpdate
;
QString
cbpFile
=
CMakeManager
::
findCbpFile
(
QDir
(
buildDirectory
(
activeBuildConfiguration
())));
BuildConfiguration
*
activeBC
=
activeBuildConfiguration
();
QString
cbpFile
=
CMakeManager
::
findCbpFile
(
QDir
(
buildDirectory
(
activeBC
)));
QFileInfo
cbpFileFi
(
cbpFile
);
CMakeOpenProjectWizard
::
Mode
mode
=
CMakeOpenProjectWizard
::
Nothing
;
...
...
@@ -628,11 +706,11 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
if
(
mode
!=
CMakeOpenProjectWizard
::
Nothing
)
{
CMakeOpenProjectWizard
copw
(
m_manager
,
sourceFileInfo
.
absolutePath
(),
buildDirectory
(
activeB
uildConfiguration
()
),
buildDirectory
(
activeB
C
),
mode
,
environment
(
activeB
uildConfiguration
()
));
environment
(
activeB
C
));
copw
.
exec
();
setValue
(
activeBuildConfiguration
(),
"msvcVersion"
,
copw
.
msvcVersion
());
activeBC
->
setValue
(
"msvcVersion"
,
copw
.
msvcVersion
());
}
}
...
...
@@ -752,11 +830,12 @@ QString CMakeBuildSettingsWidget::displayName() const
return
"CMake"
;
}
void
CMakeBuildSettingsWidget
::
init
(
const
QString
&
buildConfiguration
)
void
CMakeBuildSettingsWidget
::
init
(
const
QString
&
buildConfiguration
Name
)
{
m_buildConfiguration
=
buildConfiguration
;
m_pathLineEdit
->
setText
(
m_project
->
buildDirectory
(
buildConfiguration
));
if
(
m_project
->
buildDirectory
(
buildConfiguration
)
==
m_project
->
sourceDirectory
())
m_buildConfiguration
=
buildConfigurationName
;
BuildConfiguration
*
bc
=
m_project
->
buildConfiguration
(
buildConfigurationName
);
m_pathLineEdit
->
setText
(
m_project
->
buildDirectory
(
bc
));
if
(
m_project
->
buildDirectory
(
bc
)
==
m_project
->
sourceDirectory
())
m_changeButton
->
setEnabled
(
false
);
else
m_changeButton
->
setEnabled
(
true
);
...
...
@@ -764,13 +843,14 @@ void CMakeBuildSettingsWidget::init(const QString &buildConfiguration)
void
CMakeBuildSettingsWidget
::
openChangeBuildDirectoryDialog
()
{
BuildConfiguration
*
bc
=
m_project
->
buildConfiguration
(
m_buildConfiguration
);
CMakeOpenProjectWizard
copw
(
m_project
->
projectManager
(),
m_project
->
sourceDirectory
(),
m_project
->
buildDirectory
(
m_buildConfiguration
),
m_project
->
environment
(
m_buildConfiguration
));
m_project
->
buildDirectory
(
bc
),
m_project
->
environment
(
bc
));
if
(
copw
.
exec
()
==
QDialog
::
Accepted
)
{
m_project
->
changeBuildDirectory
(
m_buildConfiguration
,
copw
.
buildDirectory
());
m_pathLineEdit
->
setText
(
m_project
->
buildDirectory
(
m_buildConfiguration
));
m_project
->
changeBuildDirectory
(
bc
,
copw
.
buildDirectory
());
m_pathLineEdit
->
setText
(
m_project
->
buildDirectory
(
bc
));
}
}
...
...
src/plugins/cmakeprojectmanager/cmakeproject.h
View file @
acbd4513
...
...
@@ -39,6 +39,7 @@
#include <projectexplorer/buildstep.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/filewatcher.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/ifile.h>
#include <QtCore/QXmlStreamReader>
...
...
@@ -49,6 +50,7 @@ namespace CMakeProjectManager {
namespace
Internal
{
class
CMakeFile
;
class
CMakeBuildSettingsWidget
;
struct
CMakeTarget
{
...
...
@@ -60,7 +62,23 @@ struct CMakeTarget
void
clear
();
};
class
CMakeBuildSettingsWidget
;
class
CMakeBuildConfigurationFactory
:
public
ProjectExplorer
::
IBuildConfigurationFactory
{
Q_OBJECT
public:
CMakeBuildConfigurationFactory
(
CMakeProject
*
project
);
~
CMakeBuildConfigurationFactory
();
QStringList
availableCreationTypes
()
const
;
QString
displayNameForType
(
const
QString
&
type
)
const
;
QList
<
ProjectExplorer
::
BuildConfiguration
*>
create
(
const
QString
&
type
)
const
;
QList
<
ProjectExplorer
::
BuildConfiguration
*>
createDefaultConfigurations
()
const
;
private:
CMakeProject
*
m_project
;
};
class
CMakeProject
:
public
ProjectExplorer
::
Project
{
...
...
@@ -73,6 +91,7 @@ public:
virtual
QString
name
()
const
;
virtual
Core
::
IFile
*
file
()
const
;
virtual
ProjectExplorer
::
IBuildConfigurationFactory
*
buildConfigurationFactory
()
const
;
virtual
CMakeManager
*
projectManager
()
const
;
virtual
QList
<
ProjectExplorer
::
Project
*>
dependsOn
();
//NBS TODO implement dependsOn
...
...
@@ -80,47 +99,43 @@ public:
virtual
bool
isApplication
()
const
;
//building environment
ProjectExplorer
::
Environment
environment
(
const
QString
&
buildC
onfiguration
)
const
;
ProjectExplorer
::
Environment
baseEnvironment
(
const
QString
&
buildC
onfiguration
)
const
;
ProjectExplorer
::
Environment
environment
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
ProjectExplorer
::
Environment
baseEnvironment
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
void
setUserEnvironmentChanges
(
const
QString
&
buildConfig
,
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
diff
);
QList
<
ProjectExplorer
::
EnvironmentItem
>
userEnvironmentChanges
(
const
QString
&
buildConfig
)
const
;
bool
useSystemEnvironment
(
const
QString
&
buildC
onfiguration
)
const
;
void
setUseSystemEnvironment
(
const
QString
&
buildC
onfiguration
,
bool
b
);
QList
<
ProjectExplorer
::
EnvironmentItem
>
userEnvironmentChanges
(
ProjectExplorer
::
BuildConfiguration
*
configuration
)
const
;
bool
useSystemEnvironment
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
void
setUseSystemEnvironment
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
,
bool
b
);
virtual
QString
buildDirectory
(
const
QString
&
buildC
onfiguration
)
const
;
virtual
QString
buildDirectory
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
virtual
ProjectExplorer
::
BuildConfigWidget
*
createConfigWidget
();
virtual
QList
<
ProjectExplorer
::
BuildConfigWidget
*>
subConfigWidgets
();
// This method is called for new build configurations
// You should probably set some default values in this method
virtual
bool
newBuildConfiguration
(
const
QString
&
buildConfiguration
);
virtual
ProjectExplorer
::
ProjectNode
*
rootProjectNode
()
const
;
virtual
QStringList
files
(
FilesMode
fileMode
)
const
;
MakeStep
*
makeStep
()
const
;
QStringList
targets
()
const
;
QString
buildParser
(
const
QString
&
buildC
onfiguration
)
const
;
QString
buildParser
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
CMakeTarget
targetForTitle
(
const
QString
&
title
);
QString
sourceDirectory
()
const
;
ProjectExplorer
::
ToolChain
::
ToolChainType
toolChainType
()
const
;
ProjectExplorer
::
ToolChain
*
toolChain
(
const
QString
&
buildC
onfiguration
)
const
;
ProjectExplorer
::
ToolChain
*
toolChain
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
)
const
;
bool
parseCMakeLists
();
protected:
virtual
void
saveSettingsImpl
(
ProjectExplorer
::
PersistentSettingsWriter
&
writer
);
virtual
bool
restoreSettingsImpl
(
ProjectExplorer
::
PersistentSettingsReader
&
reader
);
// called by CMakeBuildSettingsWidget
void
changeBuildDirectory
(
const
QString
&
buildC
onfiguration
,
const
QString
&
newBuildDirectory
);
void
changeBuildDirectory
(
ProjectExplorer
::
BuildConfiguration
*
c
onfiguration
,
const
QString
&
newBuildDirectory
);
private
slots
:
void
fileChanged
(
const
QString
&
fileName
);
void
slotActiveBuildConfiguration
();
private:
bool
parseCMakeLists
();
void
updateToolChain
(
const
QString
&
compiler
);
void
buildTree
(
CMakeProjectNode
*
rootNode
,
QList
<
ProjectExplorer
::
FileNode
*>
list
);
...
...
@@ -131,6 +146,7 @@ private:
QString
m_fileName
;
CMakeFile
*
m_file
;
QString
m_projectName
;
CMakeBuildConfigurationFactory
*
m_buildConfigurationFactory
;
// TODO probably need a CMake specific node structure
CMakeProjectNode
*
m_rootNode
;
...
...
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
View file @
acbd4513
...
...
@@ -187,7 +187,6 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
}
else
if
(
m_baseEnvironmentBase
==
CMakeRunConfiguration
::
SystemEnvironmentBase
)
{
env
=
ProjectExplorer
::
Environment
::
systemEnvironment
();
}
else
if
(
m_baseEnvironmentBase
==
CMakeRunConfiguration
::
BuildEnvironmentBase
)
{
QString
config
=
project
()
->
activeBuildConfiguration
();
env
=
project
()
->
environment
(
project
()
->
activeBuildConfiguration
());
}
return
env
;
...
...
src/plugins/cmakeprojectmanager/makestep.cpp
View file @
acbd4513
...
...
@@ -54,12 +54,13 @@ MakeStep::~MakeStep()
bool
MakeStep
::
init
(
const
QString
&
buildConfiguration
)
{
setBuildParser
(
m_pro
->
buildParser
(
buildConfiguration
));
ProjectExplorer
::
BuildConfiguration
*
bc
=
m_pro
->
buildConfiguration
(
buildConfiguration
);
setBuildParser
(
m_pro
->
buildParser
(
bc
));
setEnabled
(
buildConfiguration
,
true
);
setWorkingDirectory
(
buildConfiguration
,
m_pro
->
buildDirectory
(
b
uildConfiguration
));
setWorkingDirectory
(
buildConfiguration
,
m_pro
->
buildDirectory
(
b
c
));
setCommand
(
buildConfiguration
,
m_pro
->
toolChain
(
b
uildConfiguration
)
->
makeCommand
());
setCommand
(
buildConfiguration
,
m_pro
->
toolChain
(
b
c
)
->
makeCommand
());
if
(
!
value
(
buildConfiguration
,
"cleanConfig"
).
isValid
()
&&
value
(
"clean"
).
isValid
()
&&
value
(
"clean"
).
toBool
())
{
// Import old settings
...
...
@@ -70,7 +71,7 @@ bool MakeStep::init(const QString &buildConfiguration)
QStringList
arguments
=
value
(
buildConfiguration
,
"buildTargets"
).
toStringList
();
arguments
<<
additionalArguments
(
buildConfiguration
);
setArguments
(
buildConfiguration
,
arguments
);
// TODO
setEnvironment
(
buildConfiguration
,
m_pro
->
environment
(
b
uildConfiguration
));
setEnvironment
(
buildConfiguration
,
m_pro
->
environment
(
b
c
));
setIgnoreReturnValue
(
buildConfiguration
,
value
(
buildConfiguration
,
"cleanConfig"
).
isValid
());
return
AbstractMakeStep
::
init
(
buildConfiguration
);
...
...
@@ -225,7 +226,9 @@ void MakeStepConfigWidget::updateDetails()
QStringList
arguments
=
m_makeStep
->
value
(
m_buildConfiguration
,
"buildTargets"
).
toStringList
();
arguments
<<
m_makeStep
->
additionalArguments
(
m_buildConfiguration
);
m_summaryText
=
tr
(
"<b>Make:</b> %1 %2"
)
.
arg
(
m_makeStep
->
project
()
->
toolChain
(
m_buildConfiguration
)
->
makeCommand
(),
.
arg
(
m_makeStep
->
project
()
->
toolChain
(
m_makeStep
->
project
()
->
buildConfiguration
(
m_buildConfiguration
))
->
makeCommand
(),
arguments
.
join
(
" "
));
emit
updateSummary
();
}
...
...
src/plugins/genericprojectmanager/genericmakestep.cpp
View file @
acbd4513
...
...
@@ -56,23 +56,24 @@ GenericMakeStep::~GenericMakeStep()
{
}
bool
GenericMakeStep
::
init
(
const
QString
&
buildConfiguration
)
bool
GenericMakeStep
::
init
(
const
QString
&
buildConfiguration
Name
)
{
const
QString
buildParser
=
m_pro
->
buildParser
(
buildConfiguration
);
ProjectExplorer
::
BuildConfiguration
*
bc
=
m_pro
->
buildConfiguration
(
buildConfigurationName
);
const
QString
buildParser
=
m_pro
->
buildParser
(
bc
);
setBuildParser
(
buildParser
);
qDebug
()
<<
"*** build parser:"
<<
buildParser
;
setEnabled
(
buildConfiguration
,
true
);
setEnabled
(
buildConfiguration
Name
,
true
);
Core
::
VariableManager
*
vm
=
Core
::
VariableManager
::
instance
();
const
QString
rawBuildDir
=
m_pro
->
buildDirectory
(
b
uildConfiguration
);
const
QString
rawBuildDir
=
m_pro
->
buildDirectory
(
b
c
);
const
QString
buildDir
=
vm
->
resolve
(
rawBuildDir
);
setWorkingDirectory
(
buildConfiguration
,
buildDir
);
setWorkingDirectory
(
buildConfiguration
Name
,
buildDir
);
setCommand
(
buildConfiguration
,
makeCommand
(
buildConfiguration
));
setArguments
(
buildConfiguration
,
replacedArguments
(
buildConfiguration
));
setCommand
(
buildConfiguration
Name
,
makeCommand
(
buildConfiguration
Name
));
setArguments
(
buildConfiguration
Name
,
replacedArguments
(
buildConfiguration
Name
));
setEnvironment
(
buildConfiguration
,
m_pro
->
environment
(
b
uildConfiguration
));
return
AbstractMakeStep
::
init
(
buildConfiguration
);
setEnvironment
(
buildConfiguration
Name
,
m_pro
->
environment
(
b
c
));
return
AbstractMakeStep
::
init
(
buildConfiguration
Name
);
}