05 August, 2011

Autotools Project Manager, part 2: The Plugin.

During the last past weeks, as I already announced and as part of my trainee program at Openismus GmbH, I have been working on a plugin for autotools support to be used with Qt Creator. The project is still in an early state of development, but already offers some nice features and is ready for its first release.



What can the plugin do?
  • Load an autotools project and work with it in QTC.
  • Syntax highlighting for Makefile.am files.
  • Automatic project tree update if the Makefile.am or configure.ac file is changed.
  • Configuration of build steps (autogen, autoreconf, make and configure).
  • Build and run an autotools project from within QTC.
  • Automatic code completion.
Some ideas for the future:
  • Add syntax highlighting for the configure.ac file.
  • Detect whether autogen.sh runs configure, and allow the user to configure that, to avoid a second configure run.
  • Improve the parser. Autotools can generate several/different types of binares, libraries or other kind of targets. The current parser, checks for bin_PROGRAM binaries. If the output produces one of them, the parsing will be successful, if there are more, the parsing will not be successful. This should be changed to a more *Anjuta like* Makefile.am parsing style, which takes into account the existence of multiple outputs among other complex things. In the meantime, and as a suggestion of the Qt Creator's developers, I am using a ProjectExplorer::CustomExecutableRunConfiguration, which allows the user to choose which executable he/she wants to run, in case there is any.
How to use the plugin:
  • Download the project from gitorious.
  • Follow the README file for installation instructions.
  • See that the plugin is recognized and loaded by Qt-Creator, by selecting Help -> About Plugins in QTC. The AutotoolsProjectManager plugin should be listed as part of the Build System plugins.
  • Open an autotools project in Qt-Creator, using File -> Open File or Project... In the prompted dialog-box, select the Makefile.am from your project. This is the only way a user can use the autotools plugin. Thus, a Makefile.am must always exist before hand. 
  • The first time an autotools project is opened with Qt-Creator, a dialog-box pops up and the user will be able to select the build directory. Qt-Creator then puts a .user file in the directory so it doesn't need to ask again. Only in-source building is working right now.
  • After clicking on the Finish button of the Autotools Wizard, Qt-Creator should show the project's tree structure at the left side hand. The root node should show the project name and all project files should be listed and editable from there. 
  • At this point, building and running the application should work. This will execute autogen.sh or autoreconf, configure and make. The first time, when running the application, a dialog will ask you to choose the executable's location, then, QTC will remember it for the following times. Ideally, this will be changed in the future, to be done in a more automated way.
  • When selecting Projects->Build Settings from Qt-Creator on the left side bar, notice the typical autotools build steps (autogen.sh/autoreconf, configure, make). You may configure some parameters such as adding new configure parameters or changing the build directory (though, as I mentiond before, only in-source building is working at the moment).
As always, all comments and feedback is very welcome. Have fun!

3 comments:

  1. I was wondering if this can be used with the N9's SDK to publish an autotool project to ovi store ?

    ReplyDelete
  2. Hei Xavier, thanks for writing! I honestly do not know, but I guess so! If you give it a try, let me know how it goes!

    ReplyDelete