Skip to content

Commit 0610a29

Browse files
committed
chore: add docker file for cross compilation and scripts
1 parent db3dc42 commit 0610a29

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

docker/Dockerfile_cross

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM debian:12
2+
3+
# Set environment variables to avoid interactive prompts during package installations
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# Update package list and install necessary packages, including Git
7+
RUN apt-get update && \
8+
apt-get install -y --no-install-recommends \
9+
gcc \
10+
g++ \
11+
cmake \
12+
libdrm-dev \
13+
libsdl2-dev \
14+
libsdl2-image-dev \
15+
wayland-protocols \
16+
build-essential \
17+
ca-certificates \
18+
curl \
19+
git \
20+
&& apt-get clean \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+
# Verify that GCC, G++, and CMake are installed
24+
RUN gcc --version && g++ --version && cmake --version
25+
26+
WORKDIR app
27+
28+
CMD ["./scripts/build_app.sh"]

scripts/build_app.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
cmake -B build-arm64 -DCMAKE_BUILD_TYPE=Release
4+
cmake --build build-arm64 -j$(nproc)

scripts/docker_setup.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Get the directory of the current script and move to the parent directory
4+
# where Dockerfile is located
5+
SCRIPT_PATH=$(readlink -f $0)
6+
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
cd "$ROOT_DIR"
9+
10+
echo $(pwd)
11+
12+
# Check if the correct argument is passed
13+
if [[ "$1" == "--create-image" ]]; then
14+
echo "Building the Docker container..."
15+
docker build --platform linux/arm64/v8 -t lvgl-build-arm64-image -f docker/Dockerfile_cross .
16+
17+
elif [[ "$1" == "--build-app" ]]; then
18+
echo "Running the Docker container..."
19+
docker run --rm --platform linux/arm64/v8 -v $(pwd):/app lvgl-build-arm64-image
20+
21+
else
22+
echo "Usage: $0 --create-image or --build-app"
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)