How to cross compile qt application for different platforms
-
20-09-2019 - |
Question
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.
Solution 3
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.
OTHER TIPS
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
.
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.