Skip to content
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

Docker: Create Android Build #11855

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions deploy/docker/Dockerfile-build-android-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:22.04

ARG QT_VERSION=6.6.3

ENV DEBIAN_FRONTEND noninteractive

ENV DISPLAY :99

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

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

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

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

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

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

WORKDIR /project/build
CMD $QT_ROOT_DIR/bin/qt-cmake -S /project/source -B . -G Ninja -DCMAKE_BUILD_TYPE=Release -DQT_HOST_PATH=$QT_HOST_PATH -DQT_ANDROID_BUILD_ALL_ABIS=OFF -DQT_ANDROID_ABIS="arm64-v8a" -DQT_ANDROID_SIGN_APK=OFF ; \
cmake --build . --target all --config Debug ; \
cmake --install . --config Debug
8 changes: 2 additions & 6 deletions deploy/docker/Dockerfile-build-ubuntu
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
FROM ubuntu:22.04
LABEL authors="Daniel Agar <[email protected]>, Patrick José Pereira <[email protected]>"

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_DESKTOP $QT_PATH/${QT_VERSION}/gcc_64
ENV QT_ROOT_DIR $QT_PATH/${QT_VERSION}/gcc_64

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

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

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

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

RUN git config --global --add safe.directory /project/source
Expand Down
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 . --no-cache
docker run --rm -v ${PWD}:/project/source -v ${PWD}/build:/project/build qgc-android-debian-docker
File renamed without changes.
36 changes: 36 additions & 0 deletions tools/setup/install-dependencies-android-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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 \
openjdk-17-jdk \
wget2 \
unzip \
android-sdk
48 changes: 48 additions & 0 deletions tools/setup/install-qt-android-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

QT_VERSION="${QT_VERSION:-6.6.3}"
QT_PATH="${QT_PATH:-/opt/Qt}"
QT_HOST="${QT_HOST:-linux}"
QT_HOST_ARCH="${QT_HOST_ARCH:-gcc_64}"
QT_TARGET="${QT_TARGET:-android}"
QT_TARGET_ARCH="${QT_TARGET_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_TARGET_ARCH $QT_TARGET_ARCH"
echo "QT_MODULES $QT_MODULES"

wget2 https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip commandlinetools-linux-8512546_latest.zip
mkdir -p /opt/Android/Sdk/cmdline-tools/latest/
mv cmdline-tools/* /opt/Android/Sdk/cmdline-tools/latest/
/opt/Android/Sdk/cmdline-tools/latest/bin/sdkmanager "ndk;25.1.8937393"
export ANDROID_NDK_HOME=/opt/Android/Sdk/ndk/25.1.8937393
export PATH=$PATH:$ANDROID_NDK_HOME

apt update
apt install python3 python3-pip -y
pip3 install setuptools wheel py7zr ninja cmake aqtinstall
aqt install-qt ${QT_HOST} desktop ${QT_VERSION} ${QT_HOST_ARCH} -O ${QT_PATH} -m ${QT_MODULES}
aqt install-qt ${QT_HOST} ${QT_TARGET} ${QT_VERSION} ${QT_TARGET_ARCH} -O ${QT_PATH} -m ${QT_MODULES} --autodesktop

export QT_ROOT_DIR=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_TARGET_ARCH})
export QT_HOST_PATH=$(readlink -e ${QT_PATH}/${QT_VERSION}/${QT_HOST_ARCH})
export QT_PLUGIN_PATH=$(readlink -e ${QT_ROOT_DIR}/plugins)
export QML2_IMPORT_PATH=$(readlink -e ${QT_ROOT_DIR}/qml)
export PATH=$(readlink -e ${QT_ROOT_DIR}/bin/):$PATH
export PKG_CONFIG_PATH=$(readlink -e ${QT_ROOT_DIR}/lib/pkgconfig):$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$(readlink -e ${QT_ROOT_DIR}/lib):$LD_LIBRARY_PATH

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_HOST_PATH $QT_HOST_PATH"
echo "QT_PLUGIN_PATH $QT_PLUGIN_PATH"
echo "QML2_IMPORT_PATH $QML2_IMPORT_PATH"
Loading