Skip to content

Commit

Permalink
Add bsd and macos builds
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Jun 26, 2024
1 parent 4ec02d5 commit 5c2e76f
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 73 deletions.
146 changes: 73 additions & 73 deletions .github/workflows/geargrafx.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main Workflow
name: Build and Release

on:
workflow_dispatch:
Expand Down Expand Up @@ -73,44 +73,44 @@ jobs:
# with:
# name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-libretro-linux
# path: platforms/libretro/${{ env.NAME_LOWER }}_libretro.so
# macos:
# name: macOS
# strategy:
# matrix:
# os: [macos-13, macos-14]
# include:
# - os: macos-13
# architecture: intel
# - os: macos-14
# architecture: arm
# runs-on: ${{ matrix.os }}
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Install dependencies
# run: brew install sdl2
# - name: Get build number
# run: |
# echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
# - name: make
# run: make dist
# working-directory: platforms/macos
# - name: Prepare artifact directory
# run: |
# mkdir -p artifact
# cp platforms/shared/README.txt artifact
# cp platforms/shared/gamecontrollerdb.txt artifact
# cp -R platforms/macos/${{ env.NAME_UPPER }}.app artifact
# - name: Archive binary
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-macos-${{ matrix.architecture }}
# path: artifact/*
macos:
name: macOS
strategy:
matrix:
os: [macos-13, macos-14]
include:
- os: macos-13
architecture: intel
- os: macos-14
architecture: arm
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: brew install sdl2
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: make
run: make dist
working-directory: platforms/macos
- name: Prepare artifact directory
run: |
mkdir -p artifact
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp -R platforms/macos/${{ env.NAME_UPPER }}.app artifact
- name: Archive binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-macos-${{ matrix.architecture }}
path: artifact/*
# windows:
# name: Windows
# strategy:
Expand Down Expand Up @@ -147,40 +147,40 @@ jobs:
# with:
# name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-windows-${{ matrix.architecture }}
# path: artifact/*
# bsd:
# name: BSD
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Get build number
# run: |
# echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
# - name: Run FreeBSD and gmake
# id: test
# uses: vmactions/freebsd-vm@v1
# with:
# usesh: true
# prepare: pkg install -y git gmake pkgconf SDL2 glew lang/gcc gtk3
# run: |
# cd platforms/bsd
# gmake
# - name: Prepare artifact directory
# run: |
# mkdir -p artifact
# cp platforms/shared/README.txt artifact
# cp platforms/shared/gamecontrollerdb.txt artifact
# cp platforms/bsd/${{ env.NAME_LOWER }} artifact
# - name: Archive binary
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-bsd
# path: artifact/*
bsd:
name: BSD
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: Run FreeBSD and gmake
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: pkg install -y git gmake pkgconf SDL2 glew lang/gcc gtk3
run: |
cd platforms/bsd
gmake
- name: Prepare artifact directory
run: |
mkdir -p artifact
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp platforms/bsd/${{ env.NAME_LOWER }} artifact
- name: Archive binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-bsd
path: artifact/*
# release:
# name: Release
# needs: [linux, macos, windows, bsd]
Expand Down
7 changes: 7 additions & 0 deletions platforms/bsd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include ../shared/desktop/Makefile.sources

SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_gtk.cpp
CPPFLAGS += `pkg-config --cflags gtk+-3.0`
LDFLAGS += `pkg-config --libs gtk+-3.0`

include ../shared/desktop/Makefile.common
24 changes: 24 additions & 0 deletions platforms/macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>run.sh</string>
<key>CFBundleIdentifier</key>
<string>me.ignaciosanchez.Geargrafx</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Geargrafx</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIconFile</key>
<string>iconfile</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>CFBundleVersion</key>
<string>@version@</string>
<key>CFBundleShortVersionString</key>
<string>@version@</string>
</dict>
</plist>
32 changes: 32 additions & 0 deletions platforms/macos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include ../shared/desktop/Makefile.sources

SOURCES_MM += $(DESKTOP_SRC_DIR)/nfd/nfd_cocoa.mm
OBJECTS += $(SOURCES_MM:.mm=.o)
LDFLAGS += -framework AppKit -framework UniformTypeIdentifiers

include ../shared/desktop/Makefile.common

# Brew use a different path on Apple Silicon as on Intel
UNAME_P := $(shell uname -m)
ifneq ($(filter arm64%,$(UNAME_P)),)
DYLIB_PATH=/opt/homebrew/lib/
else
DYLIB_PATH=/usr/local/opt/sdl2/lib
endif

SDL_DYLIB=libSDL2-2.0.0.dylib
APP_NAME=Geargrafx

bundle:
rm -rf $(APP_NAME).app
mkdir -p $(APP_NAME).app/Contents/{MacOS,Resources,Frameworks}
sed -e "s/@version@/$(GIT_VERSION)/g" Info.plist > $(APP_NAME).app/Contents/Info.plist
cp $(DYLIB_PATH)/$(SDL_DYLIB) $(APP_NAME).app/Contents/Frameworks/
cp iconfile.icns $(APP_NAME).app/Contents/Resources/
cp $(TARGET) $(APP_NAME).app/Contents/MacOS/
cp run.sh $(APP_NAME).app/Contents/MacOS/
cp ../gamecontrollerdb.txt $(APP_NAME).app/Contents/MacOS/
install_name_tool -change $(DYLIB_PATH)/$(SDL_DYLIB) @$(APP_NAME).app/Contents/MacOS/$(SDL_DYLIB) $(APP_NAME).app/Contents/MacOS/$(APP_NAME)

dist: clean all bundle
@echo Success!!
Binary file added platforms/macos/iconfile.icns
Binary file not shown.
3 changes: 3 additions & 0 deletions platforms/macos/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
cd "${0%/*}"
./geargrafx

0 comments on commit 5c2e76f

Please sign in to comment.