mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 17:52:29 +08:00
fix: pass platform and arch to GenerateBindings for cross compilation (#3795)
This commit is contained in:
parent
a2e32fe414
commit
8a5a0506bf
@ -20,6 +20,8 @@ type Options struct {
|
||||
ProjectDirectory string
|
||||
Compiler string
|
||||
GoModTidy bool
|
||||
Platform string
|
||||
Arch string
|
||||
TsPrefix string
|
||||
TsSuffix string
|
||||
TsOutputType string
|
||||
@ -53,7 +55,11 @@ func GenerateBindings(options Options) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
stdout, stderr, err = shell.RunCommand(workingDirectory, options.Compiler, "build", "-tags", tagString, "-o", filename)
|
||||
envBuild := os.Environ()
|
||||
envBuild = shell.SetEnv(envBuild, "GOOS", options.Platform)
|
||||
envBuild = shell.SetEnv(envBuild, "GOARCH", options.Arch)
|
||||
|
||||
stdout, stderr, err = shell.RunCommandWithEnv(envBuild, workingDirectory, options.Compiler, "build", "-tags", tagString, "-o", filename)
|
||||
if err != nil {
|
||||
return stdout, fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
|
||||
}
|
||||
|
@ -231,6 +231,8 @@ func GenerateBindings(buildOptions *Options) error {
|
||||
Compiler: buildOptions.Compiler,
|
||||
Tags: buildOptions.UserTags,
|
||||
GoModTidy: !buildOptions.SkipModTidy,
|
||||
Platform: buildOptions.Platform,
|
||||
Arch: buildOptions.Arch,
|
||||
TsPrefix: buildOptions.ProjectData.Bindings.TsGeneration.Prefix,
|
||||
TsSuffix: buildOptions.ProjectData.Bindings.TsGeneration.Suffix,
|
||||
TsOutputType: buildOptions.ProjectData.Bindings.TsGeneration.OutputType,
|
||||
|
@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `Security` in case of vulnerabilities.
|
||||
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Fixed cross compilation failed with CGO [PR](https://github.com/wailsapp/wails/pull/3795) by [@fcying](https://github.com/fcying)
|
||||
|
||||
## v2.9.2 - 2024-09-18
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user