简介
开发环境为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 = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = eglfs
QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(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 -j4
sudo make install
开发板环境qt环境配置
编译好的qt打包拷贝到开发板的/opt目录解压
配置lib
vi /etc/ld.so.conf 添加一行 /opt/lib
然后执行 sudo ldconfig -v
配置Qt 运行环境
export QTDIR=/opt
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
#export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=1920x1080:mmSize=1024x768:offset=0x0:tty=/dev/tty1
export QML_IMPORT_PATH=$QTDIR/qml
export QML2_IMPORT_PATH=$QTDIR/qml
export QT_QPA_EGLFS_FB="/dev/fb0"
#export QT_QPA_EGLFS_WIDTH=1920
#export QT_QPA_EGLFS_HEIGHT=1080
export QT_QPA_EGLFS_DEPTH=32
#export QT_QPA_EGLFS_PHYSICAL_WIDTH=1920
#export QT_QPA_EGLFS_PHYSICAL_HEIGHT=1080