https://developer.fyne.io/started/packaging

1. 安装fyne命令行工具

  1. go install fyne.io/fyne/v2/cmd/fyne@latest

2. 打包程序

  • 先进入程序入口的源码目录
  • 执行下面的命令

    1. fyne package -src D:/workspace/golang/read_aloud/cmd -os windows -icon D:/workspace/golang/read_aloud/cmd/Icon.png -name readaloud
  • 建议使用绝对路径, 相对路径好像有问题, 我用相对路径没打包起来

3. 帮助

  1. $ fyne package -h
  2. NAME:
  3. fyne.exe package - Packages an application for distribution.
  4. USAGE:
  5. fyne.exe package [command options] [arguments...]
  6. DESCRIPTION:
  7. You may specify the -executable to package, otherwise -sourceDir will be built.
  8. OPTIONS:
  9. --target value, --os value The mobile platform to target (android, android/arm, android/arm64, android/amd64, android/386, ios).
  10. --executable value, --exe value The path to the executable, default is the current dir main binary
  11. --name value The name of the application, default is the executable file name
  12. --tags value A comma-separated list of build tags.
  13. --appVersion value Version number in the form x, x.y or x.y.z semantic version
  14. --appBuild value Build number, should be greater than 0 and incremented for each build (default: 0)
  15. --sourceDir value, --src value The directory to package, if executable is not set.
  16. --icon value The name of the application icon file.
  17. --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
  18. --certificate value, --cert value iOS/macOS/Windows: name of the certificate to sign the build
  19. --profile value iOS/macOS: name of the provisioning profile for this build
  20. --release Enable installation in release mode (disable debug etc). (default: false)
  21. --help, -h show help (default: false)

image.png