Skip to content
GitLab
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
6e01bf60
Commit
6e01bf60
authored
Nov 26, 2009
by
dt
Browse files
Move extractSpec and removeSpec to Qt4BuildConfiguration
parent
fb1ef427
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/projectloadwizard.cpp
View file @
6e01bf60
...
...
@@ -33,6 +33,7 @@
#include
"qt4projectmanager.h"
#include
"qmakestep.h"
#include
"makestep.h"
#include
"qt4buildconfiguration.h"
#include
<extensionsystem/pluginmanager.h>
...
...
@@ -66,9 +67,9 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
QPair
<
QtVersion
::
QmakeBuildConfigs
,
QStringList
>
result
=
QtVersionManager
::
scanMakeFile
(
directory
,
m_importVersion
->
defaultBuildConfig
());
m_importBuildConfig
=
result
.
first
;
m_additionalArguments
=
Qt4
Project
::
removeSpecFromArgumentList
(
result
.
second
);
m_additionalArguments
=
Qt4
BuildConfiguration
::
removeSpecFromArgumentList
(
result
.
second
);
QString
parsedSpec
=
Qt4
Project
::
extractSpecFromArgumentList
(
result
.
second
,
directory
,
m_importVersion
);
QString
parsedSpec
=
Qt4
BuildConfiguration
::
extractSpecFromArgumentList
(
result
.
second
,
directory
,
m_importVersion
);
QString
versionSpec
=
m_importVersion
->
mkspec
();
// Compare mkspecs and add to additional arguments
...
...
src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
View file @
6e01bf60
...
...
@@ -284,16 +284,16 @@ bool Qt4BuildConfiguration::compareBuildConfigurationToImportFrom(const QString
// now compare arguments lists
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString
actualSpec
=
Qt4Project
::
extractSpecFromArgumentList
(
qs
->
qmakeArguments
(),
workingDirectory
,
version
);
QString
actualSpec
=
extractSpecFromArgumentList
(
qs
->
qmakeArguments
(),
workingDirectory
,
version
);
if
(
actualSpec
.
isEmpty
())
{
// Easy one the user has choosen not to override the settings
actualSpec
=
version
->
mkspec
();
}
QString
parsedSpec
=
Qt4Project
::
extractSpecFromArgumentList
(
result
.
second
,
workingDirectory
,
version
);
QStringList
actualArgs
=
Qt4Project
::
removeSpecFromArgumentList
(
qs
->
qmakeArguments
());
QStringList
parsedArgs
=
Qt4Project
::
removeSpecFromArgumentList
(
result
.
second
);
QString
parsedSpec
=
extractSpecFromArgumentList
(
result
.
second
,
workingDirectory
,
version
);
QStringList
actualArgs
=
removeSpecFromArgumentList
(
qs
->
qmakeArguments
());
QStringList
parsedArgs
=
removeSpecFromArgumentList
(
result
.
second
);
if
(
debug
)
{
qDebug
()
<<
"Actual args:"
<<
actualArgs
;
...
...
@@ -317,3 +317,88 @@ bool Qt4BuildConfiguration::compareBuildConfigurationToImportFrom(const QString
}
return
false
;
}
// We match -spec and -platfrom separetly
// We ignore -cache, because qmake contained a bug that it didn't
// mention the -cache in the Makefile
// That means changing the -cache option in the additional arguments
// does not automatically rerun qmake. Alas, we could try more
// intelligent matching for -cache, but i guess people rarely
// do use that.
QStringList
Qt4BuildConfiguration
::
removeSpecFromArgumentList
(
const
QStringList
&
old
)
{
if
(
!
old
.
contains
(
"-spec"
)
&&
!
old
.
contains
(
"-platform"
)
&&
!
old
.
contains
(
"-cache"
))
return
old
;
QStringList
newList
;
bool
ignoreNext
=
false
;
foreach
(
const
QString
&
item
,
old
)
{
if
(
ignoreNext
)
{
ignoreNext
=
false
;
}
else
if
(
item
==
"-spec"
||
item
==
"-platform"
||
item
==
"-cache"
)
{
ignoreNext
=
true
;
}
else
{
newList
<<
item
;
}
}
return
newList
;
}
QString
Qt4BuildConfiguration
::
extractSpecFromArgumentList
(
const
QStringList
&
list
,
QString
directory
,
QtVersion
*
version
)
{
int
index
=
list
.
indexOf
(
"-spec"
);
if
(
index
==
-
1
)
index
=
list
.
indexOf
(
"-platform"
);
if
(
index
==
-
1
)
return
QString
();
++
index
;
if
(
index
>=
list
.
length
())
return
QString
();
QString
baseMkspecDir
=
version
->
versionInfo
().
value
(
"QMAKE_MKSPECS"
);
if
(
baseMkspecDir
.
isEmpty
())
baseMkspecDir
=
version
->
versionInfo
().
value
(
"QT_INSTALL_DATA"
)
+
"/mkspecs"
;
QString
parsedSpec
=
QDir
::
cleanPath
(
list
.
at
(
index
));
#ifdef Q_OS_WIN
baseMkspecDir
=
baseMkspecDir
.
toLower
();
parsedSpec
=
parsedSpec
.
toLower
();
#endif
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
// or relatively to the mkspec directory
// if it is the former we need to get the canonical form
// for the other one we don't need to do anything
if
(
QFileInfo
(
parsedSpec
).
isRelative
())
{
if
(
QFileInfo
(
directory
+
"/"
+
parsedSpec
).
exists
())
{
parsedSpec
=
QDir
::
cleanPath
(
directory
+
"/"
+
parsedSpec
);
#ifdef Q_OS_WIN
parsedSpec
=
parsedSpec
.
toLower
();
#endif
}
else
{
parsedSpec
=
baseMkspecDir
+
"/"
+
parsedSpec
;
}
}
QFileInfo
f2
(
parsedSpec
);
while
(
f2
.
isSymLink
())
{
parsedSpec
=
f2
.
symLinkTarget
();
f2
.
setFile
(
parsedSpec
);
}
if
(
parsedSpec
.
startsWith
(
baseMkspecDir
))
{
parsedSpec
=
parsedSpec
.
mid
(
baseMkspecDir
.
length
()
+
1
);
}
else
{
QString
sourceMkSpecPath
=
version
->
sourcePath
()
+
"/mkspecs"
;
if
(
parsedSpec
.
startsWith
(
sourceMkSpecPath
))
{
parsedSpec
=
parsedSpec
.
mid
(
sourceMkSpecPath
.
length
()
+
1
);
}
}
#ifdef Q_OS_WIN
parsedSpec
=
parsedSpec
.
toLower
();
#endif
return
parsedSpec
;
}
src/plugins/qt4projectmanager/qt4buildconfiguration.h
View file @
6e01bf60
...
...
@@ -96,6 +96,8 @@ public:
// TODO rename
bool
compareBuildConfigurationToImportFrom
(
const
QString
&
workingDirectory
);
static
QStringList
removeSpecFromArgumentList
(
const
QStringList
&
old
);
static
QString
extractSpecFromArgumentList
(
const
QStringList
&
list
,
QString
directory
,
QtVersion
*
version
);
signals:
void
qtVersionChanged
();
...
...
src/plugins/qt4projectmanager/qt4project.cpp
View file @
6e01bf60
...
...
@@ -456,7 +456,7 @@ ProjectExplorer::IBuildConfigurationFactory *Qt4Project::buildConfigurationFacto
return
m_buildConfigurationFactory
;
}
Qt4BuildConfiguration
*
Qt4Project
::
addQt4BuildConfiguration
(
QString
buildConfiguration
Name
,
QtVersion
*
qtversion
,
Qt4BuildConfiguration
*
Qt4Project
::
addQt4BuildConfiguration
(
QString
display
Name
,
QtVersion
*
qtversion
,
QtVersion
::
QmakeBuildConfigs
qmakeBuildConfiguration
,
QStringList
additionalArguments
)
{
...
...
@@ -464,7 +464,7 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString buildConfigu
// Add the buildconfiguration
Qt4BuildConfiguration
*
bc
=
new
Qt4BuildConfiguration
(
this
);
bc
->
setDisplayName
(
buildConfiguration
Name
);
bc
->
setDisplayName
(
display
Name
);
addBuildConfiguration
(
bc
);
QMakeStep
*
qmakeStep
=
new
QMakeStep
(
bc
);
...
...
@@ -821,64 +821,7 @@ void Qt4Project::updateActiveRunConfiguration()
emit
targetInformationChanged
();
}
QString
Qt4Project
::
extractSpecFromArgumentList
(
const
QStringList
&
list
,
QString
directory
,
QtVersion
*
version
)
{
int
index
=
list
.
indexOf
(
"-spec"
);
if
(
index
==
-
1
)
index
=
list
.
indexOf
(
"-platform"
);
if
(
index
==
-
1
)
return
QString
();
++
index
;
if
(
index
>=
list
.
length
())
return
QString
();
QString
baseMkspecDir
=
version
->
versionInfo
().
value
(
"QMAKE_MKSPECS"
);
if
(
baseMkspecDir
.
isEmpty
())
baseMkspecDir
=
version
->
versionInfo
().
value
(
"QT_INSTALL_DATA"
)
+
"/mkspecs"
;
QString
parsedSpec
=
QDir
::
cleanPath
(
list
.
at
(
index
));
#ifdef Q_OS_WIN
baseMkspecDir
=
baseMkspecDir
.
toLower
();
parsedSpec
=
parsedSpec
.
toLower
();
#endif
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
// or relatively to the mkspec directory
// if it is the former we need to get the canonical form
// for the other one we don't need to do anything
if
(
QFileInfo
(
parsedSpec
).
isRelative
())
{
if
(
QFileInfo
(
directory
+
"/"
+
parsedSpec
).
exists
())
{
parsedSpec
=
QDir
::
cleanPath
(
directory
+
"/"
+
parsedSpec
);
#ifdef Q_OS_WIN
parsedSpec
=
parsedSpec
.
toLower
();
#endif
}
else
{
parsedSpec
=
baseMkspecDir
+
"/"
+
parsedSpec
;
}
}
QFileInfo
f2
(
parsedSpec
);
while
(
f2
.
isSymLink
())
{
parsedSpec
=
f2
.
symLinkTarget
();
f2
.
setFile
(
parsedSpec
);
}
if
(
parsedSpec
.
startsWith
(
baseMkspecDir
))
{
parsedSpec
=
parsedSpec
.
mid
(
baseMkspecDir
.
length
()
+
1
);
}
else
{
QString
sourceMkSpecPath
=
version
->
sourcePath
()
+
"/mkspecs"
;
if
(
parsedSpec
.
startsWith
(
sourceMkSpecPath
))
{
parsedSpec
=
parsedSpec
.
mid
(
sourceMkSpecPath
.
length
()
+
1
);
}
}
#ifdef Q_OS_WIN
parsedSpec
=
parsedSpec
.
toLower
();
#endif
return
parsedSpec
;
}
BuildConfigWidget
*
Qt4Project
::
createConfigWidget
()
{
...
...
@@ -1048,33 +991,6 @@ void Qt4Project::invalidateCachedTargetInformation()
emit
targetInformationChanged
();
}
// We match -spec and -platfrom separetly
// We ignore -cache, because qmake contained a bug that it didn't
// mention the -cache in the Makefile
// That means changing the -cache option in the additional arguments
// does not automatically rerun qmake. Alas, we could try more
// intelligent matching for -cache, but i guess people rarely
// do use that.
QStringList
Qt4Project
::
removeSpecFromArgumentList
(
const
QStringList
&
old
)
{
if
(
!
old
.
contains
(
"-spec"
)
&&
!
old
.
contains
(
"-platform"
)
&&
!
old
.
contains
(
"-cache"
))
return
old
;
QStringList
newList
;
bool
ignoreNext
=
false
;
foreach
(
const
QString
&
item
,
old
)
{
if
(
ignoreNext
)
{
ignoreNext
=
false
;
}
else
if
(
item
==
"-spec"
||
item
==
"-platform"
||
item
==
"-cache"
)
{
ignoreNext
=
true
;
}
else
{
newList
<<
item
;
}
}
return
newList
;
}
/*!
Handle special case were a subproject of the qt directory is opened, and
qt was configured to be built as a shadow build -> also build in the sub-
...
...
src/plugins/qt4projectmanager/qt4project.h
View file @
6e01bf60
...
...
@@ -166,7 +166,7 @@ public:
Qt4Manager
*
qt4ProjectManager
()
const
;
ProjectExplorer
::
IBuildConfigurationFactory
*
buildConfigurationFactory
()
const
;
Internal
::
Qt4BuildConfiguration
*
addQt4BuildConfiguration
(
QString
buildConfiguration
Name
,
Internal
::
Qt4BuildConfiguration
*
addQt4BuildConfiguration
(
QString
display
Name
,
QtVersion
*
qtversion
,
QtVersion
::
QmakeBuildConfigs
qmakeBuildConfiguration
,
QStringList
additionalArguments
=
QStringList
());
...
...
@@ -201,9 +201,6 @@ public:
virtual
QStringList
includePaths
(
const
QString
&
fileName
)
const
;
virtual
QStringList
frameworkPaths
(
const
QString
&
fileName
)
const
;
static
QStringList
removeSpecFromArgumentList
(
const
QStringList
&
old
);
static
QString
extractSpecFromArgumentList
(
const
QStringList
&
list
,
QString
directory
,
QtVersion
*
version
);
// TODO can i remove this?
void
updateActiveRunConfiguration
();
signals:
...
...
src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
View file @
6e01bf60
...
...
@@ -283,8 +283,8 @@ void Qt4ProjectConfigWidget::importLabelClicked()
QPair
<
QtVersion
::
QmakeBuildConfigs
,
QStringList
>
result
=
QtVersionManager
::
scanMakeFile
(
directory
,
version
->
defaultBuildConfig
());
QtVersion
::
QmakeBuildConfigs
qmakeBuildConfig
=
result
.
first
;
QStringList
additionalArguments
=
Qt4
Project
::
removeSpecFromArgumentList
(
result
.
second
);
QString
parsedSpec
=
Qt4
Project
::
extractSpecFromArgumentList
(
result
.
second
,
directory
,
version
);
QStringList
additionalArguments
=
Qt4
BuildConfiguration
::
removeSpecFromArgumentList
(
result
.
second
);
QString
parsedSpec
=
Qt4
BuildConfiguration
::
extractSpecFromArgumentList
(
result
.
second
,
directory
,
version
);
QString
versionSpec
=
version
->
mkspec
();
if
(
parsedSpec
.
isEmpty
()
||
parsedSpec
==
versionSpec
||
parsedSpec
==
"default"
)
{
// using the default spec, don't modify additional arguments
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment