Make it easier to enable support for compiling emscripten to wasm.

Add some documentation.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5638 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2018-08-18 19:50:51 +00:00
parent b69f9f387a
commit 4ea4f3be95
3 changed files with 16 additions and 0 deletions

View File

@ -48,7 +48,11 @@ all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc
all_win32 clean_win32 static_win32: SUF=.exe
all_emscripten clean_emscripten: SUF=.html
all_emscripten: CXXFLAGS += -fno-exceptions -fno-rtti -fstrict-aliasing -std=gnu++11 -U__STRICT_ANSI__
# Pass on a custom html file.
#all_emscripten: CXXFLAGS += --shell-file shell_minimal.html
all_emscripten: LDFLAGS += -lGL -lSDL --preload-file ../../media@/media -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=1
#If you know the maximum memory (in bytes) which your application need then set it. It can speed things up a lot.
#all_emscripten: LDFLAGS += -s TOTAL_MEMORY=268435456
# You need the FULL_ES2 when using EDT_OGLES2 driver
#all_emscripten: LDFLAGS += -s FULL_ES2=1
static_win32: CPPFLAGS += -D_IRR_STATIC_LIB_
@ -57,6 +61,13 @@ static_win32: LDFLAGS += -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid
# name of the binary - only valid for targets which set SYSTEM
DESTPATH = $(BinPath)/$(Target)$(SUF)
# Enable compiling to WASM and not just asm.js (you have to set it in the engine Makefile as well)
ifdef EMSCRIPTEN
ifdef WASM
CXXFLAGS += -s WASM=1
endif
endif
emscripten: all_emscripten
all_linux all_win32 all_emscripten static_win32:

View File

@ -20,3 +20,5 @@ emmake make emscripten
Go into examples/01.HelloWord_emscripten folder and call:
emmake make all_emscripten
Note: The shell_minimal.html is currently not used (as resizing isn't working yet correctly), but can be enabled in the Makefile.

View File

@ -90,6 +90,9 @@ ifdef EMSCRIPTEN
else
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES
endif
ifdef WASM
CXXFLAGS += -s WASM=1
endif
else
CFLAGS := -O3 -fexpensive-optimizations -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES
endif