mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[v2] Big tidy up!
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
#cgo darwin LDFLAGS: -framework WebKit -lobjc
|
||||
|
||||
#cgo windows CXXFLAGS: -std=c++11
|
||||
#cgo windows,amd64 LDFLAGS: -L./windows/x64 -lwebview -lWebView2Loader -lgdi32 -lole32 -lShlwapi -luser32 -loleaut32
|
||||
#cgo windows,amd64 LDFLAGS: -L./windows/x64 -lWebView2Loader -lgdi32 -lole32 -lShlwapi -luser32 -loleaut32
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ffenestri.h"
|
||||
|
||||
@@ -5,7 +5,7 @@ import "C"
|
||||
/*
|
||||
|
||||
#cgo windows CXXFLAGS: -std=c++11
|
||||
#cgo windows,amd64 LDFLAGS: -L./windows/x64 -lwebview -lWebView2Loader -lgdi32 -lole32 -lShlwapi -luser32 -loleaut32
|
||||
#cgo windows,amd64 LDFLAGS: -lgdi32 -lole32 -lShlwapi -luser32 -loleaut32
|
||||
|
||||
#include "ffenestri.h"
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
project(test)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
add_executable(test main.cpp)
|
||||
Binary file not shown.
@@ -4,8 +4,5 @@ package x64
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed webview.dll
|
||||
var WebView2 []byte
|
||||
|
||||
//go:embed WebView2Loader.dll
|
||||
var WebView2Loader []byte
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// +build !windows
|
||||
|
||||
// This is a stub to define the following even though they don't exist
|
||||
// on non-Windows systems. Note: This is not the right way to handle this.
|
||||
package x64
|
||||
|
||||
var WebView2 []byte
|
||||
|
||||
var WebView2Loader []byte
|
||||
@@ -3,7 +3,6 @@ package build
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/wailsapp/wails/v2/internal/ffenestri/windows/x64"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -326,17 +325,6 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
}
|
||||
|
||||
println("Done.")
|
||||
// If we are targeting windows, dump the DLLs
|
||||
if options.Platform == "windows" {
|
||||
err := os.WriteFile(filepath.Join(appDir, "webview.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
|
||||
|
||||
@@ -25,8 +25,6 @@ const (
|
||||
Production
|
||||
)
|
||||
|
||||
var modeMap = []string{"Debug", "Production"}
|
||||
|
||||
// Options contains all the build options as well as the project data
|
||||
type Options struct {
|
||||
LDFlags string // Optional flags to pass to linker
|
||||
@@ -51,11 +49,6 @@ type Options struct {
|
||||
AppleIdentity string
|
||||
}
|
||||
|
||||
// GetModeAsString returns the current mode as a string
|
||||
func GetModeAsString(mode Mode) string {
|
||||
return modeMap[mode]
|
||||
}
|
||||
|
||||
// Build the project!
|
||||
func Build(options *Options) (string, error) {
|
||||
|
||||
@@ -212,6 +205,12 @@ func Build(options *Options) (string, error) {
|
||||
outputLogger.Println("Done.")
|
||||
}
|
||||
|
||||
// Post compilation tasks
|
||||
err = builder.PostCompilation(options)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return projectData.OutputFilename, nil
|
||||
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@ type Builder interface {
|
||||
BuildRuntime(*Options) error
|
||||
CompileProject(*Options) error
|
||||
OutputFilename(*Options) string
|
||||
PostCompilation(*Options) error
|
||||
CleanUp()
|
||||
}
|
||||
|
||||
@@ -110,6 +110,11 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err
|
||||
return nil
|
||||
}
|
||||
|
||||
// PostCompilation is called after the compilation step, if successful
|
||||
func (d *DesktopBuilder) PostCompilation(options *Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// We will compile all dialog icons found at <projectdir>/icons/dialog/*.png into the application
|
||||
func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) error {
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// +build !linux
|
||||
|
||||
package build
|
||||
|
||||
// This is used when there is no compilation to be done for the asset
|
||||
func (d *DesktopBuilder) compileIcon(assetDir string, iconFile string) error {
|
||||
return nil
|
||||
}
|
||||
@@ -233,3 +233,8 @@ func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) e
|
||||
// }
|
||||
return nil
|
||||
}
|
||||
|
||||
// PostCompilation is called after the compilation step, if successful
|
||||
func (d *DesktopBuilder) PostCompilation(options *Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2,6 +2,22 @@
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
"github.com/wailsapp/wails/v2/internal/ffenestri/windows/x64"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// PostCompilation is called after the compilation step, if successful
|
||||
func (d *DesktopBuilder) PostCompilation(options *Options) error {
|
||||
// Dump the DLLs
|
||||
err := os.WriteFile(filepath.Join(options.BuildDirectory, "WebView2Loader.dll"), x64.WebView2Loader, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// We will compile all tray icons found at <projectdir>/assets/trayicons/*.png into the application
|
||||
func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) error {
|
||||
//
|
||||
@@ -91,6 +107,11 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err
|
||||
return nil
|
||||
}
|
||||
|
||||
// compileIcon will compile the icon found at <projectdir>/icon.png into the application
|
||||
func (d *DesktopBuilder) compileIcon(assetDir string, iconFile string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// We will compile all dialog icons found at <projectdir>/icons/dialog/*.png into the application
|
||||
func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) error {
|
||||
|
||||
|
||||
@@ -88,3 +88,8 @@ func (b *HybridBuilder) CleanUp() {
|
||||
b.desktop.CleanUp()
|
||||
b.server.CleanUp()
|
||||
}
|
||||
|
||||
// PostCompilation is called after the compilation step, if successful
|
||||
func (s *HybridBuilder) PostCompilation(_ *Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ func (s *ServerBuilder) BuildAssets(_ *Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// PostCompilation is called after the compilation step, if successful
|
||||
func (s *ServerBuilder) PostCompilation(_ *Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// BuildBaseAssets builds the base assets
|
||||
func (s *ServerBuilder) BuildBaseAssets(assets *html.AssetBundle) error {
|
||||
db, err := assets.ConvertToAssetDB()
|
||||
|
||||
Reference in New Issue
Block a user