forked from ocornut/imgui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example: SDL2 + OpenGL ES2 (+ optionally Emscripten)
Should work with emscripten, as well as mobile hardware. Inspired by: ocornut#336
- Loading branch information
Showing
5 changed files
with
606 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
# Cross Platform Makefile | ||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X | ||
# | ||
# | ||
# You will need SDL2 (http://www.libsdl.org) | ||
# | ||
# apt-get install libsdl2-dev # Linux | ||
# brew install sdl2 # Mac OS X | ||
# pacman -S mingw-w64-i686-SDL # MSYS2 | ||
# | ||
|
||
#CXX = g++ | ||
|
||
EXE = sdl_opengles2_example | ||
OBJS = main.o imgui_impl_sdl_gles2.o | ||
OBJS += ../../imgui.o ../../imgui_demo.o ../../imgui_draw.o | ||
|
||
UNAME_S := $(shell uname -s) | ||
|
||
|
||
ifeq ($(UNAME_S), Linux) #LINUX | ||
ECHO_MESSAGE = "Linux" | ||
LIBS = -lGLESv2 -ldl `sdl2-config --libs` | ||
|
||
CXXFLAGS = -I../../ `sdl2-config --cflags` | ||
CXXFLAGS += -Wall -Wformat | ||
CFLAGS = $(CXXFLAGS) | ||
endif | ||
|
||
ifeq ($(UNAME_S), Darwin) #APPLE | ||
ECHO_MESSAGE = "Mac OS X" | ||
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` | ||
|
||
CXXFLAGS = -I../../ -I/usr/local/include `sdl2-config --cflags` | ||
CXXFLAGS += -Wall -Wformat | ||
CFLAGS = $(CXXFLAGS) | ||
endif | ||
|
||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) | ||
ECHO_MESSAGE = "Windows" | ||
LIBS = -lgdi32 -limm32 `pkg-config --static --libs sdl2` | ||
|
||
CXXFLAGS = -I../../ `pkg-config --cflags sdl2` | ||
CXXFLAGS += -Wall -Wformat | ||
CFLAGS = $(CXXFLAGS) | ||
endif | ||
|
||
|
||
.cpp.o: | ||
$(CXX) $(CXXFLAGS) -c -o $@ $< | ||
|
||
all: $(EXE) | ||
@echo Build complete for $(ECHO_MESSAGE) | ||
|
||
$(EXE): $(OBJS) | ||
$(CXX) -o $(EXE) $(OBJS) $(CXXFLAGS) $(LIBS) | ||
|
||
clean: | ||
rm $(EXE) $(OBJS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
# How to Build | ||
|
||
- On Linux and similar Unixes | ||
|
||
``` | ||
c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl_gles2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGLESv2 -ldl -o sdl2_opengles2_example | ||
``` | ||
- Emscripten | ||
|
||
``` | ||
em++ -O2 -s USE_SDL=2 -I ../.. main.cpp imgui_impl_sdl.cpp ../../imgui*.cpp -o html/index.html | ||
``` |
Oops, something went wrong.