Skip to content

Commit

Permalink
arm64 support - 5
Browse files Browse the repository at this point in the history
  • Loading branch information
omergoktas committed Nov 20, 2024
1 parent 1686d34 commit 0320890
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 40 deletions.
89 changes: 58 additions & 31 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-22.04-arm64-2core

name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Download source codes
Expand All @@ -24,13 +31,20 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y build-essential ninja-build patchelf libfuse2 libglib2.0-dev
pip install aqtinstall
mkdir executables
- name: Install Qt
if: matrix.os == 'ubuntu-22.04'
run: |
python3 -m aqt install-qt linux desktop $QT_VERSION linux_gcc_64 -O /tmp/qt
- name: Install Qt
if: matrix.os == 'ubuntu-22.04-arm64-2core'
run: |
python3 -m aqt install-qt linux_arm64 desktop $QT_VERSION linux_gcc_arm64 -O /tmp/qt
- name: Build for amd64
if: matrix.os == 'ubuntu-22.04'
run: |
chmod +x /tmp/qt/$QT_VERSION/gcc_64/bin/qt-cmake
/tmp/qt/$QT_VERSION/gcc_64/bin/qt-cmake \
Expand All @@ -39,42 +53,55 @@ jobs:
-G Ninja \
-D CMAKE_BUILD_TYPE=Release
cmake --build build-amd64 --parallel --config Release
cp build-amd64/deploy/*.AppImage executables
- name: Build for Linux arm64
if: matrix.os == 'ubuntu-22.04-arm64-2core'
run: |
chmod +x /tmp/qt/$QT_VERSION/gcc_arm64/bin/qt-cmake
/tmp/qt/$QT_VERSION/gcc_arm64/bin/qt-cmake \
-S . \
-B build-arm64 \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release
cmake --build build-arm64 --parallel --config Release
cp build-arm64/deploy/*.AppImage executables
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Cache executables for publication
uses: actions/cache/save@v4
with:
platforms: arm64
enableCrossOsArchive: true
key: ${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: executables

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
publish:
name: Publish
needs: build
runs-on: ubuntu-22.04
permissions: write-all

- name: Build for Linux arm64
run: |
sudo docker run \
--rm \
--platform linux/arm64 \
-v /tmp/qt:/tmp/qt \
-v `pwd`:/tmp/qtapp \
arm64v8/ubuntu:22.04 \
bash -c '
cd /tmp/qtapp
apt-get update -y
apt-get install -y build-essential cmake ninja-build patchelf libfuse2 libglib2.0-dev
chmod +x /tmp/qt/'"$QT_VERSION"'/gcc_arm64/bin/qt-cmake
/tmp/qt/'"$QT_VERSION"'/gcc_arm64/bin/qt-cmake \
-S . \
-B build-arm64 \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release
sed -i "s|AI\x02|\x00\x00\x00|" build-arm64/appimagetool
cmake --build build-arm64 --parallel --config Release
'
- name: Publish build artifacts
uses: marvinpinto/action-automatic-releases@latest
steps:
- name: Restore Linux amd64 executables
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
key: ubuntu-22.04-${{ github.run_id }}-${{ github.run_attempt }}
path: executables

- name: Restore Linux arm64 executables
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
key: ubuntu-22.04-arm64-2core-${{ github.run_id }}-${{ github.run_attempt }}
path: executables

- name: Publish executables
uses: marvinpinto/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
title: latest
prerelease: false
files: build/deploy/*.AppImage
files: |
executables/*.AppImage
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(Options)

project(linuxdeployqt
LANGUAGES CXX
VERSION 2.5.1
VERSION 2.5.2
HOMEPAGE_URL omergoktas.com
DESCRIPTION "Qt dependency deployment tool for Linux."
)
Expand Down
16 changes: 8 additions & 8 deletions cmake/Deploy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,42 @@ function(deploy TARGET)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.desktop
${DEPLOY_PREFIX_PATH}/${TARGET}.desktop @ONLY)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.svg ${DEPLOY_PREFIX_PATH}/${TARGET}.svg
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
${DEPLOY_PREFIX_PATH}/usr/bin
${DEPLOY_PREFIX_PATH}/usr/lib
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${APPIMAGETOOL_EXECUTABLE} --appimage-extract
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/usr/bin ${DEPLOY_PREFIX_PATH}/usr/bin
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/usr/lib ${DEPLOY_PREFIX_PATH}/usr/lib
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E rm -f ${DEPLOY_PREFIX_PATH}/usr/bin/AppRun
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PATCHELF_EXECUTABLE} $<TARGET_FILE:${TARGET}> ${DEPLOY_PREFIX_PATH}/usr/bin
)

add_custom_command(TARGET deploy VERBATIM
add_custom_command(TARGET deploy VERBATIM POST_BUILD
COMMAND ARCH=${CMAKE_SYSTEM_PROCESSOR} $<TARGET_FILE:${TARGET}>
${DEPLOY_PREFIX_PATH}/usr/bin/$<TARGET_FILE_NAME:${TARGET}>
-appimage -no-translations -qmake=${QMAKE_EXECUTABLE}
Expand Down

0 comments on commit 0320890

Please sign in to comment.