...
  View open merge request
Commits (3)
......@@ -10,3 +10,6 @@
[submodule "3rdparty/KDE/extra-cmake-modules"]
path = 3rdparty/KDE/extra-cmake-modules
url = https://github.com/KDE/extra-cmake-modules.git
[submodule "3rdparty/qt-cmake-android"]
path = 3rdparty/qt-cmake-android
url = https://gitlab.com/rpdev/qt-cmake-android.git
Subproject commit 85ad3534bf7489643be6184ba921e4c0d65cbf8c
......@@ -211,7 +211,7 @@ public:
class PrivateKeyEntry : public Entry
{
public:
using Object::Object;
using Entry::Entry;
inline PrivateKeyEntry(const Entry &init): Entry(init) {}
......
cmake_minimum_required(VERSION 3.5.1)
# Auto-detect Android build from within Qt Creator:
include(./3rdparty/qt-cmake-android/cmake/autodetect-android-build.cmake)
project(opentodolist)
# Include modules:
include(cmake/options.cmake)
include(cmake/version.cmake)
include(cmake/BuildLinuxAppImage.cmake)
include(cmake/qt-android-mk-apk.cmake)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......
......@@ -40,12 +40,19 @@ if(ANDROID)
if(NOT "${OPENTODOLIST_ANDROID_EXTRA_LIBS}" STREQUAL "")
set(EXTRA_LIBS "${EXTRA_LIBS},${OPENTODOLIST_ANDROID_EXTRA_LIBS}")
endif()
set(
ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
CACHE INTERNAL "Extra files for Android deployment"
)
set(
ANDROID_EXTRA_LIBS "${EXTRA_LIBS}"
CACHE INTERNAL "Extra libraries to include in APK"
)
qt_android_build_apk(
TARGET OpenTodoList
PACKAGE_NAME net.rpdev.opentodolist
QML_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}
ANDROID_EXTRA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/android
EXTRA_LIBS "${EXTRA_LIBS}"
)
else()
add_executable(OpenTodoList ${APP_FLAGS} ${APP_SOURCES} ${APP_RESOURCES})
......
FROM registry.gitlab.com/rpdev/opentodolist:android-base
ADD qt-installer-script.js /
RUN \
wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run && \
chmod +x qt-unified-linux-x64-online.run && \
./qt-unified-linux-x64-online.run --script qt-installer-script.js \
--platform minimal --no-force-installations -v
ENV QT_ROOT /opt/Qt/5.11.2/android_armv7/
IMAGE ?= registry.gitlab.com/rpdev/opentodolist:android-arm
help:
@echo "Targets:"
@echo " build - Build the image."
@echo " publish - Upload the image to GitLab."
build:
buildah bud --pull -t ${IMAGE} .
publish:
buildah push docker://${IMAGE}
login:
podman login registry.gitlab.com
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function()
{
gui.currentPageWidget().TargetDirectoryLineEdit.setText("/opt/Qt");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.pageById(QInstaller.ComponentSelection);
widget.deselectAll();
widget.selectComponent("qt.qt5.5123.android_armv7");
widget.selectComponent("qt.qt5.5123.qtremoteobjects");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.pageById(QInstaller.LicenseCheck).AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function()
{
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
gui.clickButton(buttons.FinishButton);
}
FROM registry.gitlab.com/rpdev/opentodolist:android-base
ADD qt-installer-script.js /
RUN \
wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run && \
chmod +x qt-unified-linux-x64-online.run && \
./qt-unified-linux-x64-online.run --script qt-installer-script.js \
--platform minimal --no-force-installations -v
ENV QT_ROOT /opt/Qt/5.11.2/android_arm64_v8a/
IMAGE ?= registry.gitlab.com/rpdev/opentodolist:android-arm64
help:
@echo "Targets:"
@echo " build - Build the image."
@echo " publish - Upload the image to GitLab."
build:
buildah bud --pull -t ${IMAGE} .
publish:
buildah push docker://${IMAGE}
login:
podman login registry.gitlab.com
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function()
{
gui.currentPageWidget().TargetDirectoryLineEdit.setText("/opt/Qt");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.pageById(QInstaller.ComponentSelection);
widget.deselectAll();
widget.selectComponent("qt.qt5.5123.android_arm64_v8a");
widget.selectComponent("qt.qt5.5123.qtremoteobjects");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.pageById(QInstaller.LicenseCheck).AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function()
{
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
gui.clickButton(buttons.FinishButton);
}
FROM fedora
RUN \
yum install -y \
wget make cmake git java-1.8.0-openjdk java-1.8.0-openjdk-devel \
libX11-xcb unzip extra-cmake-modules.noarch \
ncurses-compat-libs gradle ninja-build \
qt5-qtxmlpatterns-devel qt5-linguist appstream \
&& \
cd /opt && \
mkdir android && \
cd android && \
mkdir android-sdk && \
cd android-sdk && \
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
unzip *.zip && \
rm *.zip && \
cd .. && \
wget https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip && \
unzip *.zip && \
rm *.zip && \
(sleep 5 ; while true ; do sleep 1 ; printf 'y\r\n' ; done ) | \
./android-sdk/tools/bin/sdkmanager --update && \
(sleep 5 ; while true ; do sleep 1 ; printf 'y\r\n' ; done ) | \
./android-sdk/tools/bin/sdkmanager "platforms;android-26" "build-tools;27.0.3" && \
yum clean all
ENV ANDROID_SDK_ROOT /opt/android/android-sdk
ENV ANDROID_NDK /opt/android/android-ndk-r19c
ENV ANDROID_NDK_ROOT /opt/android/android-ndk-r19c
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0
IMAGE ?= registry.gitlab.com/rpdev/opentodolist:android-base
help:
@echo "Targets:"
@echo " build - Build the image."
@echo " publish - Upload the image to GitLab."
build:
buildah bud --pull -t ${IMAGE} .
publish:
buildah push docker://${IMAGE}
login:
podman login registry.gitlab.com
FROM registry.gitlab.com/rpdev/opentodolist:android-base
ADD qt-installer-script.js /
RUN \
wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run && \
chmod +x qt-unified-linux-x64-online.run && \
./qt-unified-linux-x64-online.run --script qt-installer-script.js \
--platform minimal --no-force-installations -v
ENV QT_ROOT /opt/Qt/5.11.2/android_x86/
IMAGE ?= registry.gitlab.com/rpdev/opentodolist:android-x86
help:
@echo "Targets:"
@echo " build - Build the image."
@echo " publish - Upload the image to GitLab."
build:
buildah bud --pull -t ${IMAGE} .
publish:
buildah push docker://${IMAGE}
login:
podman login registry.gitlab.com
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function()
{
gui.currentPageWidget().TargetDirectoryLineEdit.setText("/opt/Qt");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.pageById(QInstaller.ComponentSelection);
widget.deselectAll();
widget.selectComponent("qt.qt5.5123.android_arm64_v8a");
widget.selectComponent("qt.qt5.5123.qtremoteobjects");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.pageById(QInstaller.LicenseCheck).AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function()
{
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
gui.clickButton(buttons.FinishButton);
}
{
"description": "This file is read by androiddeployqt",
"qt": "@QT5_INSTALL_PREFIX@",
"sdk": "@ANDROID_SDK_ROOT@",
"ndk": "@CMAKE_ANDROID_NDK@",
"toolchain-prefix": "@APK_NDK_TOOLCHAIN_PREFIX@",
"tool-prefix": "@CMAKE_CXX_ANDROID_TOOLCHAIN_MACHINE@",
"toolchain-version": "@CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION@",
"ndk-host": "@CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG@",
"target-architecture": "@CMAKE_ANDROID_ARCH_ABI@",
"application-binary": "@APK_TARGET_OUTPUT_FILENAME@",
"android-package": "@APK_PACKAGE_NAME@",
"qml-root-path": "@APK_QML_ROOT_PATH@",
"sdkBuildToolsRevision": "@APK_SDK_BUILD_TOOLS_VERSION@",
"android-package-source-directory": "@APK_ANDROID_EXTRA_FILES@",
"android-extra-libs": "@APK_EXTRA_LIBS@"
}
include(CMakeParseArguments)
set(QT_ANDROID_MK_APK_DIR ${CMAKE_CURRENT_LIST_DIR})
function(qt_android_build_apk)
set(options)
set(oneValueArgs
TARGET PACKAGE_NAME ANDROID_EXTRA_FILES QML_ROOT_PATH
SDK_BUILD_TOOLS_VERSION EXTRA_LIBS)
set(multiValueArgs)
cmake_parse_arguments(
APK "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Gather required variables to create the configuration file.
find_package(Qt5 COMPONENTS Core REQUIRED)
# Qt5Core_DIR now points to $Qt5InstallPrefix/lib/cmake/Qt5Core, so
# we get the parent directory three times:
get_filename_component(QT5_INSTALL_PREFIX "${Qt5Core_DIR}/../../.." ABSOLUTE)
message("Qt5 installed in ${QT5_INSTALL_PREFIX}")
# Adjust QML root path if not set:
if(NOT APK_QML_ROOT_PATH)
set(APK_QML_ROOT_PATH $<TARGET_FILE_DIR:${APK_TARGET}>)
endif()
# Get he toolchain prefix, i.e. the folder name within the
# toolchains/ folder without the compiler version
# APK_NDK_TOOLCHAIN_PREFIX
file(RELATIVE_PATH APK_NDK_TOOLCHAIN_PREFIX ${CMAKE_ANDROID_NDK} ${CMAKE_CXX_COMPILER})
string(REPLACE "/" ";" APK_NDK_TOOLCHAIN_PREFIX ${APK_NDK_TOOLCHAIN_PREFIX})
list(GET APK_NDK_TOOLCHAIN_PREFIX 1 APK_NDK_TOOLCHAIN_PREFIX)
string(LENGTH "-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}" VERSION_LENGTH)
string(LENGTH "${APK_NDK_TOOLCHAIN_PREFIX}" FOLDER_LENGTH)
math(EXPR PREFIX_LENGTH ${FOLDER_LENGTH}-${VERSION_LENGTH})
string(SUBSTRING "${APK_NDK_TOOLCHAIN_PREFIX}" 0 ${PREFIX_LENGTH} APK_NDK_TOOLCHAIN_PREFIX)
# Get path to the target:
set(APK_TARGET_OUTPUT_FILENAME $<TARGET_FILE:${APK_TARGET}>)
# Get Android SDK build tools version:
if(NOT APK_SDK_BUILD_TOOLS_VERSION)
file(GLOB sdk_versions RELATIVE ${ANDROID_SDK_ROOT}/build-tools
${ANDROID_SDK_ROOT}/build-tools/*)
list(GET sdk_versions -1 APK_SDK_BUILD_TOOLS_VERSION)
endif()
# Step 1: Create an intermediate config file. At this point,
# the generator expressions will we use are not yet resolved.
configure_file(
${QT_ANDROID_MK_APK_DIR}/qt-android-deployment.json.in
${CMAKE_CURRENT_BINARY_DIR}/${APK_TARGET}-config.json.pre)
# Step 2: Run file(CONFIGURE ...) to create the final config JSON
# with generator expressions resolved:
file(
GENERATE
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${APK_TARGET}-config.json
INPUT ${CMAKE_CURRENT_BINARY_DIR}/${APK_TARGET}-config.json.pre)
# Step 3: Create a custom target which will build our APK:
set(APK_DIR ${CMAKE_CURRENT_BINARY_DIR}/${APK_TARGET}-apk-build)
if(NOT APK_ANDROID_EXTRA_FILES)
set(
APK_ANDROID_EXTRA_FILES
${QT5_INSTALL_PREFIX}/src/android/templates/)
endif()
if(JAVA_HOME)
set(ANDROIDDEPLOYQT_EXTRA_ARGS
${ANDROIDDEPLOYQT_EXTRA_ARGS} --jdk '${JAVA_HOME}')
endif()
if(${CMAKE_BUILD_TYPE} STREQUAL Release)
set(ANDROIDDEPLOYQT_EXTRA_ARGS
${ANDROIDDEPLOYQT_EXTRA_ARGS} --release)
set(APK_FILENAME ${APK_TARGET}-apk-build-release-unsigned.apk)
else()
set(APK_FILENAME ${APK_TARGET}-apk-build-debug.apk)
endif()
add_custom_target(
${APK_TARGET}-apk
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APK_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory
${QT5_INSTALL_PREFIX}/src/android/templates/
${APK_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory
${APK_ANDROID_EXTRA_FILES}/
${APK_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory
${APK_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}
COMMAND ${CMAKE_COMMAND} -E copy
${APK_TARGET_OUTPUT_FILENAME}
${APK_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}
COMMAND ${QT5_INSTALL_PREFIX}/bin/androiddeployqt
--verbose
--output ${APK_DIR}
--input ${CMAKE_CURRENT_BINARY_DIR}/${APK_TARGET}-config.json
--deployment bundled
--gradle
${ANDROIDDEPLOYQT_EXTRA_ARGS}
)
# Step 4: Create a custom target which pushes the created APK onto
# the device.
add_custom_target(
${APK_TARGET}-apk-install
COMMAND ${ANDROID_SDK_ROOT}/platform-tools/adb install -r
${APK_DIR}/build/outputs/apk/${APK_FILENAME}
DEPENDS
${APK_TARGET}-apk
)
endfunction()