diff --git a/cmd/fyne/commands/build.go b/cmd/fyne/commands/build.go index 500ad4041c..255cb4323d 100644 --- a/cmd/fyne/commands/build.go +++ b/cmd/fyne/commands/build.go @@ -20,18 +20,23 @@ func (b *builder) build() error { goos = targetOS() } - args := []string{} + args := []string{"build"} + env := os.Environ() + env = append(env, "CGO_ENABLED=1") // in case someone is trying to cross-compile... + if goos == "windows" { if b.release { - args = append(args, "build", "-ldflags", "-s -w -H=windowsgui") + args = append(args, "-ldflags", "-s -w -H=windowsgui") } else { - args = append(args, "build", "-ldflags", "-H=windowsgui") + args = append(args, "-ldflags", "-H=windowsgui") } } else { + if goos == "darwin" { + env = append(env, "CGO_CFLAGS=-mmacosx-version-min=10.11") + env = append(env, "CGO_LDFLAGS=-mmacosx-version-min=10.11") + } if b.release { - args = append(args, "build", "-ldflags", "-s -w") - } else { - args = append(args, "build") + args = append(args, "-ldflags", "-s -w") } } @@ -46,9 +51,6 @@ func (b *builder) build() error { cmd := exec.Command("go", args...) cmd.Dir = b.srcdir - env := os.Environ() - env = append(env, "CGO_ENABLED=1") // in case someone is trying to cross-compile... - if goos != "ios" && goos != "android" { env = append(env, "GOOS="+goos) }