Add GitHub Actions workflow for iOS build #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build iOS App | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
# Ensure Homebrew is up-to-date | |
brew update | |
# Install required tools and libraries | |
brew install cmake # Assuming you might need CMake for SDL2 build | |
- name: Clone SDL2 for iOS | |
run: | | |
git clone https://github.com/libsdl-org/SDL.git | |
cd SDL | |
git checkout main # or the desired branch/tag | |
cd Xcode-iOS | |
./build-sdl.sh # This script should compile SDL2 for iOS | |
- name: Verify SDL2 Installation Path | |
run: | | |
echo "SDL2 path:" $(pwd)/SDL/Xcode-iOS/build/ios/Debug-iphoneos/ | |
ls SDL/Xcode-iOS/build/ios/Debug-iphoneos/include/SDL2 | |
- name: Compile the iOS App | |
run: | | |
mkdir -p build | |
SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-path) | |
clang -v -o build/MyIOSApp main.c \ | |
-I$(pwd)/SDL/Xcode-iOS/build/ios/Debug-iphoneos/include \ | |
-L$(pwd)/SDL/Xcode-iOS/build/ios/Debug-iphoneos/lib \ | |
-lSDL2 \ | |
-framework UIKit \ | |
-framework Foundation \ | |
-framework CoreGraphics \ | |
-isysroot $SDK_PATH \ | |
-arch arm64 | |
- name: Upload the build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-app | |
path: build/MyIOSApp |