Skip to content

Commit

Permalink
add icons for exe
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Nov 8, 2024
1 parent 5beca53 commit bc1d446
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
20 changes: 20 additions & 0 deletions exe/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIconFile</key>
<string>icon</string>
<key>CFBundleExecutable</key>
<string>app</string>
<key>CFBundleIdentifier</key>
<string>ninja.nostrudel</string>
<key>CFBundleName</key>
<string>noStrudel</string>
<key>CFBundleVersion</key>
<string>0.41.0</string>
<key>CFBundleShortVersionString</key>
<string>0.41.0</string>
</dict>
</plist>
25 changes: 23 additions & 2 deletions exe/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
VERSION ?= $(shell git describe --tags --always --dirty)
BINARY_NAME=noStrudel
BUILD_DIR=bin
RESOURCES_DIR=resources

# Build flags
LDFLAGS=-ldflags="-X 'main.Version=${VERSION}'"

# Windows resource file (create this at build time)
WINDOWS_SYSO=${BUILD_DIR}/windows_amd64.syso

# Ensure builds directory exists
$(shell mkdir -p ${BUILD_DIR})

.PHONY: all clean windows linux darwin
.PHONY: all clean windows linux darwin windows-syso

all: copy windows linux darwin

Expand All @@ -24,8 +28,13 @@ source:
VITE_APP_VERSION=$(shell jq -r .version ../package.json) \
pnpm build

# Generate Windows resource file with icon
windows-syso:
go install github.com/akavel/rsrc@latest
rsrc -ico ${RESOURCES_DIR}/icon.ico -o ${WINDOWS_SYSO}

# Windows builds
windows: windows-amd64 windows-arm64
windows: windows-syso windows-amd64 windows-arm64

windows-amd64:
GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-windows-amd64.exe
Expand All @@ -47,9 +56,21 @@ darwin: darwin-amd64 darwin-arm64

darwin-amd64:
GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64
# Create macOS app bundle for amd64
mkdir -p ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64.app/Contents/MacOS
mkdir -p ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64.app/Contents/Resources
cp ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64 ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64.app/Contents/MacOS/${BINARY_NAME}
cp ${RESOURCES_DIR}/icon.icns ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64.app/Contents/Resources/
cp Info.plist ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64.app/Contents/

darwin-arm64:
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64
# Create macOS app bundle for arm64
mkdir -p ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64.app/Contents/MacOS
mkdir -p ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64.app/Contents/Resources
cp ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64 ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64.app/Contents/MacOS/${BINARY_NAME}
cp ${RESOURCES_DIR}/icon.icns ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64.app/Contents/Resources/
cp Info.plist ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64.app/Contents/

# Clean build directory
clean:
Expand Down
Binary file added exe/resources/icon.icns
Binary file not shown.
Binary file added exe/resources/icon.ico
Binary file not shown.
Binary file added exe/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc1d446

Please sign in to comment.