Skip to content

Commit

Permalink
cross build to arm64 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Feb 11, 2025
1 parent a1de181 commit 182c8fe
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 30 deletions.
95 changes: 73 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@ on:
workflow_dispatch:

jobs:
build-fcitx5:
build-fcitx5-msys:
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
env: [msys, clang64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Lint
if: ${{ matrix.env == 'clang64' }}
run: ./win32/scripts/lint.ps1

- name: Install dependencies (msys)
if: ${{ matrix.env == 'msys' }}
- name: Install dependencies
run: |
C:/msys64/usr/bin/pacman -Syu --noconfirm
C:/msys64/usr/bin/pacman -S --noconfirm `
Expand All @@ -39,37 +33,74 @@ jobs:
cp -r its C:/msys64/usr/share/gettext
Add-Content $env:GITHUB_PATH "C:/msys64/usr/bin"
- name: Install dependencies (clang)
if: ${{ matrix.env == 'clang64' }}
- name: Build
run: |
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

build-fcitx5-clang:
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
arch: [x86_64, arm64]
include:
- { arch: x86_64, cmake_arch: AMD64, pkg_arch: x86_64 }
- { arch: arm64, cmake_arch: ARM64, pkg_arch: aarch64 }

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: |
C:/msys64/usr/bin/pacman -Syu --noconfirm
C:/msys64/usr/bin/pacman -S --noconfirm `
mingw-w64-clang-x86_64-extra-cmake-modules `
mingw-w64-clang-${{ matrix.pkg_arch }}-extra-cmake-modules `
mingw-w64-clang-${{ matrix.pkg_arch }}-dlfcn `
mingw-w64-clang-${{ matrix.pkg_arch }}-fmt `
mingw-w64-clang-${{ matrix.pkg_arch }}-libuv `
mingw-w64-clang-x86_64-clang `
mingw-w64-clang-x86_64-cmake `
mingw-w64-clang-x86_64-dlfcn `
mingw-w64-clang-x86_64-fmt `
mingw-w64-clang-x86_64-libuv `
mingw-w64-clang-x86_64-ninja `
mingw-w64-clang-x86_64-pkgconf `
gettext `
ninja
gettext
if ("${{ matrix.arch }}" -eq "arm64") {
C:/msys64/usr/bin/pacman -S --noconfirm `
mingw-w64-clang-aarch64-clang
}
mkdir -p C:/msys64/usr/share/gettext
cp -r its C:/msys64/usr/share/gettext
Add-Content $env:GITHUB_PATH "C:/msys64/clang64/bin"
git apply --directory=fcitx5 patches/fcitx5.patch
- name: Build
run: |
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake -B build/${{ matrix.arch }} -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE='windows-cross/msys2.toolchain.cmake' `
-DARCH=${{ matrix.cmake_arch }}
cmake --build build/${{ matrix.arch }}
- name: Package
if: ${{ matrix.env == 'clang64' }}
env:
DESTDIR: dist
DESTDIR: dist/${{ matrix.arch }}
run: |
cmake --install build
cmake --install build/${{ matrix.arch }}
cd dist/${{ matrix.arch }} && tar cjf ../Fcitx5-${{ matrix.arch }}-dev.tar.bz2 bin/lib* include lib
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Fcitx5-${{ matrix.arch }}
path: |
dist/Fcitx5-${{ matrix.arch }}*.tar.bz2
- name: Setup tmate session
if: ${{ failure() }}
Expand Down Expand Up @@ -102,3 +133,23 @@ jobs:
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

release:
needs: build-fcitx5-clang
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '!release') }}
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Create Nightly release
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: "Nightly Build"
files: |
Fcitx5-*.tar.bz2
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "fcitx5"]
path = fcitx5
url = https://github.com/fcitx/fcitx5
[submodule "windows-cross"]
path = windows-cross
url = https://github.com/fcitx-contrib/windows-cross
48 changes: 41 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"tasks": [
{
"type": "shell",
"label": "Configure",
"command": "cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug",
"label": "Configure (x86_64)",
"command": "cmake -B build/x86_64 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE='windows-cross/msys2.toolchain.cmake' -DARCH=AMD64",
"options": {
"env": {
"PATH": "C:/msys64/clang64/bin"
Expand All @@ -16,19 +16,53 @@
},
{
"type": "shell",
"label": "Build",
"command": "cmake --build build",
"label": "Build (x86_64)",
"command": "cmake --build build/x86_64",
"group": {
"kind": "build"
}
},
{
"type": "shell",
"label": "Install",
"command": "cmake --install build",
"label": "Install (x86_64)",
"command": "cmake --install build/x86_64",
"options": {
"env": {
"DESTDIR": "dist"
"DESTDIR": "dist/x86_64"
}
},
"group": {
"kind": "build"
}
},
{
"type": "shell",
"label": "Configure (arm64)",
"command": "cmake -B build/arm64 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE='windows-cross/msys2.toolchain.cmake' -DARCH=ARM64",
"options": {
"env": {
"PATH": "C:/msys64/clang64/bin"
}
},
"group": {
"kind": "build"
}
},
{
"type": "shell",
"label": "Build (arm64)",
"command": "cmake --build build/arm64",
"group": {
"kind": "build"
}
},
{
"type": "shell",
"label": "Install (arm64)",
"command": "cmake --install build/arm64",
"options": {
"env": {
"DESTDIR": "dist/arm64"
}
},
"group": {
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ if (CYGWIN)
add_compile_definitions(-D_GNU_SOURCE)
else()
set(CMAKE_INSTALL_PREFIX C:)
set(ECM_DIR C:/msys64/clang64/share/ECM/cmake)
set(ENV{PKG_CONFIG_PATH} "${CMAKE_SYSROOT}/lib/pkgconfig")
set(ECM_DIR "${CMAKE_SYSROOT}/share/ECM/cmake")
set(GETTEXT_MSGMERGE_EXECUTABLE C:/msys64/usr/bin/msgmerge.exe)
set(GETTEXT_MSGFMT_EXECUTABLE C:/msys64/usr/bin/msgfmt.exe)
endif()
Expand Down
1 change: 1 addition & 0 deletions windows-cross
Submodule windows-cross added at 374361

0 comments on commit 182c8fe

Please sign in to comment.