From 52f24d4e671f756cda3067f405cfabd1891bad31 Mon Sep 17 00:00:00 2001 From: jwdeitch Date: Thu, 17 Aug 2017 00:28:03 -0400 Subject: [PATCH] fix compiling error on OSX error: ld: library not found for -lglfw3 --- demo/glfw_opengl3/Makefile | 5 +++-- example/Makefile | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/demo/glfw_opengl3/Makefile b/demo/glfw_opengl3/Makefile index e60be35..d7e68fa 100644 --- a/demo/glfw_opengl3/Makefile +++ b/demo/glfw_opengl3/Makefile @@ -12,10 +12,11 @@ BIN := $(BIN).exe LIBS = -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32 else UNAME_S := $(shell uname -s) + GLFW3 := $(shell pkg-config --libs glfw3) ifeq ($(UNAME_S),Darwin) - LIBS := -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lm -lGLEW -L/usr/local/lib + LIBS := $(GLFW3) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lm -lGLEW -L/usr/local/lib else - LIBS = -lglfw -lGL -lm -lGLU -lGLEW + LIBS = $(GLFW3) -lGL -lm -lGLU -lGLEW endif endif diff --git a/example/Makefile b/example/Makefile index a3bda90..8efa6cd 100644 --- a/example/Makefile +++ b/example/Makefile @@ -7,11 +7,12 @@ BIN := $(BIN).exe LIBS := -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32 else UNAME_S := $(shell uname -s) + GLFW3 := $(shell pkg-config --libs glfw3) ifeq ($(UNAME_S),Darwin) - LIBS := -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lm -lGLEW -L/usr/local/lib + LIBS := $(GLFW3) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lm -lGLEW -L/usr/local/lib CFLAGS += -I/usr/local/include else - LIBS := -lglfw -lGL -lm -lGLU -lGLEW + LIBS := $(GLFW3) -lGL -lm -lGLU -lGLEW endif endif