Difference between revisions of "Compile QT in an ARM device"

From wiki.ferrari.mo.it
Jump to navigation Jump to search
Line 71: Line 71:
 
* CMAKE_BUILD_TYPE = Release
 
* CMAKE_BUILD_TYPE = Release
 
* QT_MAKE_EXECUTABLE = C:\Qt\5.13.0\mingw73_64\bin\qmake.exe
 
* QT_MAKE_EXECUTABLE = C:\Qt\5.13.0\mingw73_64\bin\qmake.exe
 +
* Unckeck the box [ ]ENABLE_PRECOMPILED_HEADERS
  
 
then click configure for the fourth time. When finished, click generate.
 
then click configure for the fourth time. When finished, click generate.

Revision as of 14:17, 18 August 2019

Compile QT application in an ARM device

1. Install compiler

apt-get install g++

2. Install required packages

apt-get install qttools5-dev
apt-get install qt5-default

3. Install required modules. Examples:

apt-get install libqt5sql5
apt-get install libqt5serialport5-dev
apt-get install libqt5websockets5-dev

4. Compile

cd my_dir
qmake
make

5. Compiler setup

Download and install CMake from cmake.org. During installation, select the option 'Add CMake to the PATH for all users'.

Go to Control Panel - System, and then to 'Advanced System Setting'. Go to the 'Advanced' tab and click on 'Environment Variables'. Add the MinGW path to the Path variable (in this case, it is C:\Qt\Tools\mingw730_64\bin).

6. Install OpenCV and compile its libraries

Download OpenCV from Sourceforge, then install it (file opencv-4.1.1-vc14_vc15.exe) into the C:\OpenCV\ directory.

Then, go to the CMake directory (C:\Program Files\CMake\bin) and execute cmake-gui.exe.

  • Where is the source code: C:/OpenCV/sources
  • Where to build the binaries: C:/OpenCV/opencv-build

Click next.

  • Specify the generator for this project: MinGW Makefiles
  • Specify native compilers
  • Compilers C: C:\Qt\Tools\mingw730_64\bin\gcc.exe
  • Compilers C++: C:\Qt\Tools\mingw730_64\bin\g++.exe

Click configure for the first time.

Then, a variable list should appear.

  • Check the box [X]WITH_QT
  • Check the box [X]WITH_OPENGL

Click configure for the second time. If the compiler complains about not finding the Qt5Config.cmake file, add the following variable:

  • Qt5_DIR = C:/Qt/5.13.0/mingw73_64/lib/cmake/Qt5

and click configure for the third time.

Some other variables should appear:

  • Qt5Concurrent_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5Concurrent
  • Qt5Core_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5Core
  • Qt5Gui_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5Gui
  • Qt5Test_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5Test
  • Qt5Widgets_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5Widgets
  • Qt5OpenGL_DIR = C:\Qt\5.13.0\mingw73_64\lib\cmake\Qt5OpenGL

and others should be added:

  • CMAKE_BUILD_TYPE = Release
  • QT_MAKE_EXECUTABLE = C:\Qt\5.13.0\mingw73_64\bin\qmake.exe
  • Unckeck the box [ ]ENABLE_PRECOMPILED_HEADERS

then click configure for the fourth time. When finished, click generate.

Then, open a command prompt and, from the C:\OpenCV\opencv-build directory, execute

mingw32-make -j 4