Skip to content

Commit 0391e27

Browse files
committed
Merge branch 'release/1.2.0'
2 parents d429947 + ca6b879 commit 0391e27

25 files changed

+512
-94
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*.retry
66

77
*.pyc
8+
.vagrant/
9+
/cache/
810

911
# compiled output
1012
/dist

CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
v1.2.0 - 2017-03-29
2+
- Add QtSvg module
3+
- Add QtSerialPort module
4+
- Add local cache for raspbian / toolchain / Qt modules
5+
- Add Vagrant to virtualize qtrpi (provisionned with Ansible)
6+
- Add test qtrpi minimal script
7+
- Add download ci artefacts scripts
8+
- Update raspbian compatibility to the version 2017-03-02
9+
- Update README
10+
111
v1.1.0 - 2016-11-09
212
- Add support for RPi 1 & RPi 3
313
- Add support of Qt 5.6.2

README.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,74 @@
1-
# qtrpi
1+
# QtRpi
22

33
## Purpose
4-
Offer an easy-to-use environment to cross-compile Qt application on a Raspberry Pi. This repo contains all the scripts necessary to prepare a sysroot, cross-compile Qt and deploy Qt libraries to your Raspberry.
4+
Offer an easy-to-use environment to cross-compile Qt application on a Raspberry Pi. This repo contains all the scripts needed to prepare a sysroot, cross-compile Qt and deploy Qt libraries to your Raspberry.
55

66
For more information, go to http://www.qtrpi.com/faq.
77

