1.下载qt-embedded-linux-opensource-src-4.5.2.tar.gz和 tslib-1.4.tar.gz
2.交叉编译
#cd tslib
#vi do.sh
#!/bin/sh
./configure --build=i386-linux --host=arm-linux ac_cv_func_malloc_0_nonnull=yes CC=/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-gcc CXX=/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-g++ --prefix=$PWD/build
#chmod 755
#./do.sh
#make
#make install
#cd qt-embedded-linux-opensource-src-4.5.2
#vi do.sh
#!/bin/sh
./configure /
-opensource /
-prefix /***/***(install dir) /
-release /
-shared /
-no-qt3support /
-no-xmlpatterns /
-no-svg /
-no-webkit /
-qt-zlib /
-qt-gif /
-qt-libtiff /
-qt-libpng /
-qt-libmng /
-qt-libjpeg /
-make libs /
-make tools /
-nomake examples /
-nomake docs /
-nomake demo /
-no-nis /
-no-cups /
-no-iconv /
-no-dbus /
-no-openssl /
-xplatform qws/linux-armv6-g++ /
-embedded arm /
-little-endian /
-qt-freetype /
-depths 16 /
-qt-gfx-linuxfb /
-no-gfx-transformed /
-no-gfx-multiscreen /
-no-gfx-vnc /
-no-gfx-qvfb /
-qt-kbd-tty /
-qt-kbd-usb /
-qt-mouse-tslib /
-qt-mouse-pc /
-no-glib
#chmod 755 do.sh
#./do.sh
#make
#make install
在开发板上设置环境变量
#vi /usr/etc/rc.local
#!/sh/bin
export TSLIB_ROOT=/tslib1.4
export TSLIB_TSDEVICE=/dev/ts0
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export QWS_SIZE=800x480
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export POINTERCAL_FILE=/etc/pointercal
export QWS_MOUSE_PROTO=Tslib:/dev/ts0
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_DISPLAY="LinuxFb:mmWidth100:mmHeight130:0"
export TSLIB_TSEVENTTYYPE=H3600
export QTDIR=/usr/qt
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$QTDIR/plugins/imageformats:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=$QTDIR/plugins/
export QT_QWS_FONTDIR=$QTDIR/fonts
#export QWS_MOUSE_PROTO=LinuxTP:/dev/ts0
export QWS_MOUSE_PROTO=Tslib:/dev/ts0
#mkdir /usr/qt
把之前编译安装的QT库和程序(qt的install目录)copy到开发板的/usr/qt目录下,具体如下:
bin fonts lib plugins
bin下放入mousecalibration
fonts下放入*qpf字体(字体比较大,占用空间,可以只复制QT自己转化过的qpf字体)
lib下放入libQtCore.so.4.5.2,libQtGui.so.4.5.2,libQtNetwork.so.4.5.2,libQtSql.so.4.5.2
然后链接下
libQtCore.so.4 -> libQtCore.so.4.5.2
libQtGui.so.4 -> libQtGui.so.4.5.2
libQtNetwork.so.4 -> libQtNetwork.so.4.5.2
libQtSql.so.4 -> libQtSql.so.4.5.2
#mkdir /usr/tslib
再把之前编译安装的Tslib库和程序(tslib的bulid目录)copy到开发板的/usr/tslib目录下,具体如下:
bin etc include lib plugins
设置完毕
qt的库比较大,可以arm-linux-strip下
#sh /usr/etc/rc.local
#ts_calibrate
#mousecalibration
这两个程序测试结果成功
注:由于项目中需要禁止鼠标,所以编译选项加上了-no-feature-CURSOR ,编译时assistant demo example中可能因为代码上有关于光标的代码,全部注释掉就可以了.