mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[v2] ldflags fix
This commit is contained in:
@@ -228,20 +228,26 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
commands.Add("-tags")
|
||||
commands.Add(tags.Join(","))
|
||||
|
||||
// Strip binary in Production mode
|
||||
// LDFlags
|
||||
ldflags := slicer.String()
|
||||
if options.LDFlags != "" {
|
||||
ldflags.Add(options.LDFlags)
|
||||
}
|
||||
|
||||
if options.Mode == Production {
|
||||
|
||||
// Different linker flags depending on platform
|
||||
commands.Add("-ldflags")
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
commands.Add("-w -s -H windowsgui")
|
||||
default:
|
||||
commands.Add("-w -s")
|
||||
ldflags.Add("-w", "-s")
|
||||
if runtime.GOOS == "windows" {
|
||||
ldflags.Add("-H windowsgui")
|
||||
}
|
||||
}
|
||||
|
||||
ldflags.Deduplicate()
|
||||
|
||||
if ldflags.Length() > 0 {
|
||||
commands.Add("-ldflags")
|
||||
commands.Add(ldflags.Join(" "))
|
||||
}
|
||||
|
||||
// Get application build directory
|
||||
appDir := options.BuildDirectory
|
||||
if options.CleanBuildDirectory {
|
||||
@@ -251,11 +257,6 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
}
|
||||
}
|
||||
|
||||
if options.LDFlags != "" {
|
||||
commands.Add("-ldflags")
|
||||
commands.Add(options.LDFlags)
|
||||
}
|
||||
|
||||
// Set up output filename
|
||||
outputFile := b.OutputFilename(options)
|
||||
compiledBinary := filepath.Join(appDir, outputFile)
|
||||
|
||||
Reference in New Issue
Block a user