Skip to content

Update docker-image.yml #46

Update docker-image.yml

Update docker-image.yml #46

Workflow file for this run

name: Cross-Compile macOS to Windows
on:
push:
branches:
- main
permissions:
contents: write
jobs:
cross-compile:
runs-on: macos-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Install MinGW
run: brew install mingw-w64
- name: Download and Install SDL2
run: |
# Download SDL2 development libraries
curl -LO https://www.libsdl.org/release/SDL2-devel-2.30.11-mingw.tar.gz
tar -xzf SDL2-devel-2.30.11-mingw.tar.gz
sudo cp -r SDL2-2.30.11/x86_64-w64-mingw32 /usr/local/Cellar/mingw-w64/$(brew info --json=v1 mingw-w64 | jq -r '.[0].versions.stable')/toolchain-x86_64/
- name: Download and Install SDL2_image
run: |
# Download SDL2_image development libraries
curl -LO https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.4/SDL2_image-devel-2.8.4-mingw.tar.gz
tar -xzf SDL2_image-devel-2.8.4-mingw.tar.gz
sudo cp -r SDL2_image-2.8.4/x86_64-w64-mingw32 /usr/local/Cellar/mingw-w64/$(brew info --json=v1 mingw-w64 | jq -r '.[0].versions.stable')/toolchain-x86_64/
- name: Download and Install SDL2_ttf
run: |
# Download SDL2_ttf development libraries
curl -LO https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-devel-2.22.0-mingw.tar.gz
tar -xzf SDL2_ttf-devel-2.22.0-mingw.tar.gz
sudo cp -r SDL2_ttf-2.22.0/x86_64-w64-mingw32 /usr/local/Cellar/mingw-w64/$(brew info --json=v1 mingw-w64 | jq -r '.[0].versions.stable')/toolchain-x86_64/
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.23'
- name: Install Dependencies
run: |
cd player
go mod tidy
- name: Verify Go Environment
run: go env
- name: Verify Compiler
run: |
x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-g++ --version
- name: Build Package
env:
CC: "x86_64-w64-mingw32-gcc"
CXX: "x86_64-w64-mingw32-g++"
CGO_ENABLED: 1
GOOS: "windows"
CGO_CFLAGS: "-I/usr/local/Cellar/mingw-w64/$(brew info --json=v1 mingw-w64 | jq -r '.[0].versions.stable')/toolchain-x86_64/x86_64-w64-mingw32/include -D_REENTRANT"
CGO_LDFLAGS: "-L/usr/local/Cellar/mingw-w64/$(brew info --json=v1 mingw-w64 | jq -r '.[0].versions.stable')/toolchain-x86_64/x86_64-w64-mingw32/lib -lSDL2"
run: |
mkdir -p ../JukaGUI-Trimui-Windows
cd player
go build -o ../JukaGUI-Trimui-Windows/JukaGUI.exe ./
echo "Build completed."