[Qt-creator] CMake and Include Files
Mike Jackson
imikejackson at gmail.com
Tue Jul 14 19:15:05 CEST 2009
At some point Creator would actually generate a KDevelop project file
from your cmake based project by actually invoking CMake from creator.
This created an XML based file that Creator would then parse to gain
information about what/where to build things. This was slow and error
prone and tended to be missing information. There was a discussion on
the IRC channel that basically said there needs to be a "QtCreator"
option for CMake. CMake would then generate an XML File that has all
the information that QtCreator would need to create a project. It was
stated in the same IRC conversation that the only thing closest to what
was needed was the Visual studio project/solution files (since they are
XML). Using the Visual Studio Generator as a starting point for
creating a "QtCreator Generator" was then born. Of course once you have
cmake generating some XML files then you need QtCreator to be able to
parse the information contained in them.
So to get started you would need to do the following:
Pull the Latest CVS version of CMake.
Study the code to figure out what needs to be done to create a new generator.
Write the new generator for QtCreator (or append to the KDevelop one).
Test said generator on a project.
Clone the latest version of QtCreator.
Find where the parsing of the XML files is happening
Add code to parse more detailed information from the new xml files that
were generated earlier.
Compile QtCreator
Test it out with the new project xml files that were generated with
CMake from above.
There is also the idea to have CMake generate .pro files but this was
quickly passed off as being too labor intensive/difficult to create.
Of course the third option would be for Qt to drop qmake and go with
CMake instead ;-)
Mike Jackson
On 2009-07-13 22:40:50 -0400, James <agnosticpope at gmail.com> said:
>
> The idea of creating a new CMake parsers sounds interesting, but how would
> that work exactly? Part of the problem is that include files aren't
> contained in the CMake files, so you're still left, at some level, with
> parsing the actual c++ files or just adding everything ending in .h.
>
> How does visual studio xml work with CMake? I took a look, but couldn't
> find a single header file mentioned in anything...perhaps I'm looking in the
> wrong place (I'm not terribly familiar with VS though).
>
> --James
>
> On Fri, Jul 10, 2009 at 8:28 AM, Mike Jackson <imikejackson at gmail.com>wrote:
>
>> I tried Creator with CMake but there was _too_ much that I still had to
>> do on my own for each project to get things to work.
>> I know that several ideas had been discussed (mainly in the irc
>> channel) like creating a new generator for CMake that would produce xml
>> files that had all the needed information. I don't think this is going
>> anywhere as it really needs someone with the time to jump into the
>> catch-22 loop and start coding it up, both in CMake and in Creator.
>>
>> You need CMake to generate a QtCreator readable XML file. And you
>> need Creator to be able to parse it. I think after that a lot of the
>> issues with code completion would be mitigated as all the proper
>> include directories would be listed in the xml file that cmake produced.
>>
>> The Visual Studio XML files are pretty close to what is needed as
>> they have the most information. So starting with a clone of the Visual
>> Studio CMake Generator code might be a good start.
>>
>> Just my thoughts..
>>
>> Mike Jackson
>>
>> On 2009-07-07 22:28:33 -0400, James <agnosticpope at gmail.com> said:
>>
>>>
>>> Since I've been using Creator (1.0), cmake support has gotten much
>> better.
>>>
>>> Unfortunately, unless there's some step I'm missing, it still doesn't
>> parse
>>> files for autocompletion information. Additionally, since CMake files
>> don't
>>> necessarily include all the headers, the project tree itself may not even
>> be
>>> complete.
>>>
>>> While I've been using it, I was maintaining a small modification that
>> looked
>>> for a foo.h whenever parsing a foo.c++ (and if found added it) and also
>> used
>>> the file extension to sort the headers from the source files.
>>> Unfortunately, things started behaving strangely this Monday as I think
>> the
>>> most recent mod broke my change;)
>>>
>>> I'm not wholly happy with my solution, and I'd be more than happy to help
>> or
>>> write a proper solution to better accommodate CMake. IMHO, there's two
>>> issues: adding all headers properly and properly catagorizing the files
>> so
>>> that they can be parsed. There's various ways of doing this, none of
>> which
>>> are very good. There's my current solution, which misses files. It'd
>> also
>>> be possible to parse every source file and look for includes, maybe with
>>> some assumption about having them at the beginning, but probably would be
>>> very slow. A third would be to just look in every directory parsed for
>>> header files, which, again, may get stuff that's unused.
>>>
>>> What are the community/trolltech's thoughts on this? Or am I the only
>> one
>>> who uses Creator with CMake;)
>>>
>>> --James
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>>
>
>
> The idea of creating a new CMake parsers sounds interesting, but how would =
> that work exactly?=A0 Part of the problem is that include files aren't =
> contained in the CMake files, so you're still left, at some level, with=
> parsing the actual c++ files or just adding everything ending in .h.<br>
> <br>How does visual studio xml work with CMake?=A0 I took a look, but could=
> n't find a single header file mentioned in anything...perhaps I'm l=
> ooking in the wrong place (I'm not terribly familiar with VS though).<b=
> r>
> <br>--James<br><br><div class=3D"gmail_quote">On Fri, Jul 10, 2009 at 8:28 =
> AM, Mike Jackson <span dir=3D"ltr"><<a href=3D"mailto:imikejackson at gmail=
> .com">imikejackson at gmail.com</a>></span> wrote:<br><blockquote class=3D"=
> gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0p=
> t 0pt 0pt 0.8ex; padding-left: 1ex;">
> I tried Creator with CMake but there was _too_ much that I still had to<br>
> do on my own for each project to get things to work.<br>
> =A0I know that several ideas had been discussed (mainly in the irc<br>
> channel) like creating a new generator for CMake that would produce xml<br>
> files that had all the needed information. I don't think this is going<=
> br>
> anywhere as it really needs someone with the time to jump into the<br>
> catch-22 loop and start coding it up, both in CMake and in Creator.<br>
> <br>
> =A0You need CMake to generate a QtCreator readable XML file. And you<br>
> need Creator to be able to parse it. I think after that a lot of the<br>
> issues with code completion would be mitigated as all the proper<br>
> include directories would be listed in the xml file that cmake produced.<br=
>>
> <br>
> =A0The Visual Studio XML files are pretty close to what is needed as<br>
> they have the most information. So starting with a clone of the Visual<br>
> Studio CMake Generator code might be a good start.<br>
> <br>
> =A0Just my thoughts..<br>
> <br>
> Mike Jackson<br>
> <div><div></div><div class=3D"h5"><br>
> On 2009-07-07 22:28:33 -0400, James <<a href=3D"mailto:agnosticpope at gmai=
> l.com">agnosticpope at gmail.com</a>> said:<br>
> <br>
> ><br>
> > Since I've been using Creator (1.0), cmake support has gotten much=
> better.<br>
> ><br>
> > Unfortunately, unless there's some step I'm missing, it still =
> doesn't parse<br>
> > files for autocompletion information. =A0Additionally, since CMake fil=
> es don't<br>
> > necessarily include all the headers, the project tree itself may not e=
> ven be<br>
> > complete.<br>
> ><br>
> > While I've been using it, I was maintaining a small modification t=
> hat looked<br>
> > for a foo.h whenever parsing a foo.c++ (and if found added it) and als=
> o used<br>
> > the file extension to sort the headers from the source files.<br>
> > Unfortunately, things started behaving strangely this Monday as I thin=
> k the<br>
> > most recent mod broke my change;)<br>
> ><br>
> > I'm not wholly happy with my solution, and I'd be more than ha=
> ppy to help or<br>
> > write a proper solution to better accommodate CMake. =A0IMHO, there=
> 9;s two<br>
> > issues: adding all headers properly and properly catagorizing the file=
> s so<br>
> > that they can be parsed. =A0There's various ways of doing this, no=
> ne of which<br>
> > are very good. =A0There's my current solution, which misses files.=
> =A0It'd also<br>
> > be possible to parse every source file and look for includes, maybe wi=
> th<br>
> > some assumption about having them at the beginning, but probably would=
> be<br>
> > very slow. =A0A third would be to just look in every directory parsed =
> for<br>
> > header files, which, again, may get stuff that's unused.<br>
> ><br>
> > What are the community/trolltech's thoughts on this? =A0Or am I th=
> e only one<br>
> > who uses Creator with CMake;)<br>
> ><br>
> > --James<br>
> <br>
> </div></div>_______________________________________________<br>
> Qt-creator mailing list<br>
> <a href=3D"mailto:Qt-creator at trolltech.com">Qt-creator at trolltech.com</a><br=
>>
> <a href=3D"http://lists.trolltech.com/mailman/listinfo/qt-creator" target=
> =3D"_blank">http://lists.trolltech.com/mailman/listinfo/qt-creator</a><br>
> </blockquote></div><br>
More information about the Qt-creator-old
mailing list