From 304ba97004c9523b708a242ff2fd0c5275b90961 Mon Sep 17 00:00:00 2001 From: Tater Date: Fri, 24 Jan 2025 18:35:41 -0600 Subject: [PATCH] macos osxcross ci --- .github/workflows/fast-build.yml | 54 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/fast-build.yml b/.github/workflows/fast-build.yml index ab369e59c29..26bbd727de2 100644 --- a/.github/workflows/fast-build.yml +++ b/.github/workflows/fast-build.yml @@ -13,23 +13,24 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] include: - os: ubuntu-latest cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DDISCORD_DYNAMIC=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON cmake-init-env: CXXFLAGS= package-file: "*-linux_x86_64.tar.xz" - fancy: true - - os: macOS-latest - cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_FIND_FRAMEWORK=NEVER - cmake-init-env: CXXFLAGS= - package-file: "*-macos.dmg" - fancy: false + crossosx: false + - os: windows-latest cmake-args: -A x64 -DDISCORD=ON cmake-init-env: CXXFLAGS= LDFLAGS= package-file: "*-win64.zip" - fancy: false + crossosx: false + + - os: ubuntu-latest + cmake-args: -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/cmake/toolchains/darwin-arm64.toolchain" -DCMAKE_OSX_SYSROOT=$OSXCROSS_TARGET/SDK/MacOSX12.3.sdk + cmake-init-env: CXXFLAGS= + package-file: "*-macos.dmg" + crossosx: true steps: - uses: actions/checkout@v4 with: @@ -43,24 +44,23 @@ jobs: # sudo apt-get upgrade -y sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr libglew-dev -y - - name: Prepare macOS - if: contains(matrix.os, 'macOS') - run: | - brew update || true - brew install pkg-config ninja molten-vk vulkan-headers glslang spirv-tools glew googletest molten-vk opusfile wavpack x264 || true - brew upgrade freetype - pip3 install --break-system-packages dmgbuild - echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH - - - name: Add rust macOS - if: contains(matrix.os, 'macOS') - run: | - rustup default stable - rustup update - rustup target add x86_64-apple-darwin aarch64-apple-darwin - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 + - name: Set up MacOS Cross Compiler + if: matrix.crossosx + uses: Timmmm/setup-osxcross@v2 + with: + osx-version: "12.3" + + - name: Install sqlite3 in cross environment + if: matrix.crossosx + run: | + export MACOSX_DEPLOYMENT_TARGET=12.3 + export OSXCROSS_OSX_VERSION_MIN=10.9 + eval "$(osxcross-conf)" + echo "1" | osxcross-mp install sqlite3 + - name: Build in release mode env: VERSION: ${{ secrets.VERSION }} @@ -76,16 +76,24 @@ jobs: ENVFLAGS="CXXFLAGS=-include$VERSION_FILE" POST_FLAGS="" fi + + if [[ "${{ matrix.crossosx }}" == "true" ]]; then + export OSXCROSS_OSX_VERSION_MIN=10.9 + eval "$(osxcross-conf)" + fi + mkdir release cd release ${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} $ENVFLAGS ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} $POST_FLAGS -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. .. ${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }} + - name: Package run: | cd release ${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }} mkdir artifacts mv ${{ matrix.package-file }} artifacts + - name: Upload Artifacts uses: actions/upload-artifact@v4 with: