Skip to content

Commit

Permalink
Merge pull request #11 from shuding/update-bindings
Browse files Browse the repository at this point in the history
Update bindings
  • Loading branch information
shuding authored Jan 28, 2023
2 parents 9e50e35 + a44903c commit 34fd3dc
Show file tree
Hide file tree
Showing 19 changed files with 532 additions and 1,609 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: mymindstorm/setup-emsdk@v11
- uses: mymindstorm/setup-emsdk@v12
with:
version: 3.1.26
version: 3.1.31
actions-cache-folder: "emsdk-cache"
- name: Use pnpm
run: corepack enable pnpm && pnpm --version
Expand Down
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ CC=emcc
all: clean dir wasm asm

wasm:
$(CC) yoga/yoga/*.cpp bindings/*.cc \
$(CC) yoga/yoga/*.cpp yoga/yoga/**/*.cpp yoga/javascript/src_native/*.cc \
--bind \
-Iyoga \
-g0 \
-Os \
-O3 \
-flto \
-std=c++14 \
-fno-exceptions \
-fno-rtti \
-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
--closure 1 \
-s WASM=1 \
-s WASM_ASYNC_COMPILATION=1 \
-s USE_CLOSURE_COMPILER=1 \
Expand All @@ -19,19 +24,25 @@ wasm:
-s DYNAMIC_EXECUTION=0 \
-s TEXTDECODER=0 \
-s ENVIRONMENT='web' \
-s FETCH_SUPPORT_INDEXEDDB=0 \
-s FILESYSTEM=0 \
-s MALLOC="emmalloc" \
-s INCOMING_MODULE_JS_API=['instantiateWasm','locateFile']\
-s INCOMING_MODULE_JS_API=['instantiateWasm']\
-s EXPORT_NAME="yoga" \
-o tmp/yoga.mjs

asm:
$(CC) yoga/yoga/*.cpp bindings/*.cc \
$(CC) yoga/yoga/*.cpp yoga/yoga/**/*.cpp yoga/javascript/src_native/*.cc \
--bind \
-Iyoga \
-g0 \
-Os \
-flto \
-std=c++14 \
-fno-exceptions \
-fno-rtti \
-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
--closure 1 \
--memory-init-file 0 \
-s WASM=0 \
-s WASM_ASYNC_COMPILATION=0 \
Expand All @@ -43,7 +54,7 @@ asm:
-s DYNAMIC_EXECUTION=0 \
-s TEXTDECODER=0 \
-s ENVIRONMENT='web' \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-s FETCH_SUPPORT_INDEXEDDB=0 \
-s FILESYSTEM=0 \
-s MALLOC="emmalloc" \
-s EXPORT_NAME="yoga" \
Expand Down
6 changes: 6 additions & 0 deletions asm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Yoga } from "./dist/wrapAsm";

export * from "./dist/generated/YGEnums";
export * from "./dist/wrapAsm";

export default function (): Yoga;
10 changes: 3 additions & 7 deletions asm.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import entry from './entry/index.js'
import yoga from './tmp/yoga-asm.mjs'

function bind(_, proto) {
return proto
}
import wrapAsm from "./yoga/javascript/src_js/wrapAsm.js";
import yoga from "./tmp/yoga-asm.mjs";

export default function () {
return entry(bind, yoga())
return wrapAsm(yoga());
}
31 changes: 0 additions & 31 deletions bindings/Config.cc

This file was deleted.

34 changes: 0 additions & 34 deletions bindings/Config.hh

This file was deleted.

12 changes: 0 additions & 12 deletions bindings/Layout.hh

This file was deleted.

Loading

0 comments on commit 34fd3dc

Please sign in to comment.