aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build-macos-universal.yml
blob: 4416ce7a1fd7d0cd455e1c14694c296ef9c3e03c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: CMake Build (macOS Universal)

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  prepare:
    runs-on: [self-hosted, macOS, ARM64]
    
    steps:
      - name: Clean workspace
        run: rm -rf ${{runner.workspace}}/build

      - uses: actions/checkout@v3      


  build-arm64:
    needs: prepare
    runs-on: [self-hosted, macOS, ARM64]
    env:
      homebrew_prefix: /opt/homebrew

    steps:
      - name: Create build directory
        run: mkdir -p ${{runner.workspace}}/build/arm64

      - name: Configure
        working-directory: ${{runner.workspace}}/build/arm64
        run: arch -arm64 ${{env.homebrew_prefix}}/bin/cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH="${{env.homebrew_prefix}}/opt/qt@6;${{env.homebrew_prefix}}/opt/libarchive" -DPKG_CONFIG_EXECUTABLE=${{env.homebrew_prefix}}/bin/pkg-config -DMACOS_BUNDLE_LIBS=ON -DUSE_QT6=ON

      - name: Make
        working-directory: ${{runner.workspace}}/build/arm64
        run: arch -arm64 make -j$(sysctl -n hw.logicalcpu)

  build-x86_64:
    needs: prepare
    runs-on: [self-hosted, macOS, ARM64]
    env:
      homebrew_prefix: /usr/local

    steps:
      - name: Create build directory
        run: mkdir -p ${{runner.workspace}}/build/x86_64

      - name: Configure
        working-directory: ${{runner.workspace}}/build/x86_64
        run: arch -x86_64 ${{env.homebrew_prefix}}/bin/cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH="${{env.homebrew_prefix}}/opt/qt@6;${{env.homebrew_prefix}}/opt/libarchive" -DPKG_CONFIG_EXECUTABLE=${{env.homebrew_prefix}}/bin/pkg-config -DMACOS_BUNDLE_LIBS=ON -DUSE_QT6=ON

      - name: Make
        working-directory: ${{runner.workspace}}/build/x86_64
        run: arch -x86_64 make -j$(sysctl -n hw.logicalcpu)

  universal-binary:
    needs: [build-arm64, build-x86_64]
    runs-on: [self-hosted, macOS, ARM64]

    steps:
      - name: Merge binaries
        run: $GITHUB_WORKSPACE/tools/mac-universal.py ${{runner.workspace}}/build/arm64/melonDS.app ${{runner.workspace}}/build/x86_64/melonDS.app ${{runner.workspace}}/build/universal/melonDS.app

      - name: Codesign app
        run: codesign -s - --deep -f ${{runner.workspace}}/build/universal/melonDS.app

      - name: Create DMG
        run: hdiutil create -fs HFS+ -volname melonDS -srcfolder ${{runner.workspace}}/build/universal/melonDS.app -ov -format UDBZ ${{runner.workspace}}/build/universal/melonDS.dmg

      - uses: actions/upload-artifact@v3
        with:
          name: macOS-universal
          path: ${{runner.workspace}}/build/universal/melonDS.dmg