Skip to content

Commit

Permalink
Merge pull request #122 from caldog20/mac-app-bundle
Browse files Browse the repository at this point in the history
Mac App Bundling
  • Loading branch information
wheremyfoodat authored Jul 18, 2023
2 parents ed1b070 + 453fec1 commit 525c7dd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/mac-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Taken from pcsx-redux create-app-bundle.sh
# For Plist buddy
PATH="$PATH:/usr/libexec"


# Construct the app iconset.
mkdir alber.iconset
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 16x16 alber.iconset/icon_16x16.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 32x32 alber.iconset/icon_16x16@2x.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 32x32 alber.iconset/icon_32x32.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 64x64 alber.iconset/icon_32x32@2x.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 128x128 alber.iconset/icon_128x128.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 256x256 alber.iconset/icon_128x128@2x.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 256x256 alber.iconset/icon_256x256.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 512x512 alber.iconset/icon_256x256@2x.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 512x512 alber.iconset/icon_512x512.png
convert docs/img/alber-icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 1024x1024 alber.iconset/icon_512x512@2x.png
iconutil --convert icns alber.iconset

# Set up the .app directory
mkdir -p Alber.app/Contents/MacOS/Libraries
mkdir Alber.app/Contents/Resources


# Copy binary into App
cp ./build/Alber Alber.app/Contents/MacOS/Alber
chmod a+x Alber.app/Contents/Macos/Alber

# Copy icons into App
cp alber.icns Alber.app/Contents/Resources/AppIcon.icns

# Fix up Plist stuff
PlistBuddy Alber.app/Contents/Info.plist -c "add CFBundleDisplayName string Alber"
PlistBuddy Alber.app/Contents/Info.plist -c "add CFBundleIconName string AppIcon"
PlistBuddy Alber.app/Contents/Info.plist -c "add CFBundleIconFile string AppIcon"
PlistBuddy Alber.app/Contents/Info.plist -c "add NSHighResolutionCapable bool true"
PlistBuddy Alber.app/Contents/version.plist -c "add ProjectName string Alber"

# Bundle dylibs
dylibbundler -od -b -x Alber.app/Contents/MacOS/Alber -d Alber.app/Contents/Frameworks/ -p @rpath

# relative rpath
install_name_tool -add_rpath @loader_path/../Frameworks Alber.app/Contents/MacOS/Alber
18 changes: 15 additions & 3 deletions .github/workflows/MacOS_Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,20 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Upload executable
- name: Install bundle dependencies
run: brew install dylibbundler imagemagick

- name: Run bundle script
run: ./.github/mac-bundle.sh

- name: Sign the App
run: codesign --force -s - -vvvv Alber.app

- name: Zip it up
run: zip -r Alber Alber.app

- name: Upload MacOS App
uses: actions/upload-artifact@v2
with:
name: MacOS executable
path: './build/Alber'
name: MacOS Alber App Bundle
path: 'Alber.zip'
Binary file added docs/img/alber-icon.ico
Binary file not shown.

0 comments on commit 525c7dd

Please sign in to comment.