add cross-compile flag to build command

This commit is contained in:
konez2k
2020-02-18 20:26:26 +01:00
parent f490bf8bc9
commit 526136099b
2 changed files with 7 additions and 1 deletions

View File

@@ -158,6 +158,7 @@ type ProjectOptions struct {
selectedTemplate *TemplateDetails
WailsVersion string
typescriptDefsFilename string
Platform string
}
// Defaults sets the default project template

View File

@@ -14,6 +14,7 @@ func init() {
var forceRebuild = false
var debugMode = false
var typescriptFilename = ""
var platform = ""
buildSpinner := spinner.NewSpinner()
buildSpinner.SetSpinSpeed(50)
@@ -24,7 +25,8 @@ func init() {
BoolFlag("p", "Package application on successful build", &packageApp).
BoolFlag("f", "Force rebuild of application components", &forceRebuild).
BoolFlag("d", "Build in Debug mode", &debugMode).
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename)
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename).
StringFlag("x", "Cross-compile application to specified platform via xgo", &platform)
initCmd.Action(func() error {
@@ -127,6 +129,9 @@ func init() {
buildSpinner.Success()
}
// Set cross-compile
projectOptions.Platform = platform
err = cmd.BuildApplication(projectOptions.BinaryName, forceRebuild, buildMode, packageApp, projectOptions)
if err != nil {
return err