Add AArch64 crossbuild via Podman
All checks were successful
Build App / Build (push) Successful in 2m32s

Limit FPS
Config screen W/H
This commit is contained in:
2025-04-04 17:42:19 +02:00
parent 4e58d9a50e
commit b74831cdff
5 changed files with 42 additions and 15 deletions

View File

@@ -8,22 +8,15 @@ jobs:
steps: steps:
- name: Update - name: Update
run: | run: |
sudo dpkg --add-architecture arm64
sed -i 's/deb /deb [arch=amd64] /g' /etc/apt/sources.list
cat /etc/apt/sources.list cat /etc/apt/sources.list
# TODO : Add from previous file # TODO : Add from previous file
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main multiverse restricted universe" >> /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main multiverse restricted universe" >> /etc/apt/sources.list
sudo apt-get update -y -qq || true sudo apt-get update -y -qq || true
sudo apt-get install -y build-essential git make zip libsdl2-dev libsdl2-2.0-0 libsdl2-net-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-gfx-dev libsdl2-ttf-dev gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu sudo apt-get install -y build-essential git make zip libsdl2-dev libsdl2-2.0-0 libsdl2-net-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-gfx-dev libsdl2-ttf-dev gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
#ARM64 #ARM64
sudo apt-get install -y libsdl2-dev:arm64 libsdl2-2.0-0:arm64 libsdl2-net-dev:arm64 libsdl2-mixer-dev:arm64 libsdl2-image-dev:arm64 libsdl2-gfx-dev:arm64 libsdl2-ttf-dev:arm64
#sudo apt install -y libssl-dev:arm64 libasound2-dev:arm64 #sudo apt install -y libssl-dev:arm64 libasound2-dev:arm64
sudo sh -c "echo '192.168.1.253 descartes.local' >> /etc/hosts" sudo sh -c "echo '192.168.1.253 descartes.local' >> /etc/hosts"
sudo sh -c "echo '192.168.1.253 build.ladose.net' >> /etc/hosts" sudo sh -c "echo '192.168.1.253 build.ladose.net' >> /etc/hosts"
sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
sudo -E $HOME/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
- name: GetDNS - name: GetDNS
run: | run: |
@@ -37,15 +30,13 @@ jobs:
run: | run: |
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
cargo build --release cargo build --release
cargo build --release --target=aarch64-unknown-linux-gnu
- name: Zip file - name: Zip file
run: | run: |
zip -rj build.zip ./target/release/ zip -rj build.zip ./target/release/ladose-caller ./font/
zip -rj build-Aarch64.zip ./target/release/
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
path: build-linux64.zip path: build.zip
name: build-linux64.zip name: build-linux64.zip
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
@@ -56,6 +47,5 @@ jobs:
with: with:
tag_name: release-${{ steps.date.outputs.date }} tag_name: release-${{ steps.date.outputs.date }}
files: |- files: |-
build-winx64.zip
build-linux64.zip build-linux64.zip

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM rust:latest
RUN dpkg --add-architecture arm64
RUN apt update && apt upgrade -y
RUN apt install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
RUN apt-get install -y libsdl2-dev:arm64 libsdl2-2.0-0:arm64 libsdl2-net-dev:arm64 libsdl2-mixer-dev:arm64 libsdl2-image-dev:arm64 libsdl2-gfx-dev:arm64 libsdl2-ttf-dev:arm64
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup toolchain add stable-aarch64-unknown-linux-gnu --force-non-host
WORKDIR /app
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
CMD ["cargo", "build", "--target", "aarch64-unknown-linux-gnu","-r"]

12
buildaarch64.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
echo "build podman image"
podman build . -t cross_compile/rust_aarch64
echo "run build"
podman run --rm -v .:/app cross_compile/rust_aarch64
ssh tom@raspberrypi.local -f 'sudo systemctl stop lightdm'
ssh tom@raspberrypi.local -f 'killall ladose-caller'
scp ./target/aarch64-unknown-linux-gnu/release/ladose-caller tom@raspberrypi.local:
ssh tom@raspberrypi.local -f 'sudo systemctl start lightdm'

9
config.toml Normal file
View File

@@ -0,0 +1,9 @@
tournament = 'tournoi-kiouze-test'
update = 2
fullscreen = true
font_size = 40
font_size_departure = 60
smash_key = 'Bearer API_KEY'
margin = 10
w = 1920
h = 1080

View File

@@ -19,6 +19,8 @@ use serde::Deserialize;
#[derive(Deserialize,Clone)] #[derive(Deserialize,Clone)]
pub struct Config { pub struct Config {
tournament: String, tournament: String,
w : u32,
h : u32,
update: Option<u32>, update: Option<u32>,
fullscreen: Option<bool>, fullscreen: Option<bool>,
smash_key: String, smash_key: String,
@@ -40,7 +42,7 @@ struct Line<'a> {
impl Config { impl Config {
fn new() -> Self { fn new() -> Self {
Self { tournament: String::new(), update: Some(1),fullscreen:Some(false), smash_key: String::new(), font_size: 30 , font_size_departure : 45, margin: 10,tournament_image: None } Self { tournament: String::new(), update: Some(1),fullscreen:Some(false), smash_key: String::new(), font_size: 30 , font_size_departure : 45, margin: 10,tournament_image: None , w : 1920, h: 1080}
} }
} }
@@ -159,7 +161,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let sdl_context = sdl2::init().unwrap(); let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap(); let video_subsystem = sdl_context.video().unwrap();
let mut build = video_subsystem.window("LaDOSE-SNCF", 1280, 720); let mut build = video_subsystem.window("LaDOSE-SNCF", box_config.w, box_config.h);
if fullscreen { if fullscreen {
build.fullscreen(); build.fullscreen();
} }
@@ -217,6 +219,6 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
canvas.present(); canvas.present();
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 60)); ::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 30));
} }
} }