diff --git a/deploy/docker/Dockerfile-build-android-debian b/deploy/docker/Dockerfile-build-android-debian new file mode 100644 index 00000000000..2a0513df381 --- /dev/null +++ b/deploy/docker/Dockerfile-build-android-debian @@ -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 diff --git a/deploy/docker/Dockerfile-build-ubuntu b/deploy/docker/Dockerfile-build-ubuntu index 5ff6239088f..c9ddf5cea46 100644 --- a/deploy/docker/Dockerfile-build-ubuntu +++ b/deploy/docker/Dockerfile-build-ubuntu @@ -1,26 +1,22 @@ FROM ubuntu:22.04 -LABEL authors="Daniel Agar , Patrick José Pereira " 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 diff --git a/deploy/docker/run-docker-android-debian.sh b/deploy/docker/run-docker-android-debian.sh new file mode 100755 index 00000000000..03452091f20 --- /dev/null +++ b/deploy/docker/run-docker-android-debian.sh @@ -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 diff --git a/deploy/docker/run-docker.sh b/deploy/docker/run-docker-ubuntu.sh similarity index 100% rename from deploy/docker/run-docker.sh rename to deploy/docker/run-docker-ubuntu.sh diff --git a/tools/setup/install-dependencies-android-debian.sh b/tools/setup/install-dependencies-android-debian.sh new file mode 100755 index 00000000000..46f011faf5f --- /dev/null +++ b/tools/setup/install-dependencies-android-debian.sh @@ -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 diff --git a/tools/setup/install-qt-android-debian.sh b/tools/setup/install-qt-android-debian.sh new file mode 100755 index 00000000000..8c8056f4b90 --- /dev/null +++ b/tools/setup/install-qt-android-debian.sh @@ -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"