在iTop4412上移植Qt5.6.3

简单记录过程:

1,下载qt-everywhere-opensource-src-5.6.3源码,地址:http://download.qt.io/archive/qt/

2,下载arm-linux-4.4.3的交叉编译器,地址:https://download.csdn.net/download/immortal018/10421132

3,设置编译器或者说平台。通过xplatform参数指定编译器,xplatform后面跟的参数实际上即是qtbase/mkspec下的文件夹的名字,修改该文件夹下的qmake.conf,修改后的内容如下所示:(path为自己存放交叉编译器4.4.3的具体路径)

#
# 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
QMAKE_CXXFLAGS_RELEASE +=-O2 -march=armv7-a

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC                = /path/4.4.3/bin/arm-none-linux-gnueabi-gcc
QMAKE_CXX               = /path/4.4.3/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK              = /path/4.4.3/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = /path/4.4.3/bin/arm-none-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR                = /path/4.4.3/bin/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = /path/4.4.3/bin/arm-none-linux-gnueabi-objcopy
QMAKE_NM                = /path/4.4.3/bin/arm-none-linux-gnueabi-nm -P
QMAKE_STRIP             = /path/4.4.3/bin/arm-none-linux-gnueabi-strip
load(qt_config)

4,找到源码目录下的qt.pro,屏蔽掉下面两句话:

addModule(qt3d, qtdeclarative qtimageformats)
addModule(qtcanvas3d, qtdeclarative) 

5,创建shell脚本,进行模块裁剪,编译:(具体的参数含义可以再终端输入 ./configure --help 查看释意)

        --prefix 是相对于这个目录来安装的,也就是说 make install 后,qt的库安装到了 /opt 目录下

#bin/bash
echo yes | ./configure -opensource -release --prefix=/opt/QtE5.6 \
-qt-libpng -qt-zlib -qt-libjpeg -plugin-sql-sqlite -widgets -qt-sql-sqlite -make libs \
-silent -xplatform  linux-arm-gnueabi-g++ -nomake tools -nomake examples \
-no-xcb -mtdev -xinput2 -strip -linuxfb -confirm-license -qt-freetype -fontconfig \
-no-cups -no-iconv -no-qml-debug -no-dbus -no-largefile -no-opengl \
-nomake tests -no-openvg -no-egl -no-openssl -no-accessibility -tslib \
-no-sse2 -no-c++11 -no-glib -no-xcursor -no-xfixes -no-xrandr -no-xrender

6,运行上面的 shell 脚本,将编译生成的 QtE5.6 拷贝到目标板上。这里放到/usr目录下,并在目标板的/etc/profile中配置Qt5的环境变量,并添加电容触摸屏的支持,如下所示:

export QTDIR=/usr/QtE                                      
export PATH=$QTDIR:$PATH  
export QT_QPA_FONTDIR=$QTDIR/lib/fonts  
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins  
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=180
#由于Qt5本身就支持多点触摸,所以直接使用Qt提供的evdevtouch插件库,无需另外再额外编译tslib
export QT_QPA_GENERIC_PLUGINS=evdevtouch:/dev/input/event2  
export LD_LIBRARY_PATH=/lib:$QTDIR/lib:$QTDIR/x11/lib:$QTDIR/tslib:$QTDIR/mtdev/lib

7,至此,触摸屏就可以使用了,直接执行./app 即可,无需其他参数


阅读更多
想对作者说点什么?
相关热词

博主推荐

换一批

没有更多推荐了,返回首页