mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-06-04 11:25:44 +08:00
Add a flag for cmake to generate IE11 compatible js decoder modules
This commit is contained in:
parent
affc0ad888
commit
ee55b3b654
@ -607,6 +607,9 @@ set(draco_maya_plug_sources
|
|||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
# Draco js decoder.
|
# Draco js decoder.
|
||||||
require_compiler_flag("-s ALLOW_MEMORY_GROWTH=1" YES)
|
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("-Wno-almost-asm" YES)
|
||||||
require_compiler_flag("--memory-init-file 0" YES)
|
require_compiler_flag("--memory-init-file 0" YES)
|
||||||
require_compiler_flag("-fno-omit-frame-pointer" YES)
|
require_compiler_flag("-fno-omit-frame-pointer" YES)
|
||||||
@ -625,8 +628,12 @@ if (EMSCRIPTEN)
|
|||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "")
|
if (CMAKE_BUILD_TYPE STREQUAL "")
|
||||||
# Force -O3 when no build type is specified.
|
# Force -O3 when no build type is specified.
|
||||||
|
if (IE_COMPATIBLE)
|
||||||
|
add_compiler_flag_if_supported("-g")
|
||||||
|
else ()
|
||||||
add_compiler_flag_if_supported("-O3")
|
add_compiler_flag_if_supported("-O3")
|
||||||
endif ()
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(draco_js_dec_idl
|
set(draco_js_dec_idl
|
||||||
"${draco_src_root}/javascript/emscripten/draco_web_decoder.idl")
|
"${draco_src_root}/javascript/emscripten/draco_web_decoder.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
|
#ALL_C_OPTS += -s USE_SDL=0 -s USE_SDL_IMAGE=0 -s USE_SDL_TTF=0
|
||||||
|
|
||||||
# Options for speed.
|
# Options for speed.
|
||||||
|
ifeq ($(IE_COMPATIBLE), true)
|
||||||
|
ALL_C_OPTS += -g
|
||||||
|
else
|
||||||
ALL_C_OPTS += -O3
|
ALL_C_OPTS += -O3
|
||||||
|
endif
|
||||||
ALL_C_OPTS += -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1
|
ALL_C_OPTS += -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1
|
||||||
ALL_C_OPTS += -s EXPORTED_RUNTIME_METHODS=[]
|
ALL_C_OPTS += -s EXPORTED_RUNTIME_METHODS=[]
|
||||||
ALL_C_OPTS += -s PRECISE_F32=1
|
ALL_C_OPTS += -s PRECISE_F32=1
|
||||||
@ -78,6 +82,11 @@ endif
|
|||||||
ALL_C_OPTS += -s ALLOW_MEMORY_GROWTH=1
|
ALL_C_OPTS += -s ALLOW_MEMORY_GROWTH=1
|
||||||
#ALL_C_OPTS += -s TOTAL_MEMORY=67108864
|
#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".
|
# Export the main module as "DracoDecoderModule".
|
||||||
ALL_C_OPTS += -s MODULARIZE=1 -s EXPORT_NAME="'DracoDecoderModule'"
|
ALL_C_OPTS += -s MODULARIZE=1 -s EXPORT_NAME="'DracoDecoderModule'"
|
||||||
|
|
||||||
|
@ -209,6 +209,12 @@ $ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=/path/to/Emscripten.cmake
|
|||||||
$ make
|
$ 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
|
WebAssembly Decoder
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user