在一步中打包Fyne应用程序并进行交叉编译是否可能?

huangapple go评论101阅读模式
英文:

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应用的替代方法:

  1. 为所选择的目标编译可执行文件,例如:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build
  1. 使用以下模板手动打包应用程序,例如:
github.com/codazoda/mac-app-shell
英文:

Alternative way to package a Fyne app (manually):

  1. Compile the executable for the choosen target, e.g.:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build
  1. package the app manually using, for instance the following template:

github.com/codazoda/mac-app-shell

huangapple
  • 本文由 发表于 2022年2月18日 23:26:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/71175921.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定