8+
## How to contact us?
9+
You can fill a contact form from our [official website](https://www.neuronalmotion.com/contact/) or send us an email at *contact [at] neuronalmotion [dot] com*.
10+
11+
## Difference between init-qtrpi-minimal and init-qtrpi-full
12+
* **init-qtrpi-minimal**, the typical way: downloads ready-to-use Qt binaries for the Raspberry Pi and a minimal sysroot that we released on the [official website](http://www.qtrpi.com/download)
13+
* **init-qtrpi-full**, the custom way: compiles on your computer the Qt binaries for the Raspberry Pi to let you tweak the configuration, enhance the compilation by adding some missing Qt moduless to QtRpi or add some specific third-party dependencies
14+
15+
### Summary
16+
| | init-qtrpi-minimal | init-qtrpi-full |
17+
| ------------------- | ----------------------------- | ------------------------------------ |
18+
| Raspbian image | | *from [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/)* |
19+
| Toochain | *from [the github project](https://github.com/raspberrypi/tools)* | *from [the github project](https://github.com/raspberrypi/tools)* |
20+
| Sysroot | *from [qtrpi.com](http://www.qtrpi.com/download)* | generated from raspbian image |
21+
| Qt binaries | *from [qtrpi.com](http://www.qtrpi.com/download)* | compiled |
22+
23+
## Tutorial of init-qtrpi-minimal.sh
24+
25+
This tutorial will help you to:
26+
* Configure your host computer to be able to cross-compile Qt 5.7.0 applications for your Raspberry Pi 3
27+
* Deploy the pre-compiled Qt binaries on your Raspberry Pi
28+
* Cross-compile your application for a Raspberry Pi with the CLI or Qt Creator
29+
30+
### Requirements
31+
* A 64-bit Linux host computer
32+
* A Raspberry Pi 3
33+
34+
In this example, you already have an SSH access to your Raspberry Pi 3 at `192.168.1.12` with the user `pi`. The script will use sudo several times to install the packages on the board. You should add your SSH key in your Raspberry Pi. For example with **`ssh-copy-id`**:
35+
```bash
36+
ssh-copy-id pi@192.168.1.12
37+
```
38+
39+
### Installation
40+
Open a terminal and follow the steps below:
41+
```bash
42+
git clone https://github.com/neuronalmotion/qtrpi.git
43+
cd qtrpi
44+
export QTRPI_QT_VERSION='5.7.0'
45+
export QTRPI_TARGET_DEVICE='linux-rpi3-g++'
46+
export QTRPI_TARGET_HOST='pi@192.168.1.12'
47+
./init-qtrpi-minimal.sh
48+
./deploy-qtrpi.sh --prepare-rpi
49+
```
50+
51+
Note: You can also export the *environment variables* in your **.bashrc**.
52+
53+
### Usage in CLI
54+
```
55+
cd myproject
56+
/opt/qtrpi/bin/qmake-qtrpi
57+
make
58+
```
59+
You can now copy and execute the generated binary file on your Raspberry Pi
60+
61+
Note: You can also add **/opt/qtrpi/bin/** to your `PATH` in your .bashrc and call **qmake-qtrpi** without the full path.
62+
63+
### Usage in Qt Creator
64+
*coming soon...*
65+
66+
## Tutorial of init-qtrpi-full.sh
67+
68+
### How to add a new Qt module in QtRpi?
69+
* In this case, you must use [init-qtrpi-full.sh](https://github.com/neuronalmotion/qtrpi/blob/develop/init-qtrpi-full.sh), because you will have to recompile it on your computers
70+
* All the modules are cloned from the official Qt website (http://code.qt.io/)
71+
* If you want to add a module, just add the repository name in the file [qt-modules.txt](https://github.com/neuronalmotion/qtrpi/blob/develop/qt-modules.txt)
72+
* You might have to add some packages in the sysroot, this can be done in [utils/prepare-sysroot-full.sh](https://github.com/neuronalmotion/qtrpi/blob/develop/utils/prepare-sysroot-full.sh)
73+
* Once you have modified these scripts, you should be able to re-execute [init-qtrpi-full.sh](https://github.com/neuronalmotion/qtrpi/blob/develop/init-qtrpi-full.sh) and see the magic happen.
74+

Vagrantfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure(2) do |config|
5+
#config.vm.box = "ubuntu/xenial64"
6+
config.vm.box = "bento/ubuntu-16.04"
7+
config.vm.define "#{ENV['QTRPI_VM_NAME']}"
8+
9+
config.vm.provider "virtualbox" do |v|
10+
v.memory = 4096
11+
v.cpus = 8
12+
end
13+
14+
config.vm.provision :ansible do |ansible|
15+
ansible.verbose = "v"
16+
ansible.playbook = "ansible/vagrant.yml"
17+
end
18+
19+
end

ansible/vagrant.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- hosts: all
3+
become: yes
4+
become_method: sudo
5+
gather_facts: no
6+
pre_tasks:
7+
- name: 'install python2'
8+
raw: sudo apt-get -y install python-simplejson
9+
tasks:
10+
- name: update apt cache
11+
apt: update_cache=yes
12+
13+
- name: install packages
14+
apt: name={{ item }} state=present
15+
with_items:
16+
- g++
17+
- git
18+
- realpath
19+
- unzip
20+
- zip
21+
22+
- name: update QT_VERSION in .profile
23+
lineinfile: dest=/home/vagrant/.profile line="export QTRPI_QT_VERSION='{{ lookup('env', 'QTRPI_QT_VERSION') }}'"
24+
25+
- name: update TARGET_DEVICE in .profile
26+
lineinfile: dest=/home/vagrant/.profile line="export QTRPI_TARGET_DEVICE='{{ lookup('env', 'QTRPI_TARGET_DEVICE') }}'"
27+
28+
- name: update ssh working directory
29+
lineinfile: dest=/home/vagrant/.profile line="cd /vagrant"

compile-all-versions.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

deploy-qtrpi.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@ if [[ $DISPLAY_HELP ]]; then
4040
fi
4141

4242
if [[ $PREPARE_RPI ]]; then
43-
ssh $TARGET_HOST 'sudo mkdir /usr/local/qt5pi ; sudo chown -R pi:pi /usr/local/qt5pi'
43+
TARGET_USER=$(echo $TARGET_HOST | cut -d@ -f1)
44+
ssh $TARGET_HOST "sudo mkdir /usr/local/qt5pi ; sudo chown -R ${TARGET_USER}:users /usr/local/qt5pi"
4445
ssh $TARGET_HOST 'sudo apt-get install -y apt-transport-https'
4546
ssh $TARGET_HOST 'sudo apt-get install -y libts-0.0-0 libinput5'
46-
ssh $TARGET_HOST "sudo sh -c 'echo /usr/local/qt5pi/lib > /etc/ld.so.conf.d/qt5pi.conf'"
47+
ssh $TARGET_HOST "sudo sh -c 'echo /usr/local/qt5pi/lib > /etc/ld.so.conf.d/99-qt5pi.conf'"
4748

4849
# to fix which version of libEGL should be picked by Qt applications (/opt/vc rather than /usr/lib/....)
4950
ssh $TARGET_HOST "sudo sh -c 'rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0'"
5051
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0'"
52+
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1'"
5153
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0'"
54+
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2'"
5255
fi
5356

5457
rsync -avz $OUTPUT_DIR $TARGET_HOST:/usr/local/

init-qtrpi-full.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
11
#!/bin/bash
22

3+
function usage() {
4+
cat <<EOF
5+
Usage: $0 [options]
6+
7+
-h| --help Display help text.
8+
-n| --no-questions No interactive mode (default behavior by default: raspbian image cache is not re-downloaded).
9+
EOF
10+
}
11+
12+
while [[ $# -gt 0 ]]; do
13+
KEY="$1"
14+
case $KEY in
15+
-h|--help)
16+
DISPLAY_HELP=true
17+
;;
18+
-n|--no-questions)
19+
NO_QUESTIONS=true
20+
;;
21+
*)
22+
;;
23+
esac
24+
shift
25+
done
26+
27+
if [[ $DISPLAY_HELP ]]; then
28+
usage
29+
exit 0
30+
fi
31+
32+
RASPBIAN_ARG=''
33+
if [[ $NO_QUESTIONS ]]; then
34+
RASPBIAN_ARG='--no-download'
35+
fi
36+
337
cd utils
438
./init-common.sh
5-
./init-full.sh
39+
./synchronize-toolchain.sh
40+
./download-raspbian.sh $RASPBIAN_ARG
641
./prepare-sysroot-full.sh
742
./prepare-sysroot-minimal.sh
843
./switch-sysroot.sh full

init-qtrpi-minimal.sh

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
#!/bin/bash
22

3-
QTRPI_BASE_URL='http://www.qtrpi.com/downloads'
4-
53
source ${0%/*}/utils/common.sh
64

75
# prepare environment
8-
$UTILS_DIR/utils/init-common.sh
6+
$UTILS_DIR/init-common.sh
7+
$UTILS_DIR/synchronize-toolchain.sh
98
cd_root
109

11-
# download and unzip sysroot
12-
message 'Download sysroot-minimal'
13-
SYSROOT_ZIP=sysroot-minimal-latest.zip
14-
curl -o $SYSROOT_ZIP $QTRPI_BASE_URL/sysroot/qtrpi-sysroot-minimal-latest.zip
15-
unzip $SYSROOT_ZIP
16-
$UTILS_DIR/utils/switch-sysroot.sh minimal
17-
18-
# download qtrpi
19-
message 'Download qtrpi binaries'
20-
QTRPI_ZIP="qtrpi-${DEVICE_NAME}_qt-${QT_VERSION}.zip"
21-
curl -o $QTRPI_ZIP $QTRPI_BASE_URL/qtrpi/$DEVICE_NAME/$QTRPI_ZIP
22-
unzip $QTRPI_ZIP
10+
download_sysroot_minimal
11+
download_qtrpi_binaries
2312

24-
# create symlink
25-
ln -sf $ROOT/raspi/qt5/bin/qmake $ROOT/bin/qmake-qtrpi

qt-modules.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Qt modules list
2+
qtbase
3+
qtdeclarative
4+
qt3d
5+
qtquickcontrols
6+
qtquickcontrols2
7+
qtserialport
8+
qtsvg

0 commit comments

Comments
 (0)