Skip to content

Commit

Permalink
app bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstink committed Oct 5, 2024
1 parent b83209a commit ef92239
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ jobs:
- uses: actions/checkout@v1
- name: "build mac"
run: |
brew install glfw
brew install glfw svg2png
git submodule update --init --recursive
mkdir build
cd build
bash -c 'cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON ..'
make
bash ../.github/workflows/macos/create_app_bundle.sh
- name: Upload macos
uses: actions/upload-artifact@v4
with:
name: Farbart macos
path: build/symmetri/gui/Farbart
path: build/Farbart.tar.gz

build-linux:
runs-on: ubuntu-latest
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>Farbart</string>
<key>CFBundleExecutable</key>
<string>Farbart</string>
<key>CFBundleIdentifier</key>
<string>www.symmetri.net</string>
<key>CFBundleName</key>
<string>Farbart</string>
<key>CFBundleIconFile</key>
<string>farbart.icns</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
</dict>
</plist>
11 changes: 11 additions & 0 deletions .github/workflows/macos/create_app_bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#/bin/bash

./symmetri/gui/generate_icon $(echo $((1 + $RANDOM % 9))) icon.svg
source ../.github/workflows/macos/create_icons.sh
svg_to_icns icon.svg
rm -r Farbart.app
mkdir -p Farbart.app/Contents Farbart.app/Contents/MacOS Farbart.app/Contents/Resources
cp icons/icon.icns Farbart.app/Contents/Resources/farbart.icns
cp ../.github/workflows/macos/Info.plist Farbart.app/Contents/Info.plist
cp symmetri/gui/Farbart Farbart.app/Contents/MacOS
tar -czf Farbart.tar.gz Farbart.app
31 changes: 31 additions & 0 deletions .github/workflows/macos/create_icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# taken from
# https://gist.github.com/adriansr/1da9b18a8076b0f8a977a5eea0ae41ef

function svg_to_icns(){
local RESOLUTIONS=(
16,16x16
32,16x16@2x
32,32x32
64,32x32@2x
128,128x128
256,128x128@2x
256,256x256
512,256x256@2x
512,512x512
1024,512x512@2x
)

for SVG in $@; do
BASE=$(basename "$SVG" | sed 's/\.[^\.]*$//')
ICONSET="$BASE.iconset"
ICONSET_DIR="./icons/$ICONSET"
mkdir -p "$ICONSET_DIR"
for RES in ${RESOLUTIONS[@]}; do
SIZE=$(echo $RES | cut -d, -f1)
LABEL=$(echo $RES | cut -d, -f2)
svg2png -w $SIZE -h $SIZE "$SVG" "$ICONSET_DIR"/icon_$LABEL.png
done

iconutil -c icns "$ICONSET_DIR"
done
}

0 comments on commit ef92239

Please sign in to comment.