Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cross compile qt application for different platforms

How can I cross-compile my application on Qt. As for each project

I need two version

1). Which runs on computer on Qvfb & i386 Architecture

2). Which runs on device with Linux Framebuffer & ARM Architecture

I have already compiled Qt for device as well as for Qvfb. I am able to run examples on both platforms, But How can I cross-compile my applications. I would prefer that both output stays in different directories, that means output of i386 stays in output-i386 platform and output of ARM stays in output-ARM directory.

I am using Qt 4.6 for Embedded Linux.

like image 287
SunnyShah Avatar asked Dec 19 '09 04:12

SunnyShah


People also ask

Are Qt applications cross-platform?

Finally, the Qt Creator IDE provides a cross-platform, complete integrated development environment (IDE) for application developers to create applications for multiple desktop, embedded, and mobile device platforms, such as Android and iOS. It is available for Linux, mac OS, and Windows operating systems.

Which compiler is used in Qt?

MinGW is distributed together with Qt Creator and Qt for Windows. MSVC (Microsoft Visual C++ Compiler) is a C++ compiler that is installed with Microsoft Visual Studio. Nim is the Nim Compiler for Windows, Linux, and macOS. QCC is the interface for compiling C++ applications for QNX.


3 Answers

You can simply set DESTDIR in your .pro file. See the qmake variable reference. You might also want to adjust the variables OBJECTS_DIR, UI_DIR, MOC_DIR and RCC_DIR.

like image 185
bluebrother Avatar answered Oct 22 '22 21:10

bluebrother


The end of this article shows you how to change qmake in a working directory (you need to run make destclean first). This other article outlines the basic Qt for embedded Linux environment, just to give you the big picture.

like image 22
e8johan Avatar answered Oct 22 '22 21:10

e8johan


Qt takes all platform specific details from mkspec file.

Specify mkspec file to qmake to cross compile by using -spec command line argument of qmake.

in mkspec file there are many defines by which you can customize compiling for different platforms like I can use DESTDIR to send final output file to particular directory, OBJECTS_DIR to send Objects file to particular directory. MOC_DIR to send moc generated files to particular dir, UI_DIR to uic generated headers and cpp files to particluar directory.

like image 33
SunnyShah Avatar answered Oct 22 '22 20:10

SunnyShah