[windows] output required DLLs on build

This commit is contained in:
Lea Anthony
2021-04-28 15:44:29 +10:00
parent ee05884c9c
commit 2881a5bc0d
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
package x64
import _ "embed"
//go:embed webview.dll
var WebView2 []byte
//go:embed WebView2Loader.dll
var WebView2Loader []byte

View File

@@ -3,6 +3,7 @@ package build
import (
"bytes"
"fmt"
"github.com/wailsapp/wails/v2/internal/ffenestri/windows/x64"
"io/ioutil"
"os"
"os/exec"
@@ -294,6 +295,18 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
return fmt.Errorf("%s\n%s", err, string(stde.Bytes()))
}
// If we are targeting windows, dump the DLLs
if options.Platform == "windows" {
err := os.WriteFile(filepath.Join(appDir, "webview2.dll"), x64.WebView2, 0755)
if err != nil {
return err
}
err = os.WriteFile(filepath.Join(appDir, "WebView2Loader.dll"), x64.WebView2Loader, 0755)
if err != nil {
return err
}
}
if !options.Compress {
return nil
}