From 821862b4c6c1214468124e14aa9519c37c13c703 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 9 Jun 2019 15:41:28 +0200 Subject: [PATCH] README.md: use the -buildmode=exe flag for running demos Signed-off-by: Elias Naur --- README.md | 38 +++++++++++++++++++------------------- cmd/gio/gio.go | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 3bf55bec..8edec403 100644 --- a/README.md +++ b/README.md @@ -60,16 +60,17 @@ To build a Gio program as an .aar package, use the gio tool. For example, $ go run gioui.org/cmd/gio -target android gioui.org/apps/gophers produces gophers.aar, ready to use in an Android project. To run -the demo on an Android device: +the demo on an Android device, use -buildmode=exe: - $ git clone https://git.sr.ht/~eliasnaur/gio - $ cd gio/apps/gophers/android - $ go run gioui.org/cmd/gio -target android .. - $ ./gradlew installDebug # gradlew.bat on Windows + $ go run gioui.org/cmd/gio -buildmode exe -target android gioui.org/apps/gophers + +Install the apk to a running emulator or attached device with adb: + + $ adb install gophers.apk The gio tool passes command line arguments to os.Args at runtime: - $ go run gioui.org/cmd/gio -target android .. -token + $ go run gioui.org/cmd/gio -buildmode exe -target android gioui.org/apps/gophers -token ## iOS/tvOS @@ -85,28 +86,27 @@ outputs Gophers.framework with the demo program built for iOS. For tvOS, use `-t Building for tvOS requires (the not yet released) Go 1.13. -To run the demo on an iOS device, use the sample Xcode project: +To run the demo on an iOS device, use -buildmode=exe: - $ git clone https://git.sr.ht/~eliasnaur/gio - $ cd gio/apps - $ go run gioui.org/cmd/gio -target ios -o gophers/ios/gophers/Gophers.framework ./gophers - $ open gophers/ios/gophers.xcodeproj/ + $ go run gioui.org/cmd/gio -buildmode exe -target ios -appid gioui.org/apps/gophers -You need to provide a valid bundle identifier and set up code signing in Xcode to run the demo -on a device. If you're using Go 1.12 or older, you also need to disable bitcode. +where is a valid bundle identifier previously provisioned in Xcode for your device. +Use the Window=>Devices and Simulators to install the ipa file to the device or use +[ideviceinstaller](https://github.com/libimobiledevice/ideviceinstaller): + + $ ideviceinstaller -i gophers.ipa ## Webassembly/WebGL To run a Gio program in a browser with WebAssembly and WebGL support, use the Go webassembly -driver and add a
element to a HTML page. To run the Gio demo: +driver and add a
element to a HTML page. The gio tool can also output +a directory ready to view in a browser: $ go get github.com/shurcooL/goexec - $ git clone https://git.sr.ht/~eliasnaur/gio - $ cd gio/apps/ - $ GOOS=js GOARCH=wasm go build -o gophers/web/main.wasm ./gophers/ - $ goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir("gophers/web")))' + $ go run gioui.org/cmd/gio -target js gioui.org/apps/gophers + $ goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir("gophers")))' -and then open http://localhost:8080 in a browser. +Open http://localhost:8080 in a browser to run the app. ## Issues diff --git a/cmd/gio/gio.go b/cmd/gio/gio.go index 82f7c133..2392eb98 100644 --- a/cmd/gio/gio.go +++ b/cmd/gio/gio.go @@ -30,7 +30,7 @@ type buildInfo struct { func main() { flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Gio is a tool for building and running gio programs.\n\n") + fmt.Fprintf(os.Stderr, "Gio is a tool for building gio programs.\n\n") fmt.Fprintf(os.Stderr, "Usage:\n\n\tgio [flags] \n\n") flag.PrintDefaults() os.Exit(2)