Kaynağa Gözat

Examples: Null: Added Makefile.

omar 6 yıl önce
ebeveyn
işleme
b8fe0df7df

+ 2 - 1
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

+ 59 - 0
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)

+ 3 - 2
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 <stdio.h>
 
@@ -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);