diff --git a/examples/example_glfw_opengl2/Makefile b/examples/example_glfw_opengl2/Makefile index 482b0e5d4..3649b7175 100644 --- a/examples/example_glfw_opengl2/Makefile +++ b/examples/example_glfw_opengl2/Makefile @@ -19,39 +19,46 @@ SOURCES = main.cpp SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl2.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" - LIBS = -lGL `pkg-config --static --libs glfw3` + LIBS += -lGL `pkg-config --static --libs glfw3` - CXXFLAGS = -I../ -I../../ `pkg-config --cflags glfw3` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += `pkg-config --cflags glfw3` CFLAGS = $(CXXFLAGS) endif ifeq ($(UNAME_S), Darwin) #APPLE ECHO_MESSAGE = "Mac OS X" - LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo - #LIBS += -L/usr/local/lib -lglfw3 - LIBS += -L/usr/local/lib -lglfw + LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo + LIBS += -L/usr/local/lib -L/opt/local/lib + #LIBS += -lglfw3 + LIBS += -lglfw - CXXFLAGS = -I../ -I../../ -I/usr/local/include - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I/usr/local/include -I/opt/local/include CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "Windows" - LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 + ECHO_MESSAGE = "MinGW" + LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 - CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` - CXXFLAGS += -Wall -Wformat - CFLAGS = $(CXXFLAGS) + CXXFLAGS += -I../libs/gl3w `pkg-config --cflags glfw3` + CFLAGS = $(CXXFLAGS) endif +##--------------------------------------------------------------------- +## BUILD RULES +##--------------------------------------------------------------------- %.o:%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/examples/example_glfw_opengl3/Makefile b/examples/example_glfw_opengl3/Makefile index a9c7007f9..e8cf46146 100644 --- a/examples/example_glfw_opengl3/Makefile +++ b/examples/example_glfw_opengl3/Makefile @@ -21,13 +21,17 @@ SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) +CXXFLAGS = -I../ -I../../ +CXXFLAGS += -g -Wall -Wformat +LIBS = + ##--------------------------------------------------------------------- ## OPENGL LOADER ##--------------------------------------------------------------------- ## Using OpenGL loader: gl3w [default] SOURCES += ../libs/gl3w/GL/gl3w.c -CXXFLAGS = -I../libs/gl3w +CXXFLAGS += -I../libs/gl3w ## Using OpenGL loader: glew ## (This assumes a system-wide installation) @@ -44,31 +48,29 @@ CXXFLAGS = -I../libs/gl3w ifeq ($(UNAME_S), Linux) #LINUX ECHO_MESSAGE = "Linux" - LIBS = -lGL `pkg-config --static --libs glfw3` + LIBS += -lGL `pkg-config --static --libs glfw3` - CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += `pkg-config --cflags glfw3` CFLAGS = $(CXXFLAGS) endif ifeq ($(UNAME_S), Darwin) #APPLE ECHO_MESSAGE = "Mac OS X" - LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo - #LIBS += -L/usr/local/lib -lglfw3 - LIBS += -L/usr/local/lib -lglfw + LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo + LIBS += -L/usr/local/lib -L/opt/local/lib + #LIBS += -lglfw3 + LIBS += -lglfw - CXXFLAGS += -I../ -I../../ -I/usr/local/include - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I/usr/local/include -I/opt/local/include CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "Windows" - LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 + ECHO_MESSAGE = "MinGW" + LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 - CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3` - CXXFLAGS += -Wall -Wformat - CFLAGS = $(CXXFLAGS) + CXXFLAGS += `pkg-config --cflags glfw3` + CFLAGS = $(CXXFLAGS) endif ##--------------------------------------------------------------------- diff --git a/examples/example_glut_opengl2/Makefile b/examples/example_glut_opengl2/Makefile index 25ddc43a7..c381c0c96 100644 --- a/examples/example_glut_opengl2/Makefile +++ b/examples/example_glut_opengl2/Makefile @@ -1,6 +1,6 @@ # # Cross Platform Makefile -# Compatible with Ubuntu 14.04.1 and Mac OS X +# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X # # Linux: # apt-get install freeglut3-dev @@ -10,41 +10,44 @@ #CXX = clang++ EXE = example_glut_opengl2 -SOURCES = main.cpp +SOURCES = main.cpp SOURCES += ../imgui_impl_glut.cpp ../imgui_impl_opengl2.cpp -SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.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" - LIBS = -lGL -lglut - - CXXFLAGS = -I ../ -I../.. - CXXFLAGS += -Wall -Wformat + LIBS += -lGL -lglut CFLAGS = $(CXXFLAGS) endif ifeq ($(UNAME_S), Darwin) #APPLE ECHO_MESSAGE = "Mac OS X" - LIBS = -framework OpenGL -framework GLUT + LIBS += -framework OpenGL -framework GLUT + LIBS += -L/usr/local/lib -L/opt/local/lib - CXXFLAGS = -I .. -I../.. - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I/usr/local/include -I/opt/local/include CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "Windows" - LIBS = -lgdi32 -lopengl32 -limm32 -lglut - - CXXFLAGS = -I ../ -I../../ - CXXFLAGS += -Wall -Wformat - CFLAGS = $(CXXFLAGS) + ECHO_MESSAGE = "MinGW" + LIBS += -lgdi32 -lopengl32 -limm32 -lglut + CFLAGS = $(CXXFLAGS) endif +##--------------------------------------------------------------------- +## BUILD RULES +##--------------------------------------------------------------------- %.o:%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/examples/example_sdl_opengl2/Makefile b/examples/example_sdl_opengl2/Makefile index 4a948aa49..ce29a249d 100644 --- a/examples/example_sdl_opengl2/Makefile +++ b/examples/example_sdl_opengl2/Makefile @@ -15,40 +15,49 @@ #CXX = clang++ EXE = example_sdl_opengl2 -SOURCES = main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp +SOURCES = main.cpp +SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.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" - LIBS = -lGL -ldl `sdl2-config --libs` + LIBS += -lGL -ldl `sdl2-config --libs` - CXXFLAGS = -I ../ -I../../ `sdl2-config --cflags` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += `sdl2-config --cflags` 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` + LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` + LIBS += -L/usr/local/lib -L/opt/local/lib - CXXFLAGS = -I ../ -I../../ -I/usr/local/include `sdl2-config --cflags` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += `sdl2-config --cflags` + CXXFLAGS += -I/usr/local/include -I/opt/local/include CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "Windows" - LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` + ECHO_MESSAGE = "MinGW" + LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` - CXXFLAGS = -I ../ -I../../ `pkg-config --cflags sdl2` - CXXFLAGS += -Wall -Wformat - CFLAGS = $(CXXFLAGS) + CXXFLAGS += `pkg-config --cflags sdl2` + CFLAGS = $(CXXFLAGS) endif +##--------------------------------------------------------------------- +## BUILD RULES +##--------------------------------------------------------------------- %.o:%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/examples/example_sdl_opengl3/Makefile b/examples/example_sdl_opengl3/Makefile index 69874119f..76601a1b8 100644 --- a/examples/example_sdl_opengl3/Makefile +++ b/examples/example_sdl_opengl3/Makefile @@ -21,13 +21,17 @@ SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) +CXXFLAGS = -I../ -I../../ +CXXFLAGS += -g -Wall -Wformat +LIBS = + ##--------------------------------------------------------------------- ## OPENGL LOADER ##--------------------------------------------------------------------- ## Using OpenGL loader: gl3w [default] SOURCES += ../libs/gl3w/GL/gl3w.c -CXXFLAGS = -I../libs/gl3w +CXXFLAGS += -I../libs/gl3w ## Using OpenGL loader: glew ## (This assumes a system-wide installation) @@ -44,28 +48,27 @@ CXXFLAGS = -I../libs/gl3w ifeq ($(UNAME_S), Linux) #LINUX ECHO_MESSAGE = "Linux" - LIBS = -lGL -ldl `sdl2-config --libs` + LIBS += -lGL -ldl `sdl2-config --libs` - CXXFLAGS = -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I../libs/gl3w `sdl2-config --cflags` 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` + LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` + LIBS += -L/usr/local/lib -L/opt/local/lib - CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include `sdl2-config --cflags` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I../libs/gl3w `sdl2-config --cflags` + CXXFLAGS += -I/usr/local/include -I/opt/local/include CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "Windows" - LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` + ECHO_MESSAGE = "MinGW" + LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` - CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags sdl2` - CXXFLAGS += -Wall -Wformat + CXXFLAGS += -I../libs/gl3w `pkg-config --cflags sdl2` CFLAGS = $(CXXFLAGS) endif