Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This is example 9, and perhaps a viable solutions of answering the Qt FAQ How to cross-compile a Qt Creator project from Ubuntu to a windows executable?,
which follows [1].
Downloads
Project information
Operating system: Ubuntu 10.04 LTS Lucid Lynx
IDE: Qt Creator 2.0.0
Project type: GUI application
Compiler: G++ 4.4.1
Libraries used:
#-------------------------------------------------
#
# Project created by QtCreator 2010-09-25T09:43:28
#
#-------------------------------------------------
QT += core
QT -= gui
LIBS += -L/usr/local/lib -lboost_filesystem
TARGET = CppQtCrosscompileToWindowsExample5
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
|
main.cpp
Process
For this example, I use a console project that calls the Boost libraries. If you only need the STL,
example 1: console application, no libaries shows
an easy and successfull approach.
Additional qmake arguments can be supplied in the
'Projects -> Build Settings -> Build Steps -> qmake -> Additional arguments' edit.
NOTE: [1] IS ABOUT MAC!
[1] http://labs.qt.nokia.com/2009/10/12/to-make-or-not-to-make-qmake-and-beyond
5) Cross-compiling
In large mixed cross-compiled (were you compile projects for both host and target systems at the same time) projects, most of the sub-projects normally compile for the target system, while only a few (supporting) projects are intended for the host. This means that projects should easily and automatically pick up the target platform, while a bit more attention should be required for host platform projects only.
The project shouldn?t have to worry too much about which platform, nor how to manipulate the project file to achieve the result. Ideally they would only have to mark that a project is intended for the host platform, like for example:
var moc = {
"target" : "moc",
"platform": "Host",
"defines" : { "all" : ["QT_MOC"]},
...
}
As the configure process has already figured out which parameters are needed for the host and target platform, the build system would know which defaults to apply to each project type in the cross-compiling setup; so the project developer need not do anything else to the project, unless he/she needs to override the cross-compiling defaults.
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
