mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-11 17:59:01 +08:00
Add WASI build procedure.
This commit is contained in:
parent
e0b625561c
commit
6e8a858c45
@ -86,6 +86,12 @@ In extension(`ExtensionMap`), JSON number value is parsed as int or float(number
|
||||
* [basic](examples/basic) : Basic glTF viewer with texturing support.
|
||||
* [build-gltf](examples/build-gltf) : Build simple glTF scene from a scratch.
|
||||
|
||||
### WASI/WASM build
|
||||
|
||||
Users who want to run TinyGLTF securely and safely(e.g. need to handle malcious glTF file to serve online glTF conver),
|
||||
I recommend to build TinyGLTF for WASM target.
|
||||
WASI build example is located in [wasm](wasm) .
|
||||
|
||||
## Projects using TinyGLTF
|
||||
|
||||
* px_render Single header C++ Libraries for Thread Scheduling, Rendering, and so on... https://github.com/pplux/px
|
||||
|
11
wasm/Makefile
Normal file
11
wasm/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
WASI_VERSION=16
|
||||
WASI_VERSION_FULL=${WASI_VERSION}.0
|
||||
|
||||
WASI_SDK_PATH=$(HOME)/local/wasi-sdk-${WASI_VERSION_FULL}
|
||||
|
||||
CC=${WASI_SDK_PATH}/bin/clang
|
||||
CXX=${WASI_SDK_PATH}/bin/clang++
|
||||
CXXFLAGS=-fno-rtti -fno-exceptions -g -Os
|
||||
|
||||
all:
|
||||
$(CXX) ../loader_example.cc $(CXXFLAGS) -I../
|
31
wasm/README.md
Normal file
31
wasm/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
Experimental WASI/WASM build
|
||||
|
||||
## Build
|
||||
|
||||
Download wasi-sdk https://github.com/WebAssembly/wasi-sdk
|
||||
|
||||
Compile tinygltf with C++ exceptions and threads off. See `Makefile` for details
|
||||
(NOTE: TinyGLTF itself does not use RTTI and threading feature(C++ threads, posix, win32 thread))
|
||||
|
||||
## Build examples and Run
|
||||
|
||||
Build `loader_example.cc`
|
||||
|
||||
```
|
||||
$ /path/to/wasi-sdk-16.0/bin/clang++ ../loader_example.cc -fno-rtti -fno-exceptions -g -Os -I../ -o loader_example.wasi
|
||||
```
|
||||
|
||||
Tested with wasmtime. https://github.com/bytecodealliance/wasmtime
|
||||
|
||||
|
||||
Set a folder containing .gltf file to `--dir`
|
||||
|
||||
```
|
||||
$ wasmtime --dir=../models loader_example.wasi ../models/Cube/Cube.gltf
|
||||
```
|
||||
|
||||
## Emscripen
|
||||
|
||||
T.B.W. ...
|
||||
|
||||
EoL.
|
Loading…
x
Reference in New Issue
Block a user