diff --git a/examples/viewer/Makefile b/examples/viewer/Makefile index f06e3d0..d42278c 100644 --- a/examples/viewer/Makefile +++ b/examples/viewer/Makefile @@ -1,18 +1,66 @@ -GLFW_INC=-I/usr/local/include +CXX_FLAGS=-O0 -g -Wno-deprecated-declarations +ifndef PLATFORM UNAME=$(shell uname -s) +# OSX TEST ifeq ($(UNAME),Darwin) -# OSX -GLFW_LIBS=-L/usr/local/lib -lglfw3 -lGLEW -GL_LIBS=-framework OpenGL +PLATFORM=OSX else -# Assume Linux -GLFW_LIBS=-L/usr/local/lib -lglfw3 -lGLEW -GL_LIBS=-lGL -lGLU -lX11 -lXrandr -lXi -lXxf86vm -lXcursor -lXinerama -ldl -pthread +# WINDOWS MINGW TEST +ifeq ($(findstring MINGW, $(UNAME)), MINGW) + PLATFORM=WINDOWS_MINGW +else +# ASSUME LINUX + PLATFORM=LINUX +endif endif -CXX_FLAGS=-Wno-deprecated-declarations +endif +$(info PLATFORM SELECTED: $(PLATFORM)) + +ifeq ($(PLATFORM),OSX) +# OSX CONFIGURATION------------------------------------------------------------- +CXX_FLAGS+= -fsanitize=address +GLFW_INC=-I/usr/local/include +GLFW_LIB_DIR=/usr/local/lib +GLFW_LIBS=-L$(GLFW_LIB_DIR) -lglfw3 -lGLEW +GL_LIBS=-framework OpenGL +# /OSX CONFIGURATION------------------------------------------------------------ +else +ifeq ($(PLATFORM),LINUX) +# LINUX CONFIGURATION----------------------------------------------------------- +CXX_FLAGS+= -fsanitize=address +GLFW_INC=-I/usr/local/include +GLFW_LIB_DIR=/usr/local/lib +GLFW_LIBS=-L$(GLFW_LIB_DIR) -lglfw3 -lGLEW +GL_LIBS=-lGL -lGLU -lX11 -lXrandr -lXi -lXxf86vm -lXcursor -lXinerama -ldl -pthread +# /LINUX CONFIGURATION---------------------------------------------------------- +else +ifeq ($(PLATFORM),WINDOWS_MINGW) +# WINDOWS MINGW CONFIGURATION--------------------------------------------------- +# Since Windows unfortunately doesn't have any defacto directories for third +# party libraries, we'll have to force the user to give us them. So we check +# that the user passed in GLFW-dirs in some way, via flag or environ. +ifndef GLFW_DIR +$(error NO GLFW_DIR SPECIFIED. PASS GLFW_DIR=