From b8fe0df7df79dcf7560246f9c3510f5e54de6ff6 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 8 Apr 2019 19:16:45 +0200 Subject: [PATCH] Examples: Null: Added Makefile. --- examples/.gitignore | 3 +- examples/example_null/Makefile | 59 ++++++++++++++++++++++++++++++++++ examples/example_null/main.cpp | 5 +-- 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 examples/example_null/Makefile diff --git a/examples/.gitignore b/examples/.gitignore index 428ea4466..ddfa5eadd 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -31,9 +31,10 @@ xcuserdata ## Unix executables example_glfw_opengl2/example_glfw_opengl2 example_glfw_opengl3/example_glfw_opengl3 +example_glut_opengl2/example_glut_opengl2 +example_null/example_null example_sdl_opengl2/example_sdl_opengl2 example_sdl_opengl3/example_sdl_opengl3 -example_glut_opengl2/example_glut_opengl2 ## Dear ImGui Ini files imgui.ini diff --git a/examples/example_null/Makefile b/examples/example_null/Makefile new file mode 100644 index 000000000..012758fe2 --- /dev/null +++ b/examples/example_null/Makefile @@ -0,0 +1,59 @@ +# +# Cross Platform Makefile +# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X +# + +EXE = example_null +SOURCES = main.cpp +SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp +OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) +UNAME_S := $(shell uname -s) + +CXXFLAGS = -I../ -I../../ +CXXFLAGS += -g -Wall -Wformat +LIBS = + +##--------------------------------------------------------------------- +## BUILD FLAGS PER PLATFORM +##--------------------------------------------------------------------- + +ifeq ($(UNAME_S), Linux) #LINUX + ECHO_MESSAGE = "Linux" + CFLAGS = $(CXXFLAGS) +endif + +ifeq ($(UNAME_S), Darwin) #APPLE + ECHO_MESSAGE = "Mac OS X" + CFLAGS = $(CXXFLAGS) +endif + +ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) + ECHO_MESSAGE = "MinGW" + CFLAGS = $(CXXFLAGS) +endif + +##--------------------------------------------------------------------- +## BUILD RULES +##--------------------------------------------------------------------- + +%.o:%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:../%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:../../%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:../libs/gl3w/GL/%.c +# %.o:../libs/glad/src/%.c + $(CC) $(CFLAGS) -c -o $@ $< + +all: $(EXE) + @echo Build complete for $(ECHO_MESSAGE) + +$(EXE): $(OBJS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) + +clean: + rm -f $(EXE) $(OBJS) diff --git a/examples/example_null/main.cpp b/examples/example_null/main.cpp index 90521f9b0..81af09996 100644 --- a/examples/example_null/main.cpp +++ b/examples/example_null/main.cpp @@ -1,4 +1,5 @@ -// dear imgui: null/dummy example application (compile and link imgui with no inputs, no outputs) +// dear imgui: null/dummy example application (compile and link imgui with NO INPUTS, NO OUTPUTS) +// This is useful to test building, but you cannot interact with anything here! #include "imgui.h" #include @@ -13,7 +14,7 @@ int main(int, char**) int tex_w, tex_h; io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); - for (int n = 0; n < 50; n++) + for (int n = 0; n < 20; n++) { printf("NewFrame() %d\n", n); io.DisplaySize = ImVec2(1920, 1080);