mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-04-22 22:00:15 +08:00
Merge pull request #405 from ggetz/ie-compatibility-js-decoder
Add a flag for cmake to generate IE11 compatible JS decoder modules
This commit is contained in:
commit
83cbf6c50d
@ -606,6 +606,9 @@ include_directories("${draco_root}/src" "${draco_build_dir}")
|
||||
if (EMSCRIPTEN AND ENABLE_JS_GLUE)
|
||||
# Draco js decoder.
|
||||
require_compiler_flag("-s ALLOW_MEMORY_GROWTH=1" YES)
|
||||
if (IE_COMPATIBLE)
|
||||
require_compiler_flag("-s LEGACY_VM_SUPPORT=1" YES)
|
||||
endif ()
|
||||
require_compiler_flag("-Wno-almost-asm" YES)
|
||||
require_compiler_flag("--memory-init-file 0" YES)
|
||||
require_compiler_flag("-fno-omit-frame-pointer" YES)
|
||||
@ -624,7 +627,11 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "")
|
||||
# Force -O3 when no build type is specified.
|
||||
add_compiler_flag_if_supported("-O3")
|
||||
if (IE_COMPATIBLE)
|
||||
add_compiler_flag_if_supported("-g")
|
||||
else ()
|
||||
add_compiler_flag_if_supported("-O3")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(draco_js_dec_idl
|
||||
|
@ -59,7 +59,11 @@ ALL_C_OPTS := -std=c++11
|
||||
#ALL_C_OPTS += -s USE_SDL=0 -s USE_SDL_IMAGE=0 -s USE_SDL_TTF=0
|
||||
|
||||
# Options for speed.
|
||||
ALL_C_OPTS += -O3
|
||||
ifeq ($(IE_COMPATIBLE), true)
|
||||
ALL_C_OPTS += -g
|
||||
else
|
||||
ALL_C_OPTS += -O3
|
||||
endif
|
||||
ALL_C_OPTS += -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1
|
||||
ALL_C_OPTS += -s EXPORTED_RUNTIME_METHODS=[]
|
||||
ALL_C_OPTS += -s PRECISE_F32=1
|
||||
@ -78,6 +82,11 @@ endif
|
||||
ALL_C_OPTS += -s ALLOW_MEMORY_GROWTH=1
|
||||
#ALL_C_OPTS += -s TOTAL_MEMORY=67108864
|
||||
|
||||
# Allow legacy vm support for IE11
|
||||
ifeq ($(IE_COMPATIBLE), true)
|
||||
ALL_C_OPTS += -s LEGACY_VM_SUPPORT=1
|
||||
endif
|
||||
|
||||
# Export the main module as "DracoDecoderModule".
|
||||
ALL_C_OPTS += -s MODULARIZE=1 -s EXPORT_NAME="'DracoDecoderModule'"
|
||||
|
||||
|
@ -212,6 +212,12 @@ $ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=/path/to/Emscripten.cmake
|
||||
$ make
|
||||
~~~~~
|
||||
|
||||
To build a decoder module that is compatible with IE11 (at the cost of a slightly larger resulting module), set the `IE_COMPATIBLE` variable to `true` when generating the cmake file.
|
||||
|
||||
~~~~~ bash
|
||||
$ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=/path/to/Emscripten.cmake -DIE_COMPATIBLE=true
|
||||
~~~~~
|
||||
|
||||
WebAssembly Decoder
|
||||
-------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user