Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
04805e0a
Commit
04805e0a
authored
16 years ago
by
dt
Browse files
Options
Downloads
Patches
Plain Diff
Fixes: Use the toolchain classes int the cmake plugin.
Details: We now get the system includes and system defines.
parent
15e2ac46
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/cmakeprojectmanager/cmakeproject.cpp
+50
-4
50 additions, 4 deletions
src/plugins/cmakeprojectmanager/cmakeproject.cpp
src/plugins/cmakeprojectmanager/cmakeproject.h
+4
-0
4 additions, 0 deletions
src/plugins/cmakeprojectmanager/cmakeproject.h
with
54 additions
and
4 deletions
src/plugins/cmakeprojectmanager/cmakeproject.cpp
+
50
−
4
View file @
04805e0a
...
@@ -67,7 +67,10 @@ using namespace CMakeProjectManager::Internal;
...
@@ -67,7 +67,10 @@ using namespace CMakeProjectManager::Internal;
CMakeProject
::
CMakeProject
(
CMakeManager
*
manager
,
const
QString
&
fileName
)
CMakeProject
::
CMakeProject
(
CMakeManager
*
manager
,
const
QString
&
fileName
)
:
m_manager
(
manager
),
m_fileName
(
fileName
),
m_rootNode
(
new
CMakeProjectNode
(
m_fileName
))
:
m_manager
(
manager
),
m_fileName
(
fileName
),
m_rootNode
(
new
CMakeProjectNode
(
m_fileName
)),
m_toolChain
(
0
)
{
{
m_file
=
new
CMakeFile
(
this
,
fileName
);
m_file
=
new
CMakeFile
(
this
,
fileName
);
}
}
...
@@ -75,12 +78,14 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
...
@@ -75,12 +78,14 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
CMakeProject
::~
CMakeProject
()
CMakeProject
::~
CMakeProject
()
{
{
delete
m_rootNode
;
delete
m_rootNode
;
delete
m_toolChain
;
}
}
// TODO also call this method if the CMakeLists.txt file changed, which is also called if the CMakeList.txt is updated
// TODO also call this method if the CMakeLists.txt file changed, which is also called if the CMakeList.txt is updated
// TODO make this function work even if it is reparsing
// TODO make this function work even if it is reparsing
void
CMakeProject
::
parseCMakeLists
()
void
CMakeProject
::
parseCMakeLists
()
{
{
ProjectExplorer
::
ToolChain
*
newToolChain
=
0
;
QString
sourceDirectory
=
QFileInfo
(
m_fileName
).
absolutePath
();
QString
sourceDirectory
=
QFileInfo
(
m_fileName
).
absolutePath
();
m_manager
->
createXmlFile
(
cmakeStep
()
->
userArguments
(
activeBuildConfiguration
()),
sourceDirectory
,
buildDirectory
(
activeBuildConfiguration
()));
m_manager
->
createXmlFile
(
cmakeStep
()
->
userArguments
(
activeBuildConfiguration
()),
sourceDirectory
,
buildDirectory
(
activeBuildConfiguration
()));
...
@@ -88,6 +93,24 @@ void CMakeProject::parseCMakeLists()
...
@@ -88,6 +93,24 @@ void CMakeProject::parseCMakeLists()
CMakeCbpParser
cbpparser
;
CMakeCbpParser
cbpparser
;
qDebug
()
<<
"Parsing file "
<<
cbpFile
;
qDebug
()
<<
"Parsing file "
<<
cbpFile
;
if
(
cbpparser
.
parseCbpFile
(
cbpFile
))
{
if
(
cbpparser
.
parseCbpFile
(
cbpFile
))
{
qDebug
()
<<
"CodeBlocks Compilername"
<<
cbpparser
.
compilerName
();
if
(
cbpparser
.
compilerName
()
==
"gcc"
)
{
newToolChain
=
ProjectExplorer
::
ToolChain
::
createGccToolChain
(
"gcc"
);
}
else
if
(
cbpparser
.
compilerName
()
==
"msvc8"
)
{
// TODO hmm
//newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain("//TODO");
Q_ASSERT
(
false
);
}
else
{
// TODO hmm?
}
if
(
newToolChain
==
m_toolChain
)
{
delete
newToolChain
;
newToolChain
=
0
;
}
else
{
delete
m_toolChain
;
m_toolChain
=
newToolChain
;
}
m_projectName
=
cbpparser
.
projectName
();
m_projectName
=
cbpparser
.
projectName
();
qDebug
()
<<
"Building Tree"
;
qDebug
()
<<
"Building Tree"
;
// TODO do a intelligent updating of the tree
// TODO do a intelligent updating of the tree
...
@@ -107,18 +130,31 @@ void CMakeProject::parseCMakeLists()
...
@@ -107,18 +130,31 @@ void CMakeProject::parseCMakeLists()
}
}
qDebug
()
<<
"Updating CodeModel"
;
qDebug
()
<<
"Updating CodeModel"
;
QStringList
allIncludePaths
;
QStringList
allFrameworkPaths
;
QList
<
ProjectExplorer
::
HeaderPath
>
allHeaderPaths
=
m_toolChain
->
systemHeaderPaths
();
foreach
(
ProjectExplorer
::
HeaderPath
headerPath
,
allHeaderPaths
)
{
if
(
headerPath
.
kind
()
==
ProjectExplorer
::
HeaderPath
::
FrameworkHeaderPath
)
allFrameworkPaths
.
append
(
headerPath
.
path
());
else
allIncludePaths
.
append
(
headerPath
.
path
());
}
allIncludePaths
.
append
(
cbpparser
.
includeFiles
());
CppTools
::
CppModelManagerInterface
*
modelmanager
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
CppTools
::
CppModelManagerInterface
>
();
CppTools
::
CppModelManagerInterface
*
modelmanager
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
CppTools
::
CppModelManagerInterface
>
();
if
(
modelmanager
)
{
if
(
modelmanager
)
{
CppTools
::
CppModelManagerInterface
::
ProjectInfo
pinfo
=
modelmanager
->
projectInfo
(
this
);
CppTools
::
CppModelManagerInterface
::
ProjectInfo
pinfo
=
modelmanager
->
projectInfo
(
this
);
pinfo
.
includePaths
=
cbpparser
.
includeFiles
()
;
pinfo
.
includePaths
=
allIncludePaths
;
// TODO we only want C++ files, not all other stuff that might be in the project
// TODO we only want C++ files, not all other stuff that might be in the project
pinfo
.
sourceFiles
=
m_files
;
pinfo
.
sourceFiles
=
m_files
;
// TODO defines
pinfo
.
defines
=
m_toolChain
->
predefinedMacros
();
// TODO gcc preprocessor files
pinfo
.
frameworkPaths
=
allFrameworkPaths
;
modelmanager
->
updateProjectInfo
(
pinfo
);
modelmanager
->
updateProjectInfo
(
pinfo
);
}
}
}
else
{
}
else
{
// TODO report error
// TODO report error
delete
m_toolChain
;
m_toolChain
=
0
;
}
}
}
}
...
@@ -188,6 +224,8 @@ QString CMakeProject::name() const
...
@@ -188,6 +224,8 @@ QString CMakeProject::name() const
return
m_projectName
;
return
m_projectName
;
}
}
Core
::
IFile
*
CMakeProject
::
file
()
const
Core
::
IFile
*
CMakeProject
::
file
()
const
{
{
return
m_file
;
return
m_file
;
...
@@ -546,6 +584,9 @@ void CMakeCbpParser::parseOption()
...
@@ -546,6 +584,9 @@ void CMakeCbpParser::parseOption()
if
(
attributes
().
hasAttribute
(
"title"
))
if
(
attributes
().
hasAttribute
(
"title"
))
m_projectName
=
attributes
().
value
(
"title"
).
toString
();
m_projectName
=
attributes
().
value
(
"title"
).
toString
();
if
(
attributes
().
hasAttribute
(
"compiler"
))
m_compiler
=
attributes
().
value
(
"compiler"
).
toString
();
while
(
!
atEnd
())
{
while
(
!
atEnd
())
{
readNext
();
readNext
();
if
(
isEndElement
())
{
if
(
isEndElement
())
{
...
@@ -673,6 +714,11 @@ QList<CMakeTarget> CMakeCbpParser::targets()
...
@@ -673,6 +714,11 @@ QList<CMakeTarget> CMakeCbpParser::targets()
return
m_targets
;
return
m_targets
;
}
}
QString
CMakeCbpParser
::
compilerName
()
const
{
return
m_compiler
;
}
void
CMakeTarget
::
clear
()
void
CMakeTarget
::
clear
()
{
{
executable
=
QString
::
null
;
executable
=
QString
::
null
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/cmakeprojectmanager/cmakeproject.h
+
4
−
0
View file @
04805e0a
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include
<projectexplorer/project.h>
#include
<projectexplorer/project.h>
#include
<projectexplorer/projectnodes.h>
#include
<projectexplorer/projectnodes.h>
#include
<projectexplorer/buildstep.h>
#include
<projectexplorer/buildstep.h>
#include
<projectexplorer/toolchain.h>
#include
<coreplugin/ifile.h>
#include
<coreplugin/ifile.h>
#include
<utils/pathchooser.h>
#include
<utils/pathchooser.h>
...
@@ -122,6 +123,7 @@ private:
...
@@ -122,6 +123,7 @@ private:
CMakeProjectNode
*
m_rootNode
;
CMakeProjectNode
*
m_rootNode
;
QStringList
m_files
;
QStringList
m_files
;
QList
<
CMakeTarget
>
m_targets
;
QList
<
CMakeTarget
>
m_targets
;
ProjectExplorer
::
ToolChain
*
m_toolChain
;
protected:
protected:
virtual
void
saveSettingsImpl
(
ProjectExplorer
::
PersistentSettingsWriter
&
writer
);
virtual
void
saveSettingsImpl
(
ProjectExplorer
::
PersistentSettingsWriter
&
writer
);
...
@@ -137,6 +139,7 @@ public:
...
@@ -137,6 +139,7 @@ public:
QStringList
includeFiles
();
QStringList
includeFiles
();
QList
<
CMakeTarget
>
targets
();
QList
<
CMakeTarget
>
targets
();
QString
projectName
()
const
;
QString
projectName
()
const
;
QString
compilerName
()
const
;
private:
private:
void
parseCodeBlocks_project_file
();
void
parseCodeBlocks_project_file
();
void
parseProject
();
void
parseProject
();
...
@@ -159,6 +162,7 @@ private:
...
@@ -159,6 +162,7 @@ private:
bool
m_targetType
;
bool
m_targetType
;
QList
<
CMakeTarget
>
m_targets
;
QList
<
CMakeTarget
>
m_targets
;
QString
m_projectName
;
QString
m_projectName
;
QString
m_compiler
;
};
};
class
CMakeFile
:
public
Core
::
IFile
class
CMakeFile
:
public
Core
::
IFile
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment