嵌入式linux软件平台--QtLib、QwtLib实现图形显示(一)

2019-07-13 06:19发布

嵌入式软件平台使用Qt实现对图形界面的显示支持,使用Qwt实现对图形统计和曲线的支持,使用tslib实现对触摸屏管理的支持。 如果产品中需要使用触摸屏,则在Qtlib中需要TsLib来实现触摸屏驱动支持。 在编译QtLib之前需要先编译生成TsLib,编译流程如下.
下载tslib.tar.gz 进入tslib目录 ◆ ./autogen.sh ◆ echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache ◆ CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux --prefix=yourpath/tslib  --cache-file=arm-linux.cache ◆ make && make install
TsLib编译完成后,可以进行QtLib的编译,编译流程如下:
下载嵌入式qt版本qt-everywhere-opensource-src-4.8.5.tar.gz 修改/mkspecs/qws/linux-arm-g++/qmake.conf # # qmake configuration for building with arm-linux-g++ # include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) include(../../common/qws.conf) QMAKE_INCDIR = /home/lyang/code/cpb/tslib/include/ QMAKE_LIBDIR = /home/lyang/code/cpb/tslib/lib/ # modifications to g++.conf QMAKE_CC = arm-linux-gnueabihf-gcc -lts QMAKE_CXX = arm-linux-gnueabihf-g++ -lts QMAKE_LINK = arm-linux-gnueabihf-g++ -lts QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++ -lts # modifications to linux.conf QMAKE_AR = arm-linux-gnueabihf-ar cqs QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy QMAKE_STRIP = arm-linux-gnueabihf-strip load(qt_config) 在qtlib目录下创建configure.sh文件 export QMAKESPEC= ./configure -prefix /opt/arm_qt/qtlib/qt4.8/static/ -opensource -confirm-license -release -static -embedded arm -xplatform qws/linux-arm-g++ -depths 16 -fast -qt-libpng -optimized-qmake -qt-sql-sqlite -no-pch -no-phonon-backend -no-libjpeg -qt-zlib -no-stl -no-gif -qt-freetype -qt-mouse-tslib -no-iconv -no-dbus -no-openvg -no-usedeffiles -little-endian -host-little-endian -no-qt3support -no-libtiff -no-libmng -no-opengl -no-mmx -no-sse -no-sse2 -no-3dnow -no-openssl -no-webkit -no-qvfb -no-phonon -no-nis -no-opengl -no-cups -no-glib -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info -qt-kbd-linuxinput -no-multimedia -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -nomake examples -nomake tools -nomake docs -force-pkg-config ./configure.sh
make && make install
如果需要使用图形统计及曲线显示,则需要添加qwtLib库,编译流程如下:
下载qwt-6.0.0.tar.gz
声明qtlib路径export PATH=/opt/arm_qt/qtlib/qt4.8/bin/:$PATH
export QMAKESPEC= qmake make
编译结束后,复制qtlib编译生成的libQtCore,libQtGui,libQtNetwork相关文件到对应目录,复制Qwtlib,tslib相关内容到对应目录。