基于Hisi芯片,交叉编译、移植Qt4.8.6(可旋转)
一、安装海思编译链
- 安装海思编译链(如arm-hisiv300-linux-*),不做赘述。
二、下载Qt4.8.6源码包
- 下载链接:http://download.qt.io/archive/qt/4.8/4.8.6/
- 源码包:qt-everywhere-opensource-src-4.8.6.tar.gz
三、解压源码包
- 将源码包拷贝到Ubuntu的Desktop
- 进入Desktop:cd ~/Desktop
- 解压:tar -xzvf qt-everywhere-opensource-src-4.8.6.tar.gz
四、修改QT源码的io.pri文件
- 进入源码包目录:cd ~/Desktop/qt-everywhere-opensource-src-4.8.6
- 修改io.pri文件:~/Desktop/qt-everywhere-opensource-src-4.8.6/src/corelib/io/io.pri
- 添加arm-hisiv300-linux-*编译链
五、添加Hisi交叉编译链配置文件qmake.conf
- 进入源码包目录:cd ~/Desktop/qt-everywhere-opensource-src-4.8.6
- 创建arm-hisiv300-linux-的qmake.cof文件: cp mkspecs/qws/linux-arm-gnueabi-g++/ mkspecs/qws/arm-hisiv300-linux-g++/ -r
- 修改mkspecs/qws/arm-hisiv300-linux-g++/qmake.conf文件,如下:
# # qmake configuration for building with arm-none-linux-gnueabi-g++ # include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf QMAKE_CC = /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-gcc QMAKE_CXX =/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-g++ QMAKE_LINK =/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-g++ QMAKE_LINK_SHLIB = /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-g++ # modifications to linux.conf QMAKE_AR = /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-ar cqs QMAKE_OBJCOPY = /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-objcopy QMAKE_NM = /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-nm -P QMAKE_STRIP =/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-strip load(qt_config)
六、交叉编译前,配置4.8.6源码
./configure --prefix=/opt/qt4.8.6_transfrom -opensource -confirm-license -qt-sql-sqlite -qt-gfx-linuxfb -qt-gfx-transformed -plugin-sql-sqlite -no-qt3support -no-phonon -no-svg -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -no-gif -qt-libtiff -qt-libpng -no-libmng -qt-libjpeg -no-rpath -no-pch -no-3dnow -no-avx -no-neon -no-openssl -no-nis -no-cups -no-dbus -embedded arm -platform linux-g++ -xplatform qws/arm-hisiv300-linux-g++ -little-endian -qt-freetype -no-opengl -no-glib -nomake demos -nomake examples -nomake docs -nomake tools
其中:
--prefix=/opt/qt4.8.6_transfrom 安装目录
-qt-gfx-transformed 支持旋转显示
-xplatform qws/arm-hisiv300-linux-g++ 指定qmake.conf配置
七、编译
- make
八、安装
- make install
九、移植
- 将/opt/qt4.8.6_transfrom/lib资源拷贝到/usr/local/Trolltech/Qt4.8.6/lib。
- 环境配置:
- export QT_INSTALL_PATH=/usr/local/Trolltech/Qt4.8.6
- export LD_LIBRARY_PATH=/lib:/usr/lib:${QT_INSTALL_PATH}/lib:${LD_LIBRARY_PATH}
- export QT_QWS_FONTDIR=${QT_INSTALL_PATH}/lib/fonts
- export QWS_DISPLAY="Transformed:Rot0:LinuxFB:/dev/fb1"
-
解析:
静态设置旋转参数:Transformed:Rot0,旋转角度为0。若要配置为90,180,270,可配置为Transformed:Rot90,Transformed:Rot180,Transformed:Rot270。
-
动态设置旋转参数:
export QWS_DISPLAY="Transformed:LinuxFB:/dev/fb1"
QWSDisplay::setTransformation(0,0);第一个参数0,1,2,3分别对应0,90,180,270度,第二个参数设置为0。
十、Ubuntu安装QtCreator
- 下载路径:http://download.qt.io/archive/qtcreator/
- 以QtCreator2.5.2为例,安装包:qt-creator-linux-x86_64-opensource-2.5.2.bin
- 双击安装即可
- 安装后,打开软件,如图1所示
-
-
-
-
- 图1.QtCreator开启界面
-
-
-
-
- 打开配置界面:Tools->Options->Build&Run,如图2所示
-
-
-
-
- 图2.Build&Run之Qt Version
-
-
-
-
- 点击Add键,选择所需添加的qmake(/opt/qt4.8.6_transfrom/bin/qmake),如图2所示
- 添加交叉编译链(arm-hisiv300-linux-g++与arm-hisiv300-linux-gcc),如图3所示
-
-
-
-
- 图3.Build&Run之Tool Chains
-
-
-
-
- 配件工程套件kit(选择qmake与对应的编译链),如图4所示
-
-
-
-
- 图4.Build&Run之kit配置
-
-
-
-