Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag for cmake to generate IE11 compatible JS decoder modules #405

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ set(draco_maya_plug_sources
if (EMSCRIPTEN)
# 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)
Expand All @@ -625,7 +628,11 @@ if (EMSCRIPTEN)

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
Expand Down
11 changes: 10 additions & 1 deletion Makefile.decoder.emcc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'"

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,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
-------------------

Expand Down