From d7fa60952f1ceeedf6c7ad52874d5ec6d6f09d37 Mon Sep 17 00:00:00 2001 From: Jarle Aase Date: Thu, 9 Jan 2025 13:38:18 +0200 Subject: [PATCH] Trying universal macos build --- .github/workflows/build-macos-amd64.yaml | 51 ----------------------- .github/workflows/build-macos.yaml | 52 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/build-macos-amd64.yaml create mode 100644 .github/workflows/build-macos.yaml diff --git a/.github/workflows/build-macos-amd64.yaml b/.github/workflows/build-macos-amd64.yaml deleted file mode 100644 index 3ca2c22..0000000 --- a/.github/workflows/build-macos-amd64.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Build macOS Amd64 Project - -on: - push: - branches: - - automation - pull_request: - -jobs: - build-macos-amd64: - runs-on: macos-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Set up x86_64 Homebrew - run: | - sudo softwareupdate --install-rosetta --agree-to-license - arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zshrc - eval "$(/usr/local/bin/brew shellenv)" - - - name: Install Dependencies (x86_64) - run: | - arch -x86_64 brew install cmake ninja llvm boost - - - name: Configure Build - run: | - mkdir -p build - cd build - arch -x86_64 cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ - -DCMAKE_OSX_ARCHITECTURES=x86_64 \ - -DBOOST_ROOT=$(arch -x86_64 brew --prefix boost) - - name: Build Project - run: | - cd build - arch -x86_64 cmake --build . - - - name: Prepare Artifacts - run: | - mkdir -p artifacts - cp build/bin/* artifacts/ - - - name: Archive Artifacts - uses: actions/upload-artifact@v4 - with: - name: macos-amd64-artifacts - path: artifacts/ diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml new file mode 100644 index 0000000..76cc853 --- /dev/null +++ b/.github/workflows/build-macos.yaml @@ -0,0 +1,52 @@ +name: Build Universal macOS Binary + +on: + push: + branches: + - automation + pull_request: + +jobs: + build-universal-macos: + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Dependencies + run: | + # Install essential tools + brew update + brew install cmake ninja llvm boost + + - name: Configure Build + run: | + mkdir -p build + pushd build + cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + -DBOOST_ROOT=$(brew --prefix boost) + popd + + - name: Build Project + run: | + pushd build + cmake --build . + popd + + - name: Prepare Universal Binary + run: | + mkdir -p artifacts + lipo -create -output artifacts/universal_binary \ + build/bin/your_binary_arm64 \ + build/bin/your_binary_x86_64 + + - name: Archive Artifacts + uses: actions/upload-artifact@v4 + with: + name: universal-macos-build + path: artifacts/* + retention-days: 1