-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: write scripts for building a Pi 4 (64-bit) WebView #2216
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ target_wrapper.* | |
|
||
# QtCreator CMake | ||
CMakeLists.txt.user* | ||
!docker-compose.yml |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
services: | ||
builder-pi5: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile.pi5 | ||
environment: | ||
- GIT_HASH=${GIT_HASH} | ||
- PLATFORM=pi5 | ||
tty: true | ||
stdin_open: true | ||
volumes: | ||
- "~/tmp/pi5/build:/build:Z" | ||
- "./examples:/src/examples" | ||
- "./:/webview:ro" | ||
- "./scripts/build_webview.sh:/scripts/build_webview.sh" | ||
profiles: [pi5] | ||
builder-pi4-64: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile.pi4-64 | ||
environment: | ||
- GIT_HASH=${GIT_HASH} | ||
- PLATFORM=pi4-64 | ||
tty: true | ||
stdin_open: true | ||
volumes: | ||
- "~/tmp/pi4-64/build:/build:Z" | ||
- "./examples:/src/examples" | ||
- "./:/webview:ro" | ||
- "./scripts/build_webview.sh:/scripts/build_webview.sh" | ||
profiles: [pi4-64] |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can maybe create a script that generates custom Dockerfiles based on the given platform (e.g., pi1, pi2, pi3, pi4, pi4-64, pi5, etc.). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# vim:ft=dockerfile | ||
|
||
FROM balenalib/raspberrypi4-64-debian:bookworm | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Build dependencies for the Qt 6 app | ||
RUN apt-get -y update && apt-get install -y \ | ||
build-essential \ | ||
cmake \ | ||
qt6-base-dev \ | ||
qt6-webengine-dev | ||
|
||
RUN mkdir -p /scripts /src | ||
|
||
WORKDIR /build | ||
|
||
CMD ["bash"] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Building WebView via Prebuilt Qt | ||
|
||
## Overview | ||
|
||
This method only works on the following devices: | ||
|
||
- Raspberry Pi 4 (64-bit) | ||
- Raspberry Pi 5 (64-bit) | ||
|
||
## Prerequisites | ||
|
||
> [!NOTE] | ||
> Cross-compilation is not yet supported. | ||
> You need to have the following installed and set up on your Raspberry Pi 4 or Raspberry Pi 5 device: | ||
> - Docker (arm64) | ||
> - Code editor of your choice (e.g., Visual Studio Code, Neovim, etc.) | ||
|
||
## Building the WebView | ||
|
||
Clone the repository: | ||
|
||
```bash | ||
$ git clone https://github.com/Screenly/Anthias.git | ||
``` | ||
|
||
Navigate to the `webview` directory: | ||
|
||
```bash | ||
$ cd /path/to/Anthias/webview | ||
``` | ||
|
||
Initialize environment variables: | ||
|
||
```bash | ||
$ export GIT_HASH=$(git rev-parse --short HEAD) | ||
|
||
$ export COMPOSE_PROFILES=pi5 # For Raspberry Pi 5 | ||
$ export COMPOSE_PROFILES=pi4-64 # For Raspberry Pi 4 | ||
``` | ||
|
||
Start the builder container with the following command: | ||
|
||
```bash | ||
$ docker compose up -d --build | ||
``` | ||
|
||
You should now be able to invoke a run executing either of the following commands: | ||
|
||
```bash | ||
$ docker compose exec builder-pi5 /webview/build_webview.sh | ||
# or | ||
$ docker compose exec builder-pi4-64 /webview/build_webview.sh | ||
``` | ||
|
||
```bash | ||
$ docker compose exec builder-pi5 bash | ||
# or | ||
$ docker compose exec builder-pi4-64 bash | ||
|
||
# Once you're in the container, run the following command: | ||
$ /scripts/build_webview.sh | ||
``` | ||
|
||
The resulting files will be placed in `~/tmp/<platform>/build/release`, where `<platform>` is either `pi5` or `pi4-64`. | ||
|
||
When you're done, you can stop and remove the container with the following commands: | ||
|
||
```bash | ||
$ docker compose down | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,19 @@ | |
#include "mainwindow.h" | ||
#include "view.h" | ||
|
||
#include <QGuiApplication> | ||
#include <QScreen> | ||
|
||
MainWindow::MainWindow() : QMainWindow() | ||
{ | ||
view = new View(this); | ||
view -> settings() -> setAttribute(QWebEngineSettings::LocalStorageEnabled, false); | ||
view -> settings() -> setAttribute(QWebEngineSettings::ShowScrollBars, false); | ||
setCentralWidget(view); | ||
|
||
QRect screenGeometry = QGuiApplication::primaryScreen()->geometry(); | ||
setGeometry(screenGeometry); | ||
showFullScreen(); | ||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make use of macros, which gets resolved before compilation. |
||
} | ||
|
||
void MainWindow::loadPage(const QString &uri) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor common attributes.