Skip to content

Commit

Permalink
infra: update macOS build scripts and SDK, bump MoltenVK to 1.2.7 (#1463
Browse files Browse the repository at this point in the history
)

This PR does a few things:

- Updates ares to create macOS builds with the latest SDK. After
6526409
there are no longer any outstanding issues doing so. Importantly, we use
Xcode 15.2, since prior versions have issues with weak linking.
- Adds `macos-compat` to CI as a compatibility build that maintains
macOS 10.9 to 10.13 compatibility. The `macos-latest` runner will target
10.13 and above. The only difference with this build is the SDK version
used to build it (Xcode 13.4); macOS weak linking handles the rest.
- Increments the MoltenVK version to 1.2.7. The version ares was
building required a Python library `distutils` that is no longer
trivially available with newer Python versions.
- Refactors the `xcode-select` usage reserved for GitHub Actions out of
the SDL script and up to the top level, before any dependency scripts
are run. This is just tidying up.
- Improves the librashader build script warning to specify that you need
to add a target with the nightly toolchain to build librashader (from
@rasky)
- Unbreaks the build.

This PR has been tested and verified to build in a local branch, but to
be safe, it would probably be good to run it here as well.

Co-authored-by: jcm <butt@butts.com>
  • Loading branch information
jcm93 and jcm committed May 1, 2024
1 parent 1b3e826 commit caecd0b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/build.yml
Expand Up @@ -51,7 +51,11 @@ jobs:
windres: rc
shell: bash
msvc-arch: x64_arm64
- name: macos
- name: macos-compat
os: macos-12
compiler: clang++
shell: sh
- name: macos-latest
os: macos-latest
compiler: clang++
shell: sh
Expand Down Expand Up @@ -113,17 +117,16 @@ jobs:
with:
path: thirdparty/MoltenVK/MoltenVK
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('thirdparty/MoltenVK/HEAD') }}
- name: "macOS: recover SDL cache"
if: runner.os == 'macOS'
uses: actions/cache@v3
env:
cache-name: sdl
with:
path: thirdparty/SDL/SDL
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('thirdparty/SDL/HEAD') }}
- name: Install macOS Dependencies
if: runner.os == 'macOS'
run: |
if [ $ImageOS == "macos14" ]; then
sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
echo "Set Xcode version to 15.2 for macos-latest build."
elif [ $ImageOS == "macos12" ]; then
sudo xcode-select -s /Applications/Xcode_13.4.app/Contents/Developer
echo "Set Xcode version to 13.4 for macos-compat build."
fi
brew install make ninja cmake
pip install --no-input setuptools
rustup toolchain install nightly
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/MoltenVK/HEAD
@@ -1 +1 @@
4c6bfbebd10de7209a2fd1529f5dc20af7479180
1d98babb721c03667f65e7f6197ca2a356d19198
2 changes: 1 addition & 1 deletion thirdparty/MoltenVK/build-moltenvk.sh
Expand Up @@ -11,4 +11,4 @@ pushd MoltenVK
./fetchDependencies --macos
make macos MVK_LOG_LEVEL_INFO=0 MVK_LOG_LEVEL_DEBUG=0
popd
cp MoltenVK/MoltenVK/dylib/macOS/libMoltenVK.dylib .
cp MoltenVK/Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib .
20 changes: 12 additions & 8 deletions thirdparty/SDL/build-sdl.sh
Expand Up @@ -10,17 +10,21 @@ git -C SDL reset --hard "$(cat HEAD)"
mkdir -p SDL/build
pushd SDL/build

SDLARGS=()
SDLARGS+=("-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64")
if [ -n "${GITHUB_ACTIONS+1}" ]; then
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
echo "Set Xcode version in order to target macOS 10.11 when building SDL."
if [ $ImageOS == "macos12" ]; then
SDLARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11)
echo "Added 10.11 deployment target to SDL build arguments"
elif [ $ImageOS == "macos14" ]; then
SDLARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13)
echo "Added 10.13 deployment target to SDL build arguments"
fi
fi
cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11

cmake .. "${SDLARGS[@]}"
cmake --build .

if [ -n "${GITHUB_ACTIONS+1}" ]; then
sudo xcode-select -s /Applications/Xcode_14.2.app/Contents/Developer
echo "Set Xcode to 14.2 to continue build."
fi
popd

cp SDL/build/libSDL2-2.0.0.dylib .
4 changes: 2 additions & 2 deletions thirdparty/librashader/build-librashader.sh
Expand Up @@ -24,12 +24,12 @@ fi
if [ "$(uname)" = "Darwin" ]; then
# Check for the presence of the x86_64 and aarch64 targets
if ! rustup target list --installed | grep -q x86_64-apple-darwin; then
echo "x86_64-apple-darwin target not found. Please run 'rustup target add x86_64-apple-darwin' to install it."
echo "x86_64-apple-darwin target not found. Please run 'rustup target add x86_64-apple-darwin --toolchain nightly' to install it."
exit 1
fi

if ! rustup target list --installed | grep -q aarch64-apple-darwin; then
echo "aarch64-apple-darwin target not found. Please run 'rustup target add aarch64-apple-darwin' to install it."
echo "aarch64-apple-darwin target not found. Please run 'rustup target add aarch64-apple-darwin --toolchain nightly' to install it."
exit 1
fi

Expand Down

0 comments on commit caecd0b

Please sign in to comment.