From a2db59481f176e22873b43cf4cfd513a855d301a Mon Sep 17 00:00:00 2001 From: PeterPetrik Date: Fri, 17 May 2024 09:32:22 +0200 Subject: [PATCH] arm64 macos --- .github/workflows/ios.yml | 1 + .github/workflows/linux.yml | 1 + .github/workflows/mac.yml | 1 + .github/workflows/mac_arm64.yml | 175 ++++++++++++++++++++++++++++++++ .github/workflows/win.yml | 1 + README.md | 1 + scripts/update_qt_version.bash | 1 + 7 files changed, 181 insertions(+) create mode 100644 .github/workflows/mac_arm64.yml diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index d04d09fe..139f711b 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -7,6 +7,7 @@ on: - '.github/workflows/linux.yml' - '.github/workflows/mac.yml' - '.github/workflows/win.yml' + - '.github/workflows/mac_arm64.yml' - 'vcpkg-overlay/triplets/arm-android.yml' - 'vcpkg-overlay/triplets/arm64-android.yml' - 'vcpkg-overlay/triplets/arm64-osx.yml' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index be70067f..13dc90e5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -7,6 +7,7 @@ on: - '.github/workflows/ios.yml' - '.github/workflows/mac.yml' - '.github/workflows/win.yml' + - '.github/workflows/mac_arm64.yml' - 'vcpkg-overlay/triplets/arm-android.yml' - 'vcpkg-overlay/triplets/arm64-android.yml' - 'vcpkg-overlay/triplets/arm64-ios.yml' diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 897586ef..40641567 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -7,6 +7,7 @@ on: - '.github/workflows/ios.yml' - '.github/workflows/linux.yml' - '.github/workflows/win.yml' + - '.github/workflows/mac_arm64.yml' - 'vcpkg-overlay/triplets/arm-android.yml' - 'vcpkg-overlay/triplets/arm64-android.yml' - 'vcpkg-overlay/triplets/arm64-ios.yml' diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml new file mode 100644 index 00000000..53d2b13d --- /dev/null +++ b/.github/workflows/mac_arm64.yml @@ -0,0 +1,175 @@ +name: Build macOS arm64 + +on: + push: + paths-ignore: + - '.github/workflows/android.yml' + - '.github/workflows/ios.yml' + - '.github/workflows/linux.yml' + - '.github/workflows/win.yml' + - '.github/workflows/mac.yml' + - 'vcpkg-overlay/triplets/arm-android.yml' + - 'vcpkg-overlay/triplets/arm64-android.yml' + - 'vcpkg-overlay/triplets/arm64-ios.yml' + - 'vcpkg-overlay/triplets/x64-linux.yml' + - 'vcpkg-overlay/triplets/x64-windows.yml' + - 'scripts/**' + - 'LICENSE' + - 'README.md' + +concurrency: + group: ci-${{github.ref}}-mac-arm64 + cancel-in-progress: true + +jobs: + mac_os_build: + runs-on: macos-14 + + env: # update README for devs if you modify these env. variables + QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change + TRIPLET: "arm64-osx" + DEPLOYMENT_TARGET: "10.15.0" + XC_VERSION: ${{ '15.2' }} + CMAKE_VERSION: '3.29.0' + QT_ARCH: "desktop" + VCPKG_ROOT: "${{ github.workspace }}/vcpkg" + + steps: + - uses: actions/checkout@v3 + with: + path: input-sdk + + - name: Prepare vars + id: vars + run: | + brew install automake bison flex gnu-sed autoconf-archive libtool gettext + echo $(brew --prefix bison)/bin >> $GITHUB_PATH + echo $(brew --prefix flex)/bin >> $GITHUB_PATH + echo $(brew --prefix gettext)/bin >> $GITHUB_PATH + + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + with: + cmakeVersion: ${{ env.CMAKE_VERSION }} + + - uses: jurplel/install-qt-action@v3 + with: + version: ${{ env.QT_VERSION }} + setup-python: 'false' + target: ${{ env.QT_ARCH }} + dir: ${{ github.workspace }} + modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' + cache: true + cache-key-prefix: ${{ runner.os }}-QtCache-v1-${{ env.QT_VERSION }}-mac-arm64 + + - name: Setup compiler + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XC_VERSION }} + + - name: Get vcpkg + shell: bash + run: | + mkdir -p "${{ env.VCPKG_ROOT }}" + cd "${{ env.VCPKG_ROOT }}" + git init + git remote add origin https://github.com/microsoft/vcpkg.git + git pull origin master + VCPKG_TAG=`cat ${{ github.workspace }}/input-sdk/VCPKG_BASELINE` + echo "using VCPKG_TAG ${VCPKG_TAG}" + git checkout ${VCPKG_TAG} + + - name: Install vcpkg + run: | + echo "install vcpkg" + cd "${{ env.VCPKG_ROOT }}" + chmod +x ./bootstrap-vcpkg.sh + ./bootstrap-vcpkg.sh + + - name: Build Deps + run: | + mkdir -p ${{ github.workspace }}/build + cd ${{ github.workspace }}/build + + export PATH=${{ env.VCPKG_ROOT }}:$PATH + + vcpkg --version + + cmake -B ${{ github.workspace }}/build \ + -S ${{ github.workspace }}/input-sdk \ + -DCMAKE_TOOLCHAIN_FILE:PATH="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ + -GNinja \ + -DVCPKG_TARGET_TRIPLET=${{ env.TRIPLET }} \ + -DVCPKG_OVERLAY_TRIPLETS:PATH="${{ github.workspace }}/input-sdk/vcpkg-overlay/triplets" \ + -DVCPKG_OVERLAY_PORTS="${{ github.workspace }}/input-sdk/vcpkg-overlay/ports" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_MAKE_PROGRAM=ninja \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }} + + - name: Upload build logs on deps failure + uses: actions/upload-artifact@v3 + if: failure() + with: + name: build-logs-${{ env.TRIPLET }} + path: | + ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log + + - name: Build Test App + run: | + cd ${{ github.workspace }}/build + cmake --build . --config Release --verbose + + - name: Run Tests + run: | + cd ${{ github.workspace }}/build + ./merginmapsmobilesdk + + - name: Get TimeStamp + id: time + uses: nanzm/get-time-action@v2.0 + with: + timeZone: 8 + format: 'YYYYMMDD' + + - name: Create GDAL supported formats + run: | + SUPPORTED_FORMATS="mergin-maps-input-sdk-gdal-supported-formats-${{ steps.time.outputs.time }}-${{ github.run_number }}.log" + echo "SUPPORTED_FORMATS=${SUPPORTED_FORMATS}" >> $GITHUB_ENV + + echo ".. 1/2 GDALINFO" + ${{ github.workspace }}/build/vcpkg_installed/${{ env.TRIPLET }}/tools/gdal/gdalinfo --formats | tee -a ${{ github.workspace }}/${SUPPORTED_FORMATS} + + echo ".. 2/2 OGRINFO" + ${{ github.workspace }}/build/vcpkg_installed/${{ env.TRIPLET }}/tools/gdal/ogrinfo --formats | tee -a ${{ github.workspace }}/${SUPPORTED_FORMATS} + + - name: Create SDK data folder + run: | + mkdir -p ${{ github.workspace }}/sdk + cp -R ${{ github.workspace }}/build/vcpkg_installed/${{ env.TRIPLET }}/* ${{ github.workspace }}/sdk/ + rm -rf ${{ github.workspace }}/sdk/debug + rm -rf ${{ github.workspace }}/sdk/etc + rm -rf ${{ github.workspace }}/sdk/mkspecs + rm -rf ${{ github.workspace }}/sdk/share + rm -rf ${{ github.workspace }}/sdk/tools + + SDK_TAR=mergin-maps-input-sdk-qt-${{ env.QT_VERSION }}-${{ env.TRIPLET }}-${{ steps.time.outputs.time }}-${{ github.run_number }}.tar.gz + echo "SDK_TAR=${SDK_TAR}" >> $GITHUB_ENV + + cd ${{ github.workspace }}/sdk/ + tar -c -z -f ${{ github.workspace }}/${SDK_TAR} ./ + + - name: Upload SDK_TAR artifact + uses: actions/upload-artifact@v3 + with: + name: sdk-${{ env.TRIPLET }} + path: ${{ github.workspace }}/${{ env.SDK_TAR }} + if-no-files-found: error + + - name: Create Release + if: ${{ github.ref == 'refs/heads/master' }} + uses: ncipollo/release-action@v1 + with: + tag: ${{ env.TRIPLET }}-${{ steps.time.outputs.time }}-${{ github.run_number }} + allowUpdates: true + artifacts: "${{ env.SDK_TAR }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index c08a40a6..03fb2506 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -7,6 +7,7 @@ on: - '.github/workflows/ios.yml' - '.github/workflows/linux.yml' - '.github/workflows/mac.yml' + - '.github/workflows/mac_arm64.yml' - 'vcpkg-overlay/triplets/arm-android.yml' - 'vcpkg-overlay/triplets/arm64-android.yml' - 'vcpkg-overlay/triplets/arm64-ios.yml' diff --git a/README.md b/README.md index 3dc8e474..f4f8f02a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build win64](https://github.com/MerginMaps/mobile-sdk/actions/workflows/win.yml/badge.svg)](https://github.com/MerginMaps/mobile-sdk/actions/workflows/win.yml) [![Build macOS](https://github.com/merginmaps/mobile-sdk/actions/workflows/mac.yml/badge.svg)](https://github.com/merginmaps/mobile-sdk/actions/workflows/mac.yml) +[![Build macOS arm64](https://github.com/merginmaps/mobile-sdk/actions/workflows/mac_arm64.yml/badge.svg)](https://github.com/merginmaps/mobile-sdk/actions/workflows/mac_arm64.yml) [![Build iOS](https://github.com/merginmaps/mobile-sdk/actions/workflows/ios.yml/badge.svg)](https://github.com/merginmaps/mobile-sdk/actions/workflows/ios.yml) [![Build android (on MacOS)](https://github.com/merginmaps/mobile-sdk/actions/workflows/android.yml/badge.svg)](https://github.com/merginmaps/mobile-sdk/actions/workflows/android.yml) [![Build Linux](https://github.com/merginmaps/mobile-sdk/actions/workflows/linux.yml/badge.svg)](https://github.com/merginmaps/mobile-sdk/actions/workflows/linux.yml) diff --git a/scripts/update_qt_version.bash b/scripts/update_qt_version.bash index 792772cc..c839215b 100755 --- a/scripts/update_qt_version.bash +++ b/scripts/update_qt_version.bash @@ -30,6 +30,7 @@ for FNAME in \ $DIR/../.github/workflows/ios.yml \ $DIR/../.github/workflows/linux.yml \ $DIR/../.github/workflows/mac.yml \ + $DIR/../.github/workflows/mac_arm64.yml \ $DIR/../.github/workflows/win.yml do echo "patching $FNAME"