英文:
Is it possible to package a Fyne app and cross-compile said app in one step?
问题
Fyne(https://developer.fyne.io/started/packaging)提出了一种打包应用程序的解决方案:
fyne package -os darwin -icon myapp.png
还有另一种交叉编译的方法:https://developer.fyne.io/started/cross-compiling
我想知道是否有一种方法可以将两者结合起来,例如在 Mac M1 上交叉编译 并且 打包一个 Fyne 应用程序,以供 Mac AMD 使用。
英文:
Fyne (https://developer.fyne.io/started/packaging) proposes a solution for packaging apps:
fyne package -os darwin -icon myapp.png
And another method for cross-compiling: https://developer.fyne.io/started/cross-compiling
I was wondering if there is a way to combine both, for instance to cross-compile and package a Fyne app on a Mac M1 for a Mac AMD.
答案1
得分: 2
另一种选择是使用 fyne-cross,它使用 Docker 容器自动化了大部分工作。https://github.com/fyne-io/fyne-cross
英文:
Another alternative is to use fyne-cross which automates most of the work using docker containers. https://github.com/fyne-io/fyne-cross
答案2
得分: 0
根据Fyne团队的说法:
你可以在developer.fyne.io/started/cross-...上设置GOOS和CC的建议值。
如果正确设置了环境变量,它应该能够编译所需的架构(在这种情况下还需要设置GOARCH)。然而,你也可以通过传递"fyne package ... -executable
英文:
According to the Fyne team:
You set GOOS and CC. suggested values at developer.fyne.io/started/cross-…
With the correct environment variables set it should compile the desired architecture (GOARCH would be needed as well in that instance). However you could also compile a binary and package it by passing “fyne package … -executable <filename>” to use a pre-built file.
答案3
得分: 0
手动打包Fyne应用的替代方法:
- 为所选择的目标编译可执行文件,例如:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build
- 使用以下模板手动打包应用程序,例如:
github.com/codazoda/mac-app-shell
英文:
Alternative way to package a Fyne app (manually):
- Compile the executable for the choosen target, e.g.:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build
- package the app manually using, for instance the following template:
github.com/codazoda/mac-app-shell
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论