构建QT4.7.1嵌入式开发环境

如何构建Qt4.7.0嵌入式开发环境  


ubuntu 11.10
arm-linux-gcc-4.3.2.tgz
qt-everywhere-opensource-src-4.7.1.tar.gz
tslib1.4.tar.gz

步骤
解压tslib1.4.tar.gz
cd tslib
export CC=arm-linux-gcc
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux --cache-file=arm-linux.cache -prefix=/usr/local/tslib
make
make install

解压qt-everywhere-opensource-src-4.7.1.tar.gz,并拷贝出三份,分别命名成qt-4.7.1-arm、qt-4.7.1-x86、qt-4.7.1-pc
cd qt-4.7.1-arm
./configure -prefix /usr/local/Trolltech/qt-4.7.1-arm -opensource -confirm-license -release -shared -embedded arm -xplatform qws/linux-arm-g++ -no-qt3support -fast -no-largefile -qt-mouse-tslib -I /usr/local/tslib/include -L /uar/local/tslib/lib -make tools -make demos -make examples -make docs -qt-libjpeg -qt-libpng -qt-libtiff -qt-gif -multimedia
make
make install

cd qt-4.7.1-x86
./configure -prefix /usr/local/Trolltech/qt-4.7.1-x86 -opensource -confirm-license -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb -make tools
make
make install

cd qt-4.7.1-pc
./configure -prefix /usr/local/Trolltech/qt-4.7.1-pc -opensource -confirm-license
make
make install

接下来安装PC版本的qvfp
cd qt-4.7.1-pc
cd tools/qvfp
make
cp qt-4.7.1-pc/bin/qvfp /usr/local/Trolltech/qt-4.7.1-x86/bin
make


测试安装情况

把usr/local/Trolltech/qt-4.7.1-x86/examples/widgits/calculator文件夹复制到root/tmp文件夹下
启动QtCreator,File-->Open File or Project...,打开root/tmp/calculator/calculator.pro
这里我们分两部分,首先编译x86下的,并运行在qvfb下,再编译arm下的,最后移到开发板下运行。
x86下的编译与调试
1.在QtCreator界面左侧点击Projects图标,打开工程设置界面。
2.在Edit Project Settings for Project calculator-->Build Settings-->Edit Build Configuration;单击Add,在下拉列表中选择Using Qt Version “x86”弹出对话框单击Ok按钮,在Edit Build Configuration:下会出现蓝色的Make x86 Release active.字符,单击激活x86 Release。
3.在Run Settings-->Edit run configuration;右侧单击Show Details按钮,在打开的下拉列表中Arguments;文本框中添加参数“-qws”
4.设置完毕,点击Edit图标,回到编辑界面。
5.编译:在Build菜单下,先Clean Project “calculator”,然后Build Project “calculator”,在右下角Compile Output窗口能看到编译信息
6.运行:
启动终端,输入/usr/local/Trolltech/qt-4.7.1-x86/bin/qvfb -width 800 -height 480 &,启动qvfb
回到QtCreator,Build-->Run,运行程序,切换我们的qvfb窗口中,就可以看到calculator的运行界面了

制作适合嵌入式系统的字库文件
1、拷贝Windows/Fonts/simhei.ttf到/usr/local/Trolltech/qt-4.7.1-x86/lib/fonts中
2、在一个终端中运行 /usr/local/Trolltech/qt-4.7.1-x86/bin/qvfb -width 800 -height 480 &,启动qvfp
3、cd usr/local/Trolltech/qt-4.7.1/bin,在另外一个终端中运行 ./makeqpf -qws,就可以看见MakeQPF界面
4、在Famiy中选择SimHei(刚刚拷贝过来的),Pixel Size中选择要生成的字体的大小20等;在OutPut Options中选择生成文件的目录,待会去那找生成出的文件
5、点击Generate Pre-Rendered Font...,待会就会显示生成成功,会生成出一个simhei_20_50.qpf2文件
6、移除之前拷贝过来的simhei.ttf,要不然看不到效果(我现在也不知道为什么)
7、关掉MakeQPF,重新运行./makeqpf -qws -font simhei,这次显示的界面就和上次不一样了,字体大小明显发生了变化
8、你也可以试试其他的文件cd /usr/local/Trolltech/qt-4.7.1-x86/examples/widgets/calendarwidget,运行./calendarwidget -qws -font simhei 和运行 ./calendarwidget -qws的默认字体,比较一下看看
9、Enjoy it! You have Done!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值