File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,21 +271,19 @@ endif
271271
272272ifeq ($(IS_LINUX ) ,yes)
273273 # GLFW on Linux
274- LIBS += -lglfw
275-
276- # OpenGL + X11 stack
277- LIBS += -lGL -ldl -lpthread
278- LIBS += -lXrandr -lXinerama -lXcursor -lXi
274+ LIBS += ` pkg-config --static --libs glfw3 `
279275endif
280276
281277ifeq ($(IS_MACOS ) ,yes)
282- LIBS += -lglfw
278+ BREW_PREFIX := $(shell brew --prefix 2>/dev/null || echo /usr/local)
279+
280+ CXXFLAGS += -I$(BREW_PREFIX ) /include
281+ LIBS += -L$(BREW_PREFIX ) /lib
282+
283+ LIBS += `pkg-config --static --libs glfw3`
283284
284285 # macOS frameworks (use -framework instead of -l)
285286 LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
286- LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib
287-
288- CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include
289287endif
290288
291289# Final linker command ingredients
Original file line number Diff line number Diff line change @@ -268,17 +268,19 @@ ifeq ($(IS_WINDOWS),yes)
268268endif
269269
270270ifeq ($(IS_LINUX ) ,yes)
271- # OpenGL + X11 stack
272- LIBS += -lGL -ldl -lpthread
273- LIBS += -lXrandr -lXinerama -lXcursor -lXi
271+ LIBS +=
274272endif
275273
276274ifeq ($(IS_MACOS ) ,yes)
275+ BREW_PREFIX := $(shell brew --prefix 2>/dev/null || echo /usr/local)
276+
277+ CXXFLAGS += -I$(BREW_PREFIX ) /include
278+ LIBS += -L$(BREW_PREFIX ) /lib
279+
280+ LIBS +=
281+
277282 # macOS frameworks (use -framework instead of -l)
278283 LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
279- LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib
280-
281- CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include
282284endif
283285
284286# Final linker command ingredients
Original file line number Diff line number Diff line change @@ -268,17 +268,20 @@ ifeq ($(IS_WINDOWS),yes)
268268endif
269269
270270ifeq ($(IS_LINUX ) ,yes)
271- # OpenGL + X11 stack
272- LIBS += -lGL -ldl -lpthread
271+ LIBS += -lGL -lX11 -ldl -lpthread
273272 LIBS += -lXrandr -lXinerama -lXcursor -lXi
274273endif
275274
276275ifeq ($(IS_MACOS ) ,yes)
276+ BREW_PREFIX := $(shell brew --prefix 2>/dev/null || echo /usr/local)
277+
278+ CXXFLAGS += -I$(BREW_PREFIX ) /include
279+ LIBS += -L$(BREW_PREFIX ) /lib
280+
281+ LIBS +=
282+
277283 # macOS frameworks (use -framework instead of -l)
278284 LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
279- LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib
280-
281- CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include
282285endif
283286
284287# Final linker command ingredients
You can’t perform that action at this time.
0 commit comments