5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-19 02:19:31 +08:00

add cross-compile flag to build command

This commit is contained in:
konez2k 2020-02-18 20:26:26 +01:00 committed by Lea Anthony
parent 58761ccff4
commit 0f36ee7030
2 changed files with 7 additions and 1 deletions

View File

@ -159,6 +159,7 @@ type ProjectOptions struct {
WailsVersion string
typescriptDefsFilename string
Verbose bool `json:"-"`
Platform string
}
// Defaults sets the default project template

View File

@ -15,6 +15,7 @@ func init() {
var debugMode = false
var typescriptFilename = ""
var verbose = false
var platform = ""
buildSpinner := spinner.NewSpinner()
buildSpinner.SetSpinSpeed(50)
@ -26,7 +27,8 @@ func init() {
BoolFlag("f", "Force rebuild of application components", &forceRebuild).
BoolFlag("d", "Build in Debug mode", &debugMode).
BoolFlag("verbose", "Verbose output", &verbose).
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 {
@ -130,6 +132,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