mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Examples: Emscripten: Add 'make serve' helper, move output to web/ folder. (#3705)
This commit is contained in:
parent
31a2f0c164
commit
0f14dd9781
2
examples/example_emscripten_opengl3/.gitignore
vendored
Normal file
2
examples/example_emscripten_opengl3/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Ignore Web Instance
|
||||||
|
web/
|
@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
CC = emcc
|
CC = emcc
|
||||||
CXX = em++
|
CXX = em++
|
||||||
EXE = example_emscripten_opengl3.html
|
WEB_DIR = web
|
||||||
|
EXE = $(WEB_DIR)/example_emscripten_opengl3.html
|
||||||
IMGUI_DIR = ../..
|
IMGUI_DIR = ../..
|
||||||
SOURCES = main.cpp
|
SOURCES = main.cpp
|
||||||
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
|
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
|
||||||
@ -78,8 +79,14 @@ LDFLAGS += --shell-file shell_minimal.html
|
|||||||
all: $(EXE)
|
all: $(EXE)
|
||||||
@echo Build complete for $(EXE)
|
@echo Build complete for $(EXE)
|
||||||
|
|
||||||
$(EXE): $(OBJS)
|
$(WEB_DIR):
|
||||||
$(CXX) -o $@ $^ $(LIBS) $(LDFLAGS)
|
mkdir $@
|
||||||
|
|
||||||
|
serve: all
|
||||||
|
python3 -m http.server -d $(WEB_DIR)
|
||||||
|
|
||||||
|
$(EXE): $(OBJS) $(WEB_DIR)
|
||||||
|
$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(EXE) $(OBJS) *.js *.wasm *.wasm.pre
|
rm -rf $(EXE) $(OBJS) *.js *.wasm *.wasm.pre $(WEB_DIR)
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
To run on a local machine:
|
To run on a local machine:
|
||||||
- Generally you may need a local webserver. Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):<br>
|
- Generally you may need a local webserver. Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):<br>
|
||||||
_"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
|
_"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
|
||||||
- Emscripten SDK has a handy `emrun` command: `emrun example_emscripten_opengl3.html` which will spawn a temporary local webserver. See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
|
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
|
||||||
- Otherwise you may use Python builtin webserver: `python -m http.server` in Python 3 or `python -m SimpleHTTPServer` in Python 2. After doing that, you can visit http://localhost:8000/.
|
- Otherwise you may use Python builtin webserver: `python -m http.server -d web` in Python 3 (or run shortcut `make serve`) or `cd web && python -m SimpleHTTPServer` in Python 2. After doing that, you can visit http://localhost:8000/.
|
||||||
|
|
||||||
## Obsolete features:
|
## Obsolete features:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user