提交 6f5ea42a 编写于 作者: yanghye's avatar yanghye

energy command-line tools: build 增加开启内置动态库参数

上级 19347879
......@@ -19,6 +19,7 @@ import (
"github.com/energye/energy/v2/cmd/internal/term"
"github.com/energye/energy/v2/cmd/internal/tools"
toolsCommand "github.com/energye/golcl/tools/command"
"os"
"strings"
)
......@@ -30,7 +31,12 @@ func build(c *command.Config, proj *project.Project) (err error) {
term.Section.Println("Building", proj.OutputFilename)
var args = []string{"build"}
if proj.TempDll {
args = append(args, "--tags=tempdll")
c.Build.Gtk = strings.ToLower(c.Build.Gtk)
if c.Build.Gtk != "gtk3" && c.Build.Gtk != "gtk2" {
term.Logger.Error("Compiling and enabling TempDll. gtk can only be gtk2 or gtk3")
os.Exit(1)
}
args = append(args, "--tags=tempdll "+c.Build.Gtk)
}
args = append(args, "-ldflags", "-s -w")
args = append(args, "-o", proj.OutputFilename)
......
......@@ -77,6 +77,7 @@ type Build struct {
Path string `short:"p" long:"path" description:"Project path, default current path. Can be configured in energy.json" default:""`
Upx bool `short:"u" long:"upx" description:"Set this parameter and install upx. Use upx to compress the execution file. windows"`
UpxFlag string `long:"upxFlag" description:"Upx command line parameters" default:""`
Gtk string `long:"gtk" description:"Compile on Linux, enable TempDll. gtk: gtk2 or gtk3" default:"gtk3"`
TempDll bool `short:"d" long:"dll" description:"Enable built-in liblcl build"`
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册