1. 安装fyne命令行工具
go install fyne.io/fyne/v2/cmd/fyne@latest
2. 打包程序
- 先进入程序入口的源码目录
执行下面的命令
fyne package -src D:/workspace/golang/read_aloud/cmd -os windows -icon D:/workspace/golang/read_aloud/cmd/Icon.png -name readaloud
建议使用绝对路径, 相对路径好像有问题, 我用相对路径没打包起来
3. 帮助
$ fyne package -h
NAME:
fyne.exe package - Packages an application for distribution.
USAGE:
fyne.exe package [command options] [arguments...]
DESCRIPTION:
You may specify the -executable to package, otherwise -sourceDir will be built.
OPTIONS:
--target value, --os value The mobile platform to target (android, android/arm, android/arm64, android/amd64, android/386, ios).
--executable value, --exe value The path to the executable, default is the current dir main binary
--name value The name of the application, default is the executable file name
--tags value A comma-separated list of build tags.
--appVersion value Version number in the form x, x.y or x.y.z semantic version
--appBuild value Build number, should be greater than 0 and incremented for each build (default: 0)
--sourceDir value, --src value The directory to package, if executable is not set.
--icon value The name of the application icon file.
--appID value, --id value For Android, darwin, iOS and Windows targets an appID in the form of a reversed domain name is required, for ios this must match a valid provisioning profile
--certificate value, --cert value iOS/macOS/Windows: name of the certificate to sign the build
--profile value iOS/macOS: name of the provisioning profile for this build
--release Enable installation in release mode (disable debug etc). (default: false)
--help, -h show help (default: false)