Commits

Anonymous committed 40261d2

Don't try to find OpenGL libraries on MacOSX and MinGW using pkg-config

MacOSX and MinGW don't provide gl.pc or glu.pc to find the cflags or libs using
pkg-config. Removing this search and replacing it with an hardcoded value is
easier on these platforms.

  • Participants
  • Parent commits e94891a

Comments (0)

Files changed (1)

projects/unix/Makefile

   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
       CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch x86_64
+      LDFLAGS += -bundle -arch x86_64
       LDLIBS += -ldl
     else
       CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch i686
+      LDFLAGS += -bundle -arch i686
       LDLIBS += -ldl
     endif
   endif
   LDLIBS += -lc
 endif
 
-# test for essential build dependencies
-ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
-  $(error $(PKG_CONFIG) not found)
+# search for OpenGL libraries
+GL_LIBS=
+ifeq ($(OS), OSX)
+  GL_LIBS = -framework OpenGL
 endif
-ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
-  $(error No OpenGL development libraries found!)
+ifeq ($(OS), MINGW)
+  GL_LIBS = -lopengl32
 endif
-CFLAGS += $(shell $(PKG_CONFIG) --cflags gl)
-LDLIBS += $(shell $(PKG_CONFIG) --libs gl)
+ifeq ("$(GL_LIBS)", "")
+  ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
+    $(error $(PKG_CONFIG) not found)
+  endif
+  ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
+    $(error No OpenGL development libraries found!)
+  endif
+  CFLAGS += $(shell $(PKG_CONFIG) --cflags gl)
+  GL_LIBS = $(shell $(PKG_CONFIG) --libs gl)
+endif
+LDLIBS += $(GL_LIBS)
 
 # test for presence of SDL
 ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)