include toolkit resources in binary

This commit is contained in:
Jeff Carr 2024-11-07 16:54:16 -06:00
parent 3133bb0801
commit af99bd179c
3 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,9 @@
VERSION = $(shell git describe --tags) VERSION = $(shell git describe --tags)
all: all:
-rm resources/*.so
touch resources/blank.so
-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ # embed the toolkit plugins in the binary
GO111MODULE=off go build -v -x \ GO111MODULE=off go build -v -x \
-ldflags "-X main.VERSION=${VERSION}" -ldflags "-X main.VERSION=${VERSION}"
./helloworld ./helloworld

View File

@ -15,7 +15,7 @@ import (
var argv args var argv args
type args struct { type args struct {
Demo string `arg:"positional" help:"this is just a demo"` Demo string `arg:"positional" help:"this is just a demo"`
} }
func (a args) Description() string { func (a args) Description() string {

View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"embed"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/log" "go.wit.com/log"
) )
@ -11,8 +13,13 @@ var VERSION string
// This is the beginning of our binary tree of widgets // This is the beginning of our binary tree of widgets
var myGui *gui.Node var myGui *gui.Node
//go:embed resources/*
var resources embed.FS
func main() { func main() {
myGui = gui.New().Default() myGui = gui.New()
myGui.InitEmbed(resources)
myGui.Default()
helloworld() helloworld()