Skip to content

Commit

Permalink
arm64 macOS, zstd support (#3445)
Browse files Browse the repository at this point in the history
* arm64 macOS, zstd support
* fix wrong cache on android
  • Loading branch information
PeterPetrik committed May 20, 2024
1 parent 1afb507 commit baf5c4c
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
JDK_VERSION: 11
SDK_PLATFORM: android-33
SDK_BUILD_TOOLS: 33.0.1
INPUT_SDK_VERSION_ARM: arm-android-20240415-218
INPUT_SDK_VERSION_ARM64: arm64-android-20240415-218
INPUT_SDK_VERSION_ARM: arm-android-20240517-224
INPUT_SDK_VERSION_ARM64: arm64-android-20240517-224
CCACHE_DIR: /Users/runner/work/ccache
GITHUB_TOKEN: ${{ secrets.INPUTAPP_BOT_GITHUB_TOKEN }}
CACHE_VERSION: 0
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ${{ github.workspace }}/input-sdk
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION }}-${{ env.CACHE_VERSION }}
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION_ARM }}-${{ env.CACHE_VERSION }}

- name: Install Input-SDK
if: steps.cache-input-sdk.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
XC_VERSION: ${{ '15.2' }}
IOS_CMAKE_TOOLCHAIN_VERSION: "4.4.0"
INPUT_SDK_VERSION: arm64-ios-20240415-178
INPUT_SDK_VERSION: arm64-ios-20240517-182
IOS_PROVISIONING_PROFILE_UUID: 59aaa8d7-516a-4592-8c58-d7d1c1f81610
KEYCHAIN: ${{ 'inputapp.keychain' }}
CCACHE_DIR: /Users/runner/work/ccache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
CCACHE_DIR: ~/.ccache
INPUT_SDK_VERSION: x64-linux-20240415-181
INPUT_SDK_VERSION: x64-linux-20240517-184
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
CMAKE_VERSION: '3.29.0'
CACHE_VERSION: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
INPUT_SDK_VERSION: x64-osx-20240415-201
INPUT_SDK_VERSION: x64-osx-20240517-205
CCACHE_DIR: /Users/runner/work/ccache
CACHE_VERSION: 0
CMAKE_VERSION: '3.29.0'
Expand Down
172 changes: 172 additions & 0 deletions .github/workflows/macos_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: macOS arm64 Build
on:
push:
paths:
- 'app/**'
- 'core/**'
- 'scripts/**'
- 'cmake/**'
- 'cmake_templates/**'
- 'test/**'
- 'CMakeLists.txt'
- '.github/workflows/macos_arm64.yml'

release:
types:
- published

env:
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
INPUT_SDK_VERSION: arm64-osx-20240517-4
CCACHE_DIR: /Users/runner/work/ccache
CACHE_VERSION: 0
CMAKE_VERSION: '3.29.0'
XC_VERSION: ${{ '15.2' }}

concurrency:
group: ci-${{github.ref}}-macos-arm64
cancel-in-progress: true

jobs:
macos_arm64_build:
if: ( github.repository == 'MerginMaps/mobile' ) && (!contains(github.event.head_commit.message, 'Translate '))
runs-on: macos-14
steps:
- name: Checkout Input
uses: actions/checkout@v3
with:
path: input

- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"

- name: install brew deps
run: |
brew install lcov
brew install ccache
brew install ninja
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ env.CMAKE_VERSION }}

- name: Extract Mergin API_KEY
env:
MERGINSECRETS_DECRYPT_KEY: ${{ secrets.MERGINSECRETS_DECRYPT_KEY }}
run: |
cd input/core/
/opt/homebrew/bin/openssl \
aes-256-cbc -d \
-in merginsecrets.cpp.enc \
-out merginsecrets.cpp \
-k "$MERGINSECRETS_DECRYPT_KEY" \
-md md5
# CCache
- name: Prepare build cache for pull request
uses: pat-s/always-upload-cache@v3.0.11
if: github.event_name == 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
key: build-mac-ccache-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys: |
build-mac-ccache-${{ github.actor }}-${{ github.head_ref }}-
build-mac-ccache-refs/heads/${{ github.base_ref }}-
build-mac-ccache-refs/heads/master-
- name: Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
uses: pat-s/always-upload-cache@v3.0.11
if: github.event_name != 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key: build-mac-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-mac-ccache-${{ github.ref }}-
build-mac-ccache-refs/heads/master-
- name: Install ccache
run: |
mkdir -p ${CCACHE_DIR}
ccache --set-config=max_size=2.0G
ccache -s
# Qt
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
target: desktop
dir: ${{ github.workspace }}
modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools'
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-v0-${{ env.QT_VERSION }}-mac-arm64

# Input SDK
- name: Cache Input-SDK
id: cache-input-sdk
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ${{ github.workspace }}/input-sdk
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION }}-${{ env.CACHE_VERSION }}

