diff --git a/.github/scripts/build-qt.cmake b/.github/scripts/build-qt.cmake index b85aa844d0..afba30175c 100644 --- a/.github/scripts/build-qt.cmake +++ b/.github/scripts/build-qt.cmake @@ -138,9 +138,11 @@ if(EMSCRIPTEN) set(BASE_RELEASE_FLAGS -feature-optimize_full) else() set(BASE_DEBUG_INFO_FLAGS -separate-debug-info) + # Qt6 has various issues with link-time optimization. On Linux, rcc fails to + # build with a weird error about not finding qt_version_tag. # https://bugreports.qt.io/browse/QTBUG-72846 regressed in Qt6 due to # https://gitlab.kitware.com/cmake/cmake/-/issues/23864 - if(NOT APPLE OR QT_VERSION VERSION_LESS 6) + if(QT_VERSION VERSION_LESS 6) list(APPEND BASE_FLAGS -ltcg) endif() endif() @@ -275,6 +277,8 @@ if(BASE) patches/webgl_is_hard.diff patches/fusioncontrast-qt6.diff patches/macostabs-qt6.diff + patches/qtbug-127468.diff + patches/qt6androidmacros_build_tools_revision.diff ) endif() diff --git a/.github/scripts/cmake/BuildDependency.cmake b/.github/scripts/cmake/BuildDependency.cmake index a52b58d374..0d61e95ed9 100644 --- a/.github/scripts/cmake/BuildDependency.cmake +++ b/.github/scripts/cmake/BuildDependency.cmake @@ -15,6 +15,9 @@ foreach(path IN LISTS CMAKE_PREFIX_PATH) list(APPEND NEW_CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/${path}") endif() endforeach() +if(NOT NEW_CMAKE_PREFIX_PATH) + set(NEW_CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}") +endif() set(CMAKE_PREFIX_PATH ${NEW_CMAKE_PREFIX_PATH}) unset(NEW_CMAKE_PREFIX_PATH) @@ -315,27 +318,27 @@ function(_build_cmake build_type target_bits source_dir) "-DCMAKE_OBJCXX_FLAGS_INIT=-fno-omit-frame-pointer -fsanitize=address" ) endif() - endif() - if(CMAKE_TOOLCHAIN_FILE) - list(APPEND default_flags - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" - "-DANDROID_ABI=${ANDROID_ABI}" - "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" - "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on" - ) - elseif(CMAKE_ANDROID_NDK) - list(APPEND default_flags - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake" - "-DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}" - "-DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}" - "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" - "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on" - ) - endif() + if(CMAKE_TOOLCHAIN_FILE) + list(APPEND default_flags + "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + "-DANDROID_ABI=${ANDROID_ABI}" + "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" + "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on" + ) + elseif(CMAKE_ANDROID_NDK) + list(APPEND default_flags + "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake" + "-DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}" + "-DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}" + "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" + "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on" + ) + endif() - if(ANDROID_SDK_ROOT) - list(APPEND default_flags "-DANDROID_SDK=${ANDROID_SDK_ROOT}") + if(ANDROID_SDK_ROOT) + list(APPEND default_flags "-DANDROID_SDK=${ANDROID_SDK_ROOT}") + endif() endif() if(CMAKE_ARG_NO_DEFAULT_FLAGS OR CMAKE_ARG_NO_DEFAULT_BUILD_TYPE) diff --git a/.github/scripts/patches/qt6androidmacros_build_tools_revision.diff b/.github/scripts/patches/qt6androidmacros_build_tools_revision.diff new file mode 100644 index 0000000000..b6554a1fbf --- /dev/null +++ b/.github/scripts/patches/qt6androidmacros_build_tools_revision.diff @@ -0,0 +1,30 @@ +Description: Qt6 tries to allow setting the build tools revision via +QT_ANDROID_SDK_BUILD_TOOLS_REVISION, but fails to actually return it from this +function that's supposed to determine the version to use. This leads to it +generating an invalid gradle.properties file with a blank entry for the build +tools version. This patch fixes that function to actually return the version +properly. + +--- a/src/corelib/Qt6AndroidMacros.cmake ++++ b/src/corelib/Qt6AndroidMacros.cmake +@@ -5,7 +5,9 @@ + + # Locate newest Android sdk build tools revision + function(_qt_internal_android_get_sdk_build_tools_revision out_var) +- if (NOT QT_ANDROID_SDK_BUILD_TOOLS_REVISION) ++ if (QT_ANDROID_SDK_BUILD_TOOLS_REVISION) ++ set(${out_var} "${QT_ANDROID_SDK_BUILD_TOOLS_REVISION}") ++ else() + file(GLOB android_build_tools + LIST_DIRECTORIES true + RELATIVE "${ANDROID_SDK_ROOT}/build-tools" +@@ -17,8 +19,8 @@ + list(SORT android_build_tools) + list(REVERSE android_build_tools) + list(GET android_build_tools 0 android_build_tools_latest) ++ set(${out_var} "${android_build_tools_latest}" PARENT_SCOPE) + endif() +- set(${out_var} "${android_build_tools_latest}" PARENT_SCOPE) + endfunction() + + # The function appends to the 'out_var' a 'json_property' that contains the 'tool' path. If 'tool' diff --git a/.github/scripts/patches/qtbug-127468.diff b/.github/scripts/patches/qtbug-127468.diff new file mode 100644 index 0000000000..7a6548dc77 --- /dev/null +++ b/.github/scripts/patches/qtbug-127468.diff @@ -0,0 +1,53 @@ +From 27321bb7fae0f82cf069cea74438278d4706feb7 Mon Sep 17 00:00:00 2001 +From: Ville Voutilainen +Date: Sun, 18 Aug 2024 01:59:29 +0300 +Subject: [PATCH] Fix an evaluated use of std::declval in qjnitypes.h + +While other compilers don't seem to have trouble with this, the latest +NDK (27) compiler does. That compiler diagnoses the empty-pack case, even though in that case there is no actual use of declval, as the pack-expanded expression contains no use of declval. +For other compilers, that may work for functions that have no arguments, but will not work for any function that does have arguments; in that case, the attempt to use declval will always be ill-formed, and there will be an attempt to use declval. + +The fix is straightforward; we have a Ret(*)(Args...), its return type +is simply Ret. So use a simple trait instead of the result of a call. + +Task-number: QTBUG-127468 +Change-Id: I0dc9e1201914ab94acc2940870be7c6d8cb16c12 +Reviewed-by: Thiago Macieira +(cherry picked from commit 236c6ec6f4c777d0534539f1c293cfc74006a6eb) +Reviewed-by: Qt Cherry-pick Bot +(cherry picked from commit 1079d210d19cc05275228a17c318e5bdbcdeff6c) +--- + +diff --git a/src/corelib/kernel/qjnitypes.h b/src/corelib/kernel/qjnitypes.h +index 4317f75..5e07547 100644 +--- a/src/corelib/kernel/qjnitypes.h ++++ b/src/corelib/kernel/qjnitypes.h +@@ -123,12 +123,14 @@ + return makeTupleFromArgsHelper(args); + } + +-// Get the return type of a function point +-template +-auto nativeFunctionReturnType(Ret(*function)(Args...)) ++template ++struct NativeFunctionReturnType {}; ++ ++template ++struct NativeFunctionReturnType + { +- return function(std::declval()...); +-} ++ using type = Ret; ++}; + + } // namespace Detail + } // namespace QtJniMethods +@@ -139,7 +141,7 @@ + // the actual function with. This then takes care of implicit conversions, + // e.g. a jobject becomes a QJniObject. + #define Q_DECLARE_JNI_NATIVE_METHOD_HELPER(Method) \ +-static decltype(QtJniMethods::Detail::nativeFunctionReturnType(Method)) \ ++static QtJniMethods::Detail::NativeFunctionReturnType::type \ + va_##Method(JNIEnv *env, jclass thiz, ...) \ + { \ + va_list args; \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7efd22245e..45e3128c72 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ env: jobs: test: - name: ${{ matrix.cross_os || matrix.os }} ${{ matrix.arch }}${{ matrix.component && format(' {0}', matrix.component) }} Qt ${{ matrix.qt }}${{ matrix.cross_os && format(' on {0}', matrix.os) }} + name: ${{ matrix.cross_os || matrix.os }} ${{ matrix.cross_arch || matrix.arch }}${{ matrix.component && format(' {0}', matrix.component) }} Qt ${{ matrix.qt }}${{ matrix.cross_os && format(' on {0}', matrix.os) }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -44,59 +44,11 @@ jobs: # utterly confounding errors, so just explicitly specify each target. include: - os: ubuntu-20.04 - cross_os: '' + cross_os: Android34 component: '' - qt: 5.15.14 + qt: 6.7.2 arch: x86_64 - sccache_triplet: x86_64-unknown-linux-musl - build_flags: -DINITSYS=systemd -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: Release - collect_symbols: false - # This causes the AppImage to be generated, instead of just creating - # the portable tree, because there seems to be no way to separate - # these steps with linuxdeploy - # Even though the svg component is linked explicitly, - # linuxdeploy-plugin-qt does not seem to notice and so does not - # export the iconengine if it is not told that we really, really - # want svg plugins please - packager: >- - EXTRA_QT_PLUGINS="svg;" - VERSION="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '$(git describe)' }}" - cmake --install build --config Release - # The runner has multiple clang versions installed and CMake/Qt gets - # confused about which one to pick for some reason, so this also - # sets Clang_ROOT during the Qt build - qt_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev - libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev - libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev - libxext-dev libxfixes-dev libxrender-dev libx11-dev - libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev - libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev - libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev - libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev - libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev - libxcb-util-dev libinput-dev libvulkan-dev - libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev - libasound2-dev libpulse-dev libcups2-dev libssl-dev - libfontconfig1-dev && - echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV - ffmpeg_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - nasm yasm - other_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libsecret-1-dev - - - os: ubuntu-20.04 - cross_os: Android - component: '' - qt: 5.15.14 - arch: arm64 + cross_arch: arm64 sccache_triplet: x86_64-unknown-linux-musl build_type: Release collect_symbols: false @@ -106,96 +58,31 @@ jobs: "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" "-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" -DANDROID_ABI=arm64-v8a + -DANDROID_PLATFORM=android-34 cross_ffmpeg_args: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - -DANDROID_PLATFORM=android-23 + -DANDROID_PLATFORM=android-34 -DANDROID_ABI=arm64-v8a cross_other_args: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - -DANDROID_PLATFORM=android-23 + -DANDROID_PLATFORM=android-34 -DANDROID_ABI=arm64-v8a build_flags: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" - -DANDROID_PLATFORM=android-23 + -DANDROID_PLATFORM=android-34 -DANDROID_ABI=arm64-v8a - -DANDROID_SDK_PLATFORM=android-31 - -DANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH - # The runner has multiple clang versions installed and CMake/Qt gets - # confused about which one to pick for some reason, so this also - # sets Clang_ROOT during the Qt build - qt_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev - libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev - libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev - libxext-dev libxfixes-dev libxrender-dev libx11-dev - libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev - libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev - libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev - libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev - libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev - libxcb-util-dev libinput-dev libvulkan-dev - libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev - libasound2-dev libpulse-dev libcups2-dev libssl-dev - libfontconfig1-dev && - echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV - ffmpeg_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - yasm - other_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libsecret-1-dev - - - os: ubuntu-20.04 - cross_os: Android - component: '' - qt: 5.15.14 - arch: arm32 - sccache_triplet: x86_64-unknown-linux-musl - build_type: Release - collect_symbols: false - packager: cmake --install build --config Release --prefix . - cross_qt_args: >- + -DANDROID_SDK_PLATFORM=android-34 + -DQT_ANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - "-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" - -DANDROID_ABI=armeabi-v7a - cross_ffmpeg_args: >- - "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" - "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" - "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=armeabi-v7a - cross_other_args: >- - "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" - "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" - "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=armeabi-v7a - build_flags: >- - "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" - -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=armeabi-v7a - -DANDROID_SDK_PLATFORM=android-31 - -DANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH - # The runner has multiple clang versions installed and CMake/Qt gets - # confused about which one to pick for some reason, so this also - # sets Clang_ROOT during the Qt build qt_pre_build: > sudo apt-get update && sudo apt-get install --no-install-recommends @@ -216,105 +103,12 @@ jobs: ffmpeg_pre_build: > sudo apt-get update && sudo apt-get install --no-install-recommends - yasm + nasm yasm other_pre_build: > sudo apt-get update && sudo apt-get install --no-install-recommends libsecret-1-dev - - os: macos-13 - cross_os: '' - component: '' - qt: 6.7.2 - arch: x86_64 - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: Release - collect_symbols: false - sccache_triplet: x86_64-apple-darwin - packager: cpack --verbose --config build/CPackConfig.cmake -C Release - - - os: macos-14 - cross_os: '' - component: '' - qt: 6.7.2 - arch: arm64 - build_flags: -DBUILD_PACKAGE_SUFFIX=arm64 -G Ninja - build_type: Release - collect_symbols: false - sccache_triplet: aarch64-apple-darwin - packager: cpack --verbose --config build/CPackConfig.cmake -C Release - - - os: windows-latest - cross_os: '' - component: '' - qt: 5.15.14 - arch: x86_64 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: RelWithDebInfo - collect_symbols: true - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - ffmpeg_pre_build: > - choco install yasm - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo - - - os: windows-latest - cross_os: '' - component: 'Tools' - qt: 5.15.14 - arch: x86_64 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: RelWithDebInfo - collect_symbols: false - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - ffmpeg_pre_build: > - choco install yasm - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo - - - os: windows-latest - qt: 5.15.14 - arch: x86 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DCARGO_TRIPLE=i686-pc-windows-msvc -DBUILD_PACKAGE_SUFFIX=x86 -G Ninja - build_type: RelWithDebInfo - collect_symbols: false - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - ffmpeg_pre_build: > - choco install yasm - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo - - steps: - name: Check out code uses: actions/checkout@v4 @@ -366,7 +160,7 @@ jobs: mv ${ANDROID_SDK_ROOT}/platforms/{android-*-*,..} ls "${ANDROID_SDK_ROOT}/platforms" shell: bash - if: matrix.cross_os == 'Android' + if: matrix.cross_os == 'Android34' - name: Configure Linux system dependencies uses: ./.github/actions/restore-linux @@ -387,16 +181,16 @@ jobs: ffmpeg_args: ${{ matrix.ffmpeg_args }} other_pre_build: ${{ matrix.other_pre_build }} other_args: ${{ matrix.other_args }} - if: '!matrix.cross_os' + if: "!matrix.cross_os || startsWith(matrix.qt, '6')" - name: Build cross-compiler dependencies uses: ./.github/actions/build-deps id: cross-deps with: build_type: ${{ matrix.build_type }} - cache_key: ${{ matrix.build_type != 'Release' && format('{0}-', matrix.build_type) || '' }}${{ runner.os }}+${{ matrix.cross_os }}-${{ matrix.arch }} + cache_key: ${{ matrix.build_type != 'Release' && format('{0}-', matrix.build_type) || '' }}${{ runner.os }}+${{ matrix.cross_os }}-${{ matrix.cross_arch }} path: .github/cross-deps - target_arch: "${{ matrix.arch }}" + target_arch: "${{ matrix.cross_arch }}" qt: ${{ matrix.qt }} qt_pre_build: ${{ matrix.cross_qt_pre_build }} qt_args: ${{ matrix.cross_qt_args }} @@ -411,7 +205,7 @@ jobs: id: sccache with: triplet: ${{ matrix.sccache_triplet }} - cache_key: ${{ matrix.build_type != 'Release' && format('{0}-', matrix.build_type) || '' }}${{ runner.os }}${{ matrix.component }}-${{ matrix.arch }}${{ matrix.cross_os && format('+{0}', matrix.cross_os) }}-${{ matrix.qt }} + cache_key: ${{ matrix.build_type != 'Release' && format('{0}-', matrix.build_type) || '' }}${{ runner.os }}${{ matrix.component }}-${{ matrix.cross_arch || matrix.arch }}${{ matrix.cross_os && format('+{0}', matrix.cross_os) }}-${{ matrix.qt }} - name: Cache gradle uses: actions/cache@v4 @@ -421,8 +215,8 @@ jobs: path: |- ~/.gradle/wrapper/dists/gradle-*/*/gradle-* !~/.gradle/wrapper/dists/gradle-*/*/gradle-*.zip - key: gradle-${{ runner.os }}-${{ matrix.arch }}+${{ matrix.cross_os }}-${{ matrix.qt }} - if: matrix.cross_os == 'Android' + key: gradle-${{ runner.os }}-${{ matrix.cross_arch || matrix.arch }}+${{ matrix.cross_os }}-${{ matrix.qt }} + if: matrix.cross_os == 'Android34' - name: Prepare Windows signing run: | @@ -479,7 +273,7 @@ jobs: env: ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} - if: matrix.cross_os == 'Android' && matrix.packager + if: matrix.cross_os == 'Android34' && matrix.packager - name: Build project run: cmake --build build --parallel $(nproc || sysctl -n hw.ncpu || echo 2) --config ${{ matrix.build_type }} @@ -515,7 +309,7 @@ jobs: uses: actions/upload-artifact@v4 if: matrix.packager with: - name: Drawpile${{ matrix.component && format('-{0}', matrix.component) }}-${{ matrix.cross_os || runner.os }}-${{ matrix.arch }}-Qt${{ matrix.qt }} + name: Drawpile${{ matrix.component && format('-{0}', matrix.component) }}-${{ matrix.cross_os || runner.os }}-${{ matrix.cross_arch || matrix.arch }}-Qt${{ matrix.qt }} path: | Drawpile-*.AppImage Drawpile-*.apk @@ -528,12 +322,16 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: Logs${{ matrix.component && format('-{0}', matrix.component) }}-${{ matrix.cross_os || runner.os }}-${{ matrix.arch }}-Qt${{ matrix.qt }} + name: Logs${{ matrix.component && format('-{0}', matrix.component) }}-${{ matrix.cross_os || runner.os }}-${{ matrix.cross_arch || matrix.arch }}-Qt${{ matrix.qt }} path: | **/*.log **/*.wxs + build/android-build/build.gradle build/android-build/*.properties build/android_deployment_settings.json + build/src/desktop/android-build/build.gradle + build/src/desktop/android-build/*.properties + build/src/desktop/android_deployment_settings.json - name: Save sccache uses: ./.github/actions/post-sccache diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f18c01b0e..e403801256 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,6 +140,11 @@ if(CLIENT OR SERVER) # Finding Qt needs to come first, otherwise automoc gets confused about # being unable to generate a MOC for the cmake-config directory below. find_package(${QT_PACKAGE_NAME} REQUIRED COMPONENTS Core Network) + # This alters how some Android properties are handled in ways that don't + # matter to us, so we just set this policy so that we don't get a warning. + if(ANDROID AND QT_VERSION VERSION_GREATER_EQUAL 6.6.0) + qt_policy(SET QTP0002 NEW) + endif() endif() # This must be included *after* drawdance is added to make sure that we do not diff --git a/cmake/Qt5AndroidDeploymentTarget.cmake b/cmake/Qt5AndroidDeploymentTarget.cmake index 21714fdb44..6edfd62780 100644 --- a/cmake/Qt5AndroidDeploymentTarget.cmake +++ b/cmake/Qt5AndroidDeploymentTarget.cmake @@ -1,8 +1,8 @@ #[[ This module sets the variables required to generate a Qt5 Android build. #]] # The defaults in Qt5 are outdated, so make them match the current NDK -set(ANDROID_MIN_SDK_VERSION ${NDK_MIN_PLATFORM_LEVEL}) -set(ANDROID_TARGET_SDK_VERSION ${NDK_MAX_PLATFORM_LEVEL}) +set(ANDROID_MIN_SDK_VERSION ${NDK_MIN_PLATFORM_LEVEL} CACHE STRING "Android minimum SDK version" FORCE) +set(ANDROID_TARGET_SDK_VERSION ${NDK_MAX_PLATFORM_LEVEL} CACHE STRING "Android target SDK version" FORCE) # If ANDROID_SDK is not defined Qt will default it to being one level up from # NDK, but actually it is two levels up by default due to versioning and this diff --git a/src/desktop/CMakeLists.txt b/src/desktop/CMakeLists.txt index da623da80d..dc5fa007b2 100644 --- a/src/desktop/CMakeLists.txt +++ b/src/desktop/CMakeLists.txt @@ -720,9 +720,8 @@ elseif(ANDROID) ) set(ANDROID_QT_NAMESPACE org.qtproject.qt) file(READ AndroidManifest.xml.qt6 ANDROID_EXTRA_METADATA) - qt_android_generate_deployment_settings(drawpile) - qt_android_add_apk_target(drawpile) - add_custom_command(TARGET drawpile_make_apk POST_BUILD + cmake_language(DEFER CALL add_custom_command + TARGET drawpile_make_apk POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "android-build/drawpile.apk" "${output_apk}"