Recent Changes - Search:

Downloads
Download
Linux Repositories

wiki
Documentation

Developers
Main
Building CodeLite - Linux
Building CodeLite - Windows
Building CodeLite - OSX
Building wxWidgets for Windows
Coding Guidelines
Creating a Plugin
wxWidgets repositories

Support
Submit an Issue

Community
Mailing List
Forums

General Info
Features

The Qmake Plugin


The Qmake plugin is a codelite plugin which overrides the default build system of codelite, and uses Qt's qmake tool. It does that by producing a .pro file (qmake's project file) from codelite's project file (.project) and executing 'qmake' on the generated .pro file

Using this plugin, you can quickly create Qt projects using codelite.

Note: This tutorial assumes that you have already downloaded and installed Qt's SDK

Defining new qmake


  • From the menu bar, open the qmake settings dialog ('Plugins -> Qmake -> Settings ...') and click on the 'New' button, give it a name (e.g. MyQmake) and click 'OK'
  • You should now have a dialog similar to the one below:
  • In the 'qmake executable' field, enter the full path to your qmake executable
  • Once the above field is populated properly, you should have a list of options in the 'QMAKESPEC' field. Choose the settings that suit you best (on Windows using MinGW you should choose win32-g++, while on Linux, choose linux-g++).
  • 'QTDIR' should point to your Qt base installation directory

Example: After installing Qt on Windows using MinGW in the installation directory 'C:\Qt\2009.02\', you should have a qmake definition similar to the one below:

  • The 'qmake execution line' is currently not in use and therefore should be ignored.
  • In the text area, you can add any syntax that is recognized by qmake; this text is simply copied into the auto-generated .pro file. Since this text is copied at the bottom of the .pro file, you can use it to override any auto generated variable generated by codelite.

Creating a qmake based project


Once you have set up a qmake setting to work with, you are now ready to create your first qmake based project.

  • Open the 'New Qmake project' dialog from the menu (Plugins -> Qmake -> New qmake based project)
  • Fill the fields with the appropriate values and click OK

Your 'New Qmake project' dialog should look similar to this:

Note that in the above dialog, I chose the qmake we defined in the previous steps.

  • Once you've clicked OK, you should get an empty workspace with a single project named 'MyQtProj' as seen in the image below:
  • Add file(s) to your new project and you are good to go!

For the above demonstration, I added a main.cpp file which includes the following code:

 #include <QString>

 int main(int argc, char **argv)
 {
 	QString str;

 	str = "Hello world from QT";
 	printf("%s\n", str.toLocal8Bit().constData());

 	return 0;

 }

Note: You might need to add your Qt's bin directory to your system PATH environment variable so your application will be able to locate Qt's dlls

Qmake project settings


For many people the above steps are sufficient to work with Qt, but there are cases when you need to add some tweaks to the .pro file.
This is done from the project settings: right click on the project, and select 'settings'

The 'Project Settings' dialog pops up, but now it has an additional tab, named 'Qmake'

  • Check the 'This project uses qmake' checkbox to allow the qmake plugin to override the default build system; unchecking it tells codelite to use the default build system for the project
  • The 'qmake execution line' is currently not in use, and should be ignored
  • In the free text area, you may add any .pro syntax code that will be appended to the generated .pro file

For example, if you want to build a project without the QtGui module, you need to exclude the gui value with the "-=" operator; the following line will result in a minimal Qt project being built:

 QT -= gui # Only the core module is used.
Edit - History - Print - Recent Changes - Search
Page last modified on February 09, 2010, at 07:41 PM