[Qt-creator] Generating .pro file from a Makefile?

Bryce Schober bryce.schober at gmail.com
Fri Mar 16 18:00:36 CET 2012


I see that others are sharing the same kind of pain as I am. The solution
that I have arrived at so far is to use a generic project, and update the
.files list at the end of my build using a script.

This process isn't anywhere near perfect, but it does allow you to:
1. Maintain the project files mostly by maintaining the source modules in
the makefile only.
2. Have the project files get automatically added to the project, but only
after a successful build and triggering Qt Creator to re-read the .files
file (which you can do be either re-loading the project, or doing a trivial
edit to the .files file).
3. Have the relevant source headers added to the project.

I've paste-binned the script (http://pastebin.com/iMk8Y5jP) and it's
accompanying .sed recipe (http://pastebin.com/0XqGeKX4).

These will only be useful to you, if your makefile does auto-dependency
generation, as in http://mad-scientist.net/make/autodep.html or similar.
This whole script depends on parsing the dependency files to update the
project.files file. You'll probably have to edit the script around lines
31-38, to point it to the right place to get auto-dependency files.

You run the script in the project directory, with a single argument of the
project name (if you have a myproject.files file, the name is "myproject").
You can either add the running of the script to your project build options,
or to the end of your make target's commands.

Your project.files file can contain both manually added files and
automagically-added files. To add "manual" files to your project that
aren't a result of the auto-dependencies search, put them at the top of
your project.files file, with at least two empty lines between them and the
auto-dependencies results. This means that if you manually add project
files via the Qt Creator gui, they'll be lost the next time you run the
script.

This script was developed in our own environment, and I'm not sure how many
assumptions unique to it have been made, so YMMV, caveat emptor, etc...

<><  <><  <><
Bryce Schober



On Thu, Mar 15, 2012 at 3:28 PM, Cristian Tibirna <tibirna at kde.org> wrote:

> On Thursday 15 March 2012 22:19:43 Mathias Hasselmann wrote:
> > Excuse my ignorance if this option was discussed and dismissed already,
> > or if just entirely miss the point...
> >
> > But how about choosing "Import Project" -> "Import Existing Project"
> > from the project wizard? Sure, adding and removing files in such an
> > imported Makefile project is painful, so in the long run you might want
> > to convert the project. But for getting started, for understanding the
> > project structure, for finishing some initial tasks, this approach
> > should be good enough.
>
> And this is what we do at my work. We "Import(ed) Existing project", so
> that
> the make commands are available for free (and this gives us priceless
> compiling error parsing towards the "Issues" pane). And we just added a
> target
> (called qtcreator_config) to our makefile that generates "manually" (by
> some
> nicely crafted grep(1)s and find(1)s) the myproject.files and
> myproject.includes files (we even add library includes to the .includes
> file).
>
> And with the latest qtcreator (master?), each time we add/remove a file to
> the
> project we just
>
> make qtcreator_config
>
> and QtCreator automatically rereads the thusly refreshed .files and
> .includes.
> Pure joy .
>
> Hope this helps
>
> --
> Cristian Tibirna
> KDE developer .. tibirna at kde.org .. http://www.kde.org
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20120316/1b66fea0/attachment.html>


More information about the Qt-creator mailing list