- name: Install Input-SDK
if: steps.cache-input-sdk.outputs.cache-hit != 'true'
run: |
wget -O \
${{ github.workspace }}/input-sdk.tar.gz \
https://github.com/MerginMaps/mobile-sdk/releases/download/${{ env.INPUT_SDK_VERSION }}/mergin-maps-input-sdk-qt-${{ env.QT_VERSION }}-${{ env.INPUT_SDK_VERSION }}.tar.gz
mkdir -p ${{ github.workspace }}/input-sdk/arm64-osx
cd ${{ github.workspace }}/input-sdk/arm64-osx
tar -xvzf ${{ github.workspace }}/input-sdk.tar.gz
# Build Input App
- name: Calculate build number
run: |
BUILD_NUM=$GITHUB_RUN_NUMBER$GITHUB_RUN_ATTEMPT
echo "INPUT_VERSION_CODE=${BUILD_NUM}" >> $GITHUB_ENV
echo "Version code: ${BUILD_NUM}"
# Package
- name: build Input (Release)
run: |
mkdir -p install-Input
mkdir -p build-Input-rel
cd build-Input-rel
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Qt/${QT_VERSION}/macos \
-DCMAKE_INSTALL_PREFIX:PATH=../install-Input \
-DUSE_SERVER_API_KEY=TRUE \
-DINPUT_SDK_PATH=${{ github.workspace }}/input-sdk/arm64-osx \
-DQGIS_QUICK_DATA_PATH=${{ github.workspace }}/input/app/android/assets/qgis-data \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-GNinja \
-S ../input
ninja
ninja install
- name: Get TimeStamp
id: time
uses: josStorer/get-current-time@v2.0.2
with:
format: 'YYYYMMDD'

- name: package Input.app
run: |
INPUT_TAR=input-${{ env.INPUT_SDK_VERSION }}-${{ steps.time.outputs.formattedTime }}-${{ github.run_number }}.tar.gz
echo "INPUT_TAR=${INPUT_TAR}" >> $GITHUB_ENV
cd ${{ github.workspace }}/install-Input
find .
tar -c -z -f ${{ github.workspace }}/${INPUT_TAR} "./Input.app"
- name: Upload Sdk in Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/${{ env.INPUT_TAR }}
2 changes: 1 addition & 1 deletion .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

env:
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
INPUT_SDK_VERSION: x64-windows-20240415-228
INPUT_SDK_VERSION: x64-windows-20240517-231
CCACHE_DIR: C:/ccache-cache # https://linux.die.net/man/1/ccache
CACHE_VERSION: 0
VS_VERSION: "2019"
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ find_package(Zip REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Geotiff REQUIRED)
find_package(Lzma REQUIRED)
find_package(Zstd REQUIRED)
find_package(MiniZip REQUIRED)

if (IOS OR MACOS)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Platform builds:
[![iOS Build](https://github.com/MerginMaps/mobile/workflows/iOS%20Build/badge.svg)](https://github.com/MerginMaps/mobile/actions?query=workflow%3A%22iOS+Build%22)
[![win64 Build](https://github.com/MerginMaps/mobile/actions/workflows/win.yml/badge.svg)](https://github.com/MerginMaps/mobile/actions/workflows/win.yml)
[![macOS Build](https://github.com/MerginMaps/mobile/actions/workflows/macos.yml/badge.svg)](https://github.com/MerginMaps/mobile/actions/workflows/macos.yml)
[![macOS (arm64) Build](https://github.com/MerginMaps/mobile/actions/workflows/macos_arm64.yml/badge.svg)](https://github.com/MerginMaps/mobile/actions/workflows/macos_arm64.yml)
[![linux Build](https://github.com/MerginMaps/mobile/actions/workflows/linux.yml/badge.svg)](https://github.com/MerginMaps/mobile/actions/workflows/linux.yml)

Other Checks:
Expand Down
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ target_link_libraries(
Jpeg::Jpeg
Geotiff::Geotiff
Lzma::Lzma
Zstd::Zstd
Bz2::Bz2
)

Expand Down
27 changes: 27 additions & 0 deletions cmake/FindZstd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# GPLv2 Licence

find_path(
Zstd_INCLUDE_DIR
zstd.h
"${INPUT_SDK_PATH_MULTI}/include"
NO_DEFAULT_PATH
)

find_library(
Zstd_LIBRARY
NAMES zstd libzstd
PATHS "${INPUT_SDK_PATH_MULTI}/lib"
NO_DEFAULT_PATH
)

find_package_handle_standard_args(Zstd REQUIRED_VARS Zstd_LIBRARY Zstd_INCLUDE_DIR)

if (Zstd_FOUND AND NOT TARGET Zstd::Zstd)
add_library(Zstd::Zstd UNKNOWN IMPORTED)
set_target_properties(
Zstd::Zstd PROPERTIES IMPORTED_LOCATION "${Zstd_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIR}"
)
endif ()

mark_as_advanced(Zstd_LIBRARY Zstd_INCLUDE_DIR)

1 comment on commit baf5c4c

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.5.622111 just submitted!

Please sign in to comment.