1、与QT平行目录创建一个文件夹qt5-build,进行shadow build
配置configure脚本如下:
../qt-everywhere-opensource-src-5.9.8/configure -prefix /home/wangll/practice/QT/qt
-opensource
-release
-no-pch
-confirm-license
-xplatform arm-poky-linux-gnueabi-g++
-qt-zlib
-no-iconv
-no-gif
-qt-libjpeg
-no-opengl
-skip qtdeclarative
-skip qtquickcontrols
-skip qtquickcontrols2
-no-qml-debug
-no-cups
-no-glib
-no-dbus
-no-rpath
-no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2
-no-avx
-no-openssl
-nomake tools
-qreal float
-qt-libpng
-sysroot /data/toolchain/imx-a7/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi
-nomake examples
-I /data/toolchain/imx-a7/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi/usr/include/ -L /data/toolchain/imx-a7/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi/usr/lib/
2、创建IMX平台的目录:
qt-everywhere-opensource-src-5.9.8/qtbase/mkspecs/arm-poky-linux-gnueabi-g++
3、在目录arm-poky-linux-gnueabi-g++下,创建并修改qmake.conf 如下:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a -mfloat-abi=hard
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a -mfloat-abi=hard
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-poky-linux-gnueabi-gcc
QMAKE_CXX = arm-poky-linux-gnueabi-g++
QMAKE_LINK = arm-poky-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-poky-linux-gnueabi-g++
# modifications to linux.conf
QMAKE_AR = arm-poky-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-poky-linux-gnueabi-objcopy
QMAKE_NM = arm-poky-linux-gnueabi-nm -P
QMAKE_STRIP = arm-poky-linux-gnueabi-strip
load(qt_config)
4、在目录arm-poky-linux-gnueabi-g++下创建文件qplatformdefs.h,并添加内容如下:
#include "../linux-g++/qplatformdefs.h"