feat! js_interop improvements
This commit is contained in:
@@ -49,3 +49,67 @@ cmake --build . --target tinyexr --config Release
|
||||
cmake --build . --target imageio --config Release
|
||||
cmake --build . --config Debug
|
||||
```
|
||||
|
||||
# Web
|
||||
|
||||
By default, Filament WASM builds are single-threaded with no support for `-pthread` (`WEBGL_PTHREADS=0`).
|
||||
|
||||
This won't work with our current implementation, since at least `-pthread` is needed to support running Filament on a dedicated (non-main) render thread.
|
||||
|
||||
However, the multi-threaded Filament WASM build (`WEBGL_PTHREADS=1`, which sets `-pthread`) doesn't work with our current setup (which uses an OffscreenCanvas without proxying, effectively locking the context to a single thread).
|
||||
|
||||
To work around, we need to adjust the Filament build configuration to build:
|
||||
1) a single-threaded library
|
||||
2) but with `-pthread` enabled
|
||||
|
||||
|
||||
```
|
||||
./build.sh -p desktop release
|
||||
mkdir -p out/cmake-webgl-release
|
||||
cd out/cmake-webgl-release
|
||||
ln -s ../cmake-release/tools
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBGL=1 \
|
||||
-DWEBGL_PTHREADS=1 \
|
||||
-DFILAMENT_SKIP_SAMPLES=1 \
|
||||
-DZLIB_INCLUDE_DIR=../../../../third_party/libz \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
|
||||
-DCMAKE_C_FLAGS="-pthread" \
|
||||
-DCMAKE_CXX_FLAGS="-pthread" \
|
||||
-DIS_HOST_PLATFORM=0 -DZ_HAVE_UNISTD_H=1 -DUSE_ZLIB=1 -DIMPORT_EXECUTABLES_DIR=out \
|
||||
../../
|
||||
ninja;
|
||||
mkdir imageio
|
||||
cd imageio
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBGL=1 \
|
||||
-DWEBGL_PTHREADS=1 \
|
||||
-DFILAMENT_SKIP_SAMPLES=1 \
|
||||
-DZLIB_INCLUDE_DIR=../../../../third_party/libz \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
|
||||
-DCMAKE_C_FLAGS="-pthread" \
|
||||
-DCMAKE_CXX_FLAGS="-pthread" \
|
||||
-DZ_HAVE_UNISTD_H=1 -DUSE_ZLIB=1 -DIMPORT_EXECUTABLES_DIR=out -DCMAKE_CXX_FLAGS="-I../../../libs/image/include -I../../../libs/utils/include -I../../../libs/math/include -I../../../third_party/tinyexr -I../../../third_party/libpng -I../../../third_party/basisu/encoder" \
|
||||
../../../libs/imageio
|
||||
ninja
|
||||
cd ..
|
||||
mkdir thirdparty/
|
||||
cd thirdparty/
|
||||
#find . -type f -exec file {} \; | grep "text" | cut -d: -f1 | xargs dos2unix
|
||||
for lib in tinyexr libpng libz; do
|
||||
mkdir -p $lib;
|
||||
pushd $lib;
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBGL=1 \
|
||||
-DWEBGL_PTHREADS=1 \
|
||||
-DFILAMENT_SKIP_SAMPLES=1 \
|
||||
-DZLIB_INCLUDE_DIR=../../../../third_party/libz \
|
||||
-DCMAKE_C_FLAGS="-pthread -Wno-reserved-identifier" \
|
||||
-DCMAKE_CXX_FLAGS="-pthread -Wno-reserved-identifier" \
|
||||
../../../../third_party/$lib;
|
||||
ninja;
|
||||
popd;
|
||||
done
|
||||
Reference in New Issue
Block a user