Skip to content

Commit

Permalink
Docker: Create Android Build
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Sep 20, 2024
1 parent 5a22708 commit cb6082c
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 0 deletions.
31 changes: 31 additions & 0 deletions deploy/docker/Dockerfile-build-android-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:22.04

ARG QT_VERSION=6.6.3
ARG QT_MODULES="qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors"

ENV DEBIAN_FRONTEND noninteractive

ENV DISPLAY :99

ENV QT_PATH /opt/Qt
ENV QT_HOST_PATH $QT_PATH/${QT_VERSION}/gcc_64
ENV QT_DESKTOP $QT_PATH/${QT_VERSION}/android_arm64_v8a

ENV PATH /usr/lib/ccache:$QT_DESKTOP/bin:$PATH

COPY tools/setup/install-dependencies-android-debian.sh /tmp/qt/
RUN /tmp/qt/install-dependencies-android-debian.sh

# Install Qt Android
COPY tools/setup/install-qt-android-debian.sh /tmp/qt/
RUN /tmp/qt/install-qt-android-debian.sh

# Reconfigure locale
RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales

RUN git config --global --add safe.directory /project/source

WORKDIR /project/build
CMD $QT_DESKTOP/bin/qt-cmake -S /project/source -B . -G Ninja -DCMAKE_BUILD_TYPE=Debug -DQT_HOST_PATH=$QT_HOST_PATH -DQT_ANDROID_BUILD_ALL_ABIS=OFF -DQT_ANDROID_ABIS="arm64-v8a" -DQT_ANDROID_SIGN_APK=OFF -DQGC_STABLE_BUILD=OFF ; \
cmake --build . --target all --config Debug ; \
cmake --install . --config Debug
8 changes: 8 additions & 0 deletions deploy/docker/run-docker-android-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Run this from root directory

set -e

docker build --file ./deploy/docker/Dockerfile-build-android-debian -t qgc-android-debian-docker .
docker run --rm -v ${PWD}:/project/source -v ${PWD}/build:/project/build qgc-android-debian-docker
File renamed without changes.
32 changes: 32 additions & 0 deletions tools/setup/install-dependencies-android-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e

apt update -y --quiet

# Build Tools
DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
appstream \
binutils \
build-essential \
ccache \
cmake \
cppcheck \
file \
g++ \
gcc \
gdb \
git \
gnupg \
gnupg2 \
libfuse2 \
libfuse3-3 \
libtool \
locales \
make \
ninja-build \
patchelf \
pkgconf \
python3 \
python3-pip \
rsync
35 changes: 35 additions & 0 deletions tools/setup/install-qt-android-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

QT_VERSION="${QT_VERSION:-6.6.3}"
QT_PATH="${QT_PATH:-/opt/Qt}"
QT_HOST="${QT_HOST:-linux}"
QT_TARGET="${QT_TARGET:-android}"
QT_ARCH="${QT_ARCH:-android_arm64_v8a}"
QT_MODULES="${QT_MODULES:-qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors}"

set -e

echo "QT_VERSION $QT_VERSION"
echo "QT_PATH $QT_PATH"
echo "QT_HOST $QT_HOST"
echo "QT_TARGET $QT_TARGET"
echo "QT_ARCH $QT_ARCH"
echo "QT_MODULES $QT_MODULES"

apt update
apt install python3 python3-pip -y
pip3 install setuptools wheel py7zr ninja cmake aqtinstall
aqt install-qt ${QT_HOST} ${QT_TARGET} ${QT_VERSION} ${QT_ARCH} -O ${QT_PATH} -m ${QT_MODULES} --autodesktop
export PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/bin/):$PATH
export PKG_CONFIG_PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib/pkgconfig):$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib):$LD_LIBRARY_PATH
export QT_ROOT_DIR=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH})
export QT_PLUGIN_PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/plugins)
export QML2_IMPORT_PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/qml)

echo "PATH $PATH"
echo "PKG_CONFIG_PATH $PKG_CONFIG_PATH"
echo "LD_LIBRARY_PATH $LD_LIBRARY_PATH"
echo "QT_ROOT_DIR $QT_ROOT_DIR"
echo "QT_PLUGIN_PATH $QT_PLUGIN_PATH"
echo "QML2_IMPORT_PATH $QML2_IMPORT_PATH"

0 comments on commit cb6082c

Please sign in to comment.