|
|
Line 1: |
Line 1: |
− | ==交叉编译你的Qt应用程序 ==
| |
| | | |
− | 下面以下载并编译一个 QtE-Demo 为例,分别说明在各个平台编译一个 Qt应用程序的步骤:
| |
− |
| |
− | ===S5P4418平台的编译===
| |
− | <syntaxhighlight lang="bash">
| |
− | git clone https://github.com/friendlyarm/QtE-Demo
| |
− | mkdir build && cd build
| |
− | /usr/local/Trolltech/Qt-5.9.1-nexell32/bin/qmake ../QtE-Demo/QtE-Demo.pro
| |
− | make
| |
− | </syntaxhighlight>
| |
− | ===S5P6818平台的编译===
| |
− | <syntaxhighlight lang="bash">
| |
− | git clone https://github.com/friendlyarm/QtE-Demo
| |
− | mkdir build && cd build
| |
− | /usr/local/Trolltech/Qt-5.9.1-nexell64/bin/qmake ../QtE-Demo/QtE-Demo.pro
| |
− | make
| |
− | </syntaxhighlight>
| |
− | ===Allwinner H3平台的编译===
| |
− | <syntaxhighlight lang="bash">
| |
− | export PATH=/opt/FriendlyARM/toolschain/4.9.3/bin/:$PATH
| |
− | git clone https://github.com/friendlyarm/QtE-Demo
| |
− | mkdir build && cd build
| |
− | /usr/local/Trolltech/QtEmbedded-4.8.6-arm/bin/qmake ../QtE-Demo/QtE-Demo-Qt4.pro
| |
− | make
| |
− | </syntaxhighlight>
| |
− | ===Allwinner H5平台的编译===
| |
− | <syntaxhighlight lang="bash">
| |
− | export PATH=/opt/FriendlyARM/toolschain/a64-32bit-tootchain/bin/:$PATH
| |
− | git clone https://github.com/friendlyarm/QtE-Demo
| |
− | mkdir build && cd build
| |
− | /usr/local/Trolltech/QtEmbedded-4.8.6-arm-a64/bin/qmake ../QtE-Demo/QtE-Demo-Qt4.pro
| |
− | make
| |
− | </syntaxhighlight>
| |
− | ===Amlogic S905平台的编译===
| |
− | <syntaxhighlight lang="bash">
| |
− | export PATH=/opt/FriendlyARM/toolschain/a64-32bit-tootchain/bin/:$PATH
| |
− | git clone https://github.com/friendlyarm/QtE-Demo
| |
− | mkdir build && cd build
| |
− | /usr/local/Trolltech/QtEmbedded-5.9.1-arch64/bin/qmake ../QtE-Demo/QtE-Demo.pro
| |
− | make
| |
− | </syntaxhighlight>
| |
− |
| |
− | ===在开发板上运行Qt程序===
| |
− |
| |
− | 运行Qt程序之前,需要先设置环境变量,在开发板上执行以下命令即可:
| |
− |
| |
− | Qt5,使用 setqt5env:
| |
− | <syntaxhighlight lang="bash">
| |
− | . /usr/bin/setqt5env
| |
− | </syntaxhighlight>
| |
− |
| |
− | Qt4,使用 setqt4env:
| |
− | <syntaxhighlight lang="bash">
| |
− | . /usr/bin/setqt5env
| |
− | </syntaxhighlight>
| |
− |
| |
− | 例如运行上一章节编译的QtE-Demo:
| |
− | <syntaxhighlight lang="bash">
| |
− | ./QtE-Demo -qws
| |
− | </syntaxhighlight>
| |
− |
| |
− | ===开机自动运行Qt程序===
| |
− |
| |
− | 以运行上一章节中的 QtE-Demo 程序为例,假设它放在 /root 目录,则你可以编辑 /etc/rc.local 文件,确否有以下内容:
| |
− | <syntaxhighlight lang="bash">
| |
− | . /usr/bin/setqt5env
| |
− | /root/QtE-Demo -qws&
| |
− | </syntaxhighlight>
| |
− | 如果是 Qt4,请将setqt5env改为setqt4env。
| |