Kasianov Nikolai Alekseevich
6 months ago
3 changed files with 44 additions and 15 deletions
@ -1,14 +1,25 @@ |
|||||||
game:=capyclick
|
game:=capyclick
|
||||||
bin:=bin
|
desktopBin:=bin/desktop
|
||||||
|
webBin:=bin/web
|
||||||
|
wasmHtml:=build/capyclick.html
|
||||||
|
wasmExec:=$(shell go env GOROOT)
|
||||||
|
|
||||||
all: clean |
current: clean environment |
||||||
mkdir -p bin
|
cd src && go build && mv $(game)* ../$(desktopBin)
|
||||||
cd src && go build && mv $(game)* ../bin
|
|
||||||
|
|
||||||
cross: clean |
web: environment |
||||||
mkdir -p bin
|
cd src && env GOOS=js GOARCH=wasm go build -o $(game).wasm . && mv $(game).wasm ../$(webBin)
|
||||||
cd src && GOOS=windows GOARCH=amd64 go build && mv $(game)* ../bin
|
cp $(wasmHtml) $(webBin)
|
||||||
|
cp $(wasmExec)/misc/wasm/wasm_exec.js $(webBin)
|
||||||
|
|
||||||
|
desktop: clean environment |
||||||
|
cd src && GOOS=windows GOARCH=amd64 go build && mv $(game)* ../$(desktopBin)
|
||||||
|
cd src && GOOS=linux GOARCH=amd64 go build && mv $(game)* ../$(desktopBin)
|
||||||
|
|
||||||
|
cross: clean environment web desktop |
||||||
|
|
||||||
|
environment: |
||||||
|
mkdir -p $(desktopBin) $(webBin)
|
||||||
|
|
||||||
clean: |
clean: |
||||||
rm -rf bin
|
rm -rf bin
|
@ -0,0 +1,16 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<script src="wasm_exec.js"></script> |
||||||
|
|
||||||
|
<script> |
||||||
|
if (!WebAssembly.instantiateStreaming) { |
||||||
|
WebAssembly.instantiateStreaming = async (resp, importObject) => { |
||||||
|
const source = await (await resp).arrayBuffer(); |
||||||
|
return await WebAssembly.instantiate(source, importObject); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
const go = new Go(); |
||||||
|
WebAssembly.instantiateStreaming(fetch("capyclick.wasm"), go.importObject).then(result => { |
||||||
|
go.run(result.instance); |
||||||
|
}); |
||||||
|
</script> |
Loading…
Reference in new issue