Skip to content

Commit 3413dac

Browse files
committed
feat(icon): add application icon and configure resource embedding
Include `icon.ico` and update `build.go` to compile Windows resources using `windres` during the build process.
1 parent 8f00e7f commit 3413dac

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
config.json
2-
*.exe
2+
*.exe
3+
*.syso

build.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ import (
66
"os"
77
"os/exec"
88
"slices"
9-
"strings"
109
)
1110

1211
func main() {
1312
var cmd string
1413

1514
switch {
1615
case slices.Contains(os.Args, "--build"):
17-
cmd = "go build -o HotAMD.exe ./cmd/hotamd"
16+
cmd = "cd cmd/hotamd && " +
17+
"windres res.rc -O coff -o res.syso && " +
18+
"go build -o HotAMD.exe ./cmd/hotamd"
1819
case slices.Contains(os.Args, "--run"):
1920
cmd = "go run ./cmd/hotamd"
2021
case slices.Contains(os.Args, "--release"):
2122
cmd = "bunx relion -b internal/cli/cli.go"
2223
}
2324

24-
args := strings.Fields(cmd)
25-
execCmd := exec.Command(args[0], args[1:]...)
25+
execCmd := exec.Command("cmd", "/C", cmd)
2626
execCmd.Stdout, execCmd.Stderr, execCmd.Stdin = os.Stdout, os.Stderr, os.Stdin
2727
execCmd.Run()
2828
}

cmd/hotamd/icon.ico

162 KB
Binary file not shown.

cmd/hotamd/res.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDI_ICON1 ICON "icon.ico"

0 commit comments

Comments
 (0)