Qt5:嵌入式设备QT5动态库编译,QT5移植

2017-05-03 11:28:42来源:CSDN作者:x356982611人点击

简介

开发环境为ubuntu14.04,开发工具为TI官方的sdk(AM57xx系列),需要的qt源码去官网下载,不支持触摸屏所以没有添加tslib

需要工具

- Perl 5.8 or later- Python 2.7 or later- C++ compiler supporting the C++98 standard(SDK提供)- 编译套装 `sudo apt-get install build-essential`

环境设置

全局环境设置

编辑~/.bashrc 添加:
export PATH="/home/codebee/ti-linux-am57xx/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH"

Qt源码编译环境设置

进入qt-everywhere-opensource-src-5.6.2/qtbase/mkspecs文件夹,拷贝linux-arm-gnueabi-g++命名为linux-arm-gnueabihf 打开其中的qmake.conf 修改其中内容如下

## qmake configuration for building with arm-linux-gnueabi-g++#MAKEFILE_GENERATOR      = UNIXCONFIG                 += incrementalQMAKE_INCREMENTAL_STYLE = sublibQT_QPA_DEFAULT_PLATFORM = eglfsQMAKE_LIBS_EGL         += -lEGLQMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGALinclude(../common/linux.conf)include(../common/gcc-base-unix.conf)include(../common/g++-unix.conf)# modifications to g++.confQMAKE_CC                = arm-linux-gnueabihf-gccQMAKE_CXX               = arm-linux-gnueabihf-g++QMAKE_LINK              = arm-linux-gnueabihf-g++QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++# modifications to linux.confQMAKE_AR                = arm-linux-gnueabihf-ar cqsQMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopyQMAKE_NM                = arm-linux-gnueabihf-nm -PQMAKE_STRIP             = arm-linux-gnueabihf-stripload(qt_config)

生成编译Qt的makefile

进入qt-everywhere-opensource-src-5.6.2文件夹 新建config.sh文件 内容如下

./configure -opensource -confirm-license /-release -c++std c++11 /--prefix=/opt/QT5 /-xplatform linux-arm-gnueabihf /-shared /-iconv /-developer-build  /-eglfs  -opengl es2 /-qt-zlib -qt-libjpeg -qt-libpng -dbus-runtime /-nomake examples -nomake tests -no-xcb -no-iconv /-skip qtenginio -skip qtlocation -skip qtmultimedia   /-skip qtwebsockets -v#-tslib /#-make tools /#-v 是详细输出模式#--prefix是make install后编译好的qt安装的位置# -no-icu, this will disable the webkit.#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4#make install

执行 config.sh不出错的话makefile就生成好了,接下来执行( -j4意思是用四个线程编译,和自己cpu数一致就行不是数越大越快)

make -j4sudo make install

开发板环境qt环境配置

编译好的qt打包拷贝到开发板的/opt目录解压

配置lib

vi /etc/ld.so.conf 添加一行 /opt/lib
然后执行 sudo ldconfig -v

配置Qt 运行环境

export QTDIR=/optexport QT_QPA_FONTDIR=$QTDIR/lib/fontsexport QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/pluginsexport LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH#export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=1920x1080:mmSize=1024x768:offset=0x0:tty=/dev/tty1export QML_IMPORT_PATH=$QTDIR/qmlexport QML2_IMPORT_PATH=$QTDIR/qmlexport QT_QPA_EGLFS_FB="/dev/fb0"#export QT_QPA_EGLFS_WIDTH=1920#export QT_QPA_EGLFS_HEIGHT=1080export QT_QPA_EGLFS_DEPTH=32#export QT_QPA_EGLFS_PHYSICAL_WIDTH=1920#export QT_QPA_EGLFS_PHYSICAL_HEIGHT=1080

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台