2019-04-13 23:25:06 +08:00
|
|
|
#
|
|
|
|
# Makefile to use with emscripten
|
|
|
|
# See https://emscripten.org/docs/getting_started/downloads.html
|
|
|
|
# for installation instructions. This Makefile assumes you have
|
|
|
|
# loaded emscripten's environment.
|
|
|
|
#
|
|
|
|
# Running `make` will produce three files:
|
|
|
|
# - example_emscripten.html
|
|
|
|
# - example_emscripten.js
|
|
|
|
# - example_emscripten.wasm
|
|
|
|
#
|
|
|
|
# All three are needed to run the demo.
|
|
|
|
|
|
|
|
CC = emcc
|
|
|
|
CXX = em++
|
|
|
|
|
|
|
|
EXE = example_emscripten.html
|
|
|
|
SOURCES = main.cpp
|
|
|
|
SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
|
|
|
|
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
|
|
|
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
2019-04-15 07:01:44 +08:00
|
|
|
EMS = -s USE_SDL=2 -s WASM=1
|
2019-04-13 23:25:06 +08:00
|
|
|
EMS += -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_TRAP_MODE=clamp
|
2019-04-15 07:01:44 +08:00
|
|
|
EMS += -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=0
|
2019-10-23 22:55:26 +08:00
|
|
|
EMS += -s ASSERTIONS=1
|
|
|
|
#EMS += -s NO_FILESYSTEM=1 ## Getting "error: undefined symbol: $FS" if filesystem is removed
|
2019-04-15 22:36:14 +08:00
|
|
|
#EMS += -s SAFE_HEAP=1 ## Adds overhead
|
2019-04-13 23:25:06 +08:00
|
|
|
|
|
|
|
CPPFLAGS = -I../ -I../../
|
2019-04-15 22:36:14 +08:00
|
|
|
#CPPFLAGS += -g
|
|
|
|
CPPFLAGS += -Wall -Wformat -Os
|
2019-04-13 23:25:06 +08:00
|
|
|
CPPFLAGS += $(EMS)
|
|
|
|
LIBS = $(EMS)
|
|
|
|
LDFLAGS = --shell-file shell_minimal.html
|
|
|
|
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
## BUILD RULES
|
|
|
|
##---------------------------------------------------------------------
|
|
|
|
|
|
|
|
%.o:%.cpp
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o:../%.cpp
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o:../../%.cpp
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o:../libs/gl3w/GL/%.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
all: $(EXE)
|
|
|
|
@echo Build complete for $(EXE)
|
|
|
|
|
|
|
|
$(EXE): $(OBJS)
|
|
|
|
$(CXX) -o $@ $^ $(LIBS) $(LDFLAGS)
|
|
|
|
|
|
|
|
clean:
|
2019-04-15 07:01:44 +08:00
|
|
|
rm -f $(EXE) $(OBJS) *.js *.wasm *.wasm.pre
|