From 6f774eb904646fb601eb795ed9e77dc15d9aefbc Mon Sep 17 00:00:00 2001 From: Drakirus Date: Fri, 13 Sep 2019 00:05:14 +0200 Subject: [PATCH 1/2] add opengl build flags read the matching go-flutter PR: https://github.com/go-flutter-desktop/go-flutter/pull/258 --- cmd/build.go | 7 +++++++ cmd/run.go | 1 + 2 files changed, 8 insertions(+) diff --git a/cmd/build.go b/cmd/build.go index 94c93575..c00c5bea 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -27,6 +27,7 @@ var ( buildCachePath string buildOmitEmbedder bool buildOmitFlutterBundle bool + buildOpenGlVersion string ) const buildPath = "go" @@ -37,6 +38,7 @@ func init() { buildCmd.PersistentFlags().StringVarP(&buildBranch, "branch", "b", "", "The 'go-flutter' version to use. (@master or @v0.20.0 for example)") buildCmd.PersistentFlags().BoolVar(&buildDebug, "debug", false, "Build a debug version of the app.") buildCmd.PersistentFlags().StringVarP(&buildCachePath, "cache-path", "", "", "The path that hover uses to cache dependencies such as the Flutter engine .so/.dll (defaults to the standard user cache directory)") + buildCmd.PersistentFlags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "Choose the version of OpenGL to compile go-flutter with.\nOpenGL is only used for external texture plugin support (i.e. video_plugin), if you don't need them, provide 'none'") buildCmd.AddCommand(buildLinuxCmd) buildCmd.AddCommand(buildLinuxSnapCmd) buildCmd.AddCommand(buildLinuxDebCmd) @@ -336,7 +338,12 @@ func build(projectName string, targetOS string, vmArguments []string) { } ldflags = append(ldflags, fmt.Sprintf("-X main.vmArguments=%s", strings.Join(vmArguments, ";"))) + if buildOpenGlVersion == "none" { + fmt.Println("hover: The '--opengl=none' flag makes go-flutter incompatible with texture plugins!") + } + cmdGoBuild := exec.Command(goBin, "build", + "-tags=opengl"+buildOpenGlVersion, "-o", outputBinaryPath(projectName, targetOS), fmt.Sprintf("-ldflags=%s", strings.Join(ldflags, " ")), dotSlash+"cmd", diff --git a/cmd/run.go b/cmd/run.go index b56d4052..3ff175a6 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -20,6 +20,7 @@ func init() { runCmd.Flags().StringVarP(&buildManifest, "manifest", "m", "pubspec.yaml", "Flutter manifest file of the application.") runCmd.Flags().StringVarP(&buildBranch, "branch", "b", "", "The 'go-flutter' version to use. (@master or @v0.20.0 for example)") runCmd.Flags().StringVarP(&buildCachePath, "cache-path", "", "", "The path that hover uses to cache dependencies such as the Flutter engine .so/.dll (defaults to the standard user cache directory)") + runCmd.Flags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "Choose the version of OpenGL to compile go-flutter with.\nOpenGL is only used for external texture plugin support (i.e. video_plugin), if you don't need them, provide 'none'") runCmd.Flags().StringVarP(&runObservatoryPort, "observatory-port", "", "50300", "The observatory port used to connect hover to VM services (hot-reload/debug/..)") runCmd.Flags().BoolVar(&buildOmitEmbedder, "omit-embedder", false, "Don't (re)compile 'go-flutter' source code, useful when only working with Dart code") runCmd.Flags().BoolVar(&buildOmitFlutterBundle, "omit-flutter", false, "Don't (re)compile the current Flutter project, useful when only working with Golang code (plugin)") From b99584be4575ca9788cbc029cdca2d182567f09b Mon Sep 17 00:00:00 2001 From: Drakirus Date: Fri, 20 Sep 2019 22:38:22 +0200 Subject: [PATCH 2/2] fix confusing `--opengl` command description --- cmd/build.go | 2 +- cmd/run.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/build.go b/cmd/build.go index c00c5bea..0d1a9f36 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -38,7 +38,7 @@ func init() { buildCmd.PersistentFlags().StringVarP(&buildBranch, "branch", "b", "", "The 'go-flutter' version to use. (@master or @v0.20.0 for example)") buildCmd.PersistentFlags().BoolVar(&buildDebug, "debug", false, "Build a debug version of the app.") buildCmd.PersistentFlags().StringVarP(&buildCachePath, "cache-path", "", "", "The path that hover uses to cache dependencies such as the Flutter engine .so/.dll (defaults to the standard user cache directory)") - buildCmd.PersistentFlags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "Choose the version of OpenGL to compile go-flutter with.\nOpenGL is only used for external texture plugin support (i.e. video_plugin), if you don't need them, provide 'none'") + buildCmd.PersistentFlags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "The OpenGL version specified here is only relevant for external texture plugin (i.e. video_plugin).\nIf 'none' is provided, texture won't be supported. Note: the Flutter Engine still needs a OpenGL compatible context.") buildCmd.AddCommand(buildLinuxCmd) buildCmd.AddCommand(buildLinuxSnapCmd) buildCmd.AddCommand(buildLinuxDebCmd) diff --git a/cmd/run.go b/cmd/run.go index 3ff175a6..fe33eb5a 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -20,7 +20,7 @@ func init() { runCmd.Flags().StringVarP(&buildManifest, "manifest", "m", "pubspec.yaml", "Flutter manifest file of the application.") runCmd.Flags().StringVarP(&buildBranch, "branch", "b", "", "The 'go-flutter' version to use. (@master or @v0.20.0 for example)") runCmd.Flags().StringVarP(&buildCachePath, "cache-path", "", "", "The path that hover uses to cache dependencies such as the Flutter engine .so/.dll (defaults to the standard user cache directory)") - runCmd.Flags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "Choose the version of OpenGL to compile go-flutter with.\nOpenGL is only used for external texture plugin support (i.e. video_plugin), if you don't need them, provide 'none'") + runCmd.Flags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "The OpenGL version specified here is only relevant for external texture plugin (i.e. video_plugin).\nIf 'none' is provided, texture won't be supported. Note: the Flutter Engine still needs a OpenGL compatible context.") runCmd.Flags().StringVarP(&runObservatoryPort, "observatory-port", "", "50300", "The observatory port used to connect hover to VM services (hot-reload/debug/..)") runCmd.Flags().BoolVar(&buildOmitEmbedder, "omit-embedder", false, "Don't (re)compile 'go-flutter' source code, useful when only working with Dart code") runCmd.Flags().BoolVar(&buildOmitFlutterBundle, "omit-flutter", false, "Don't (re)compile the current Flutter project, useful when only working with Golang code (plugin)")