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


    所需平台及软件版本如下

    FedoraCore 13
    arm-linux-gcc-4.3.2.tgz
    qt-everywhere-opensource-src-4.7.0.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.0.tar.gz,并拷贝出三份,分别命名成qt-4.7.0-arm、qt-4.7.0-x86、qt-4.7.0-pc
    cd qt-4.7.0-arm
    ./configure -prefix /usr/local/Trolltech/qt-4.7.0-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.0-x86
    ./configure -prefix /usr/local/Trolltech/qt-4.7.0-x86 -opensource -confirm-license -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb -make tools
    make 
    make install

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

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

    至此安装完成

    测试安装情况

    把usr/local/Trolltech/qt-4.7.0-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.0-x86/bin/qvfb -width 800 -height 480 &,启动qvfb
    回到QtCreator,Build-->Run,运行程序,切换我们的qvfb窗口中,就可以看到calculator的运行界面了

    制作适合嵌入式系统的字库文件
    1、拷贝Windows/Fonts/simhei.ttf到/usr/local/Trolltech/qt-4.7.0-x86/lib/fonts中
    2、在一个终端中运行 /usr/local/Trolltech/qt-4.7.0-x86/bin/qvfb -width 800 -height 480 &,启动qvfp
    3、cd usr/local/Trolltech/qt-4.7.0/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.0-x86/examples/widgets/calendarwidget,运行./calendarwidget -qws -font simhei 和运行 ./calendarwidget -qws的默认字体,比较一下看看
    9、Enjoy it! You have Done!

  • 相关阅读:
    【LeetCode】Validate Binary Search Tree
    【LeetCode】Search in Rotated Sorted Array II(转)
    【LeetCode】Search in Rotated Sorted Array
    【LeetCode】Set Matrix Zeroes
    【LeetCode】Sqrt(x) (转载)
    【LeetCode】Integer to Roman
    贪心算法
    【LeetCode】Best Time to Buy and Sell Stock III
    【LeetCode】Best Time to Buy and Sell Stock II
    CentOS 6 上安装 pip、setuptools
  • 原文地址:https://www.cnblogs.com/ganrui/p/3711872.html
Copyright © 2020-2023  润新知