summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-10 15:44:44 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-14 13:23:57 +0100
commit018253cfc8a34805c4fc1e0f955e3696db60886a (patch)
treecdb7036bf139601e04c9657423eb16c1b45a4943
parentf0690e5d4c6c6b1ae66b8c0bb3425bb2fbba0b29 (diff)
downloadmupdf-018253cfc8a34805c4fc1e0f955e3696db60886a.tar.xz
gl: Add macOS support.
-rw-r--r--Makefile16
-rw-r--r--Makerules2
-rw-r--r--Makethird53
3 files changed, 52 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index f36c3778..838d5565 100644
--- a/Makefile
+++ b/Makefile
@@ -297,14 +297,6 @@ $(MUVIEW_X11_OBJ) : $(FITZ_HDR) $(PDF_HDR)
$(MUVIEW_X11) : $(MUVIEW_X11_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
$(LINK_CMD) $(X11_LIBS)
-ifeq "$(HAVE_GLFW)" "yes"
-MUVIEW_GLFW := $(OUT)/mupdf-gl
-MUVIEW_GLFW_OBJ := $(addprefix $(OUT)/platform/gl/, gl-font.o gl-input.o gl-main.o)
-$(MUVIEW_GLFW_OBJ) : $(FITZ_HDR) $(PDF_HDR) platform/gl/gl-app.h
-$(MUVIEW_GLFW) : $(MUVIEW_GLFW_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(GLFW_LIB)
- $(LINK_CMD) $(GLFW_LIBS)
-endif
-
ifeq "$(HAVE_CURL)" "yes"
MUVIEW_X11_CURL := $(OUT)/mupdf-x11-curl
MUVIEW_X11_CURL_OBJ := $(addprefix $(OUT)/platform/x11/curl/, x11_main.o x11_image.o pdfapp.o curl_stream.o)
@@ -314,6 +306,14 @@ $(MUVIEW_X11_CURL) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(CURL_LIB
endif
endif
+ifeq "$(HAVE_GLFW)" "yes"
+MUVIEW_GLFW := $(OUT)/mupdf-gl
+MUVIEW_GLFW_OBJ := $(addprefix $(OUT)/platform/gl/, gl-font.o gl-input.o gl-main.o)
+$(MUVIEW_GLFW_OBJ) : $(FITZ_HDR) $(PDF_HDR) platform/gl/gl-app.h
+$(MUVIEW_GLFW) : $(MUVIEW_GLFW_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(GLFW_LIB)
+ $(LINK_CMD) $(GLFW_LIBS)
+endif
+
ifeq "$(HAVE_WIN32)" "yes"
MUVIEW_WIN32 := $(OUT)/mupdf
MUVIEW_WIN32_OBJ := $(addprefix $(OUT)/platform/x11/, win_main.o pdfapp.o win_res.o)
diff --git a/Makerules b/Makerules
index 9e5df05b..a038ff8f 100644
--- a/Makerules
+++ b/Makerules
@@ -73,7 +73,7 @@ CFLAGS+= -U__STRICT_ANSI__
# Mac OS X doesn't have pkg-config so we hard code paths.
else ifeq "$(OS)" "MACOS"
-HAVE_X11 ?= yes
+HAVE_X11 ?= no
HAVE_PTHREADS ?= yes
# Mac OS X deprecated openssl, so the default is to not include it.
diff --git a/Makethird b/Makethird
index 3978ed8e..34595623 100644
--- a/Makethird
+++ b/Makethird
@@ -676,6 +676,37 @@ ifneq "$(wildcard $(GLFW_DIR)/README.md)" ""
GLFW_LIB := $(OUT)/libglfw.a
GLFW_OUT := $(OUT)/glfw
+
+ifeq "$(OS)" "MACOS"
+
+GLFW_SRC := \
+ cocoa_init.m \
+ cocoa_monitor.m \
+ cocoa_window.m \
+ context.c \
+ init.c \
+ input.c \
+ iokit_joystick.m \
+ mach_time.m \
+ monitor.c \
+ nsgl_context.m \
+ posix_tls.c \
+ window.c
+
+$(GLFW_OUT)/%.o: $(GLFW_DIR)/src/%.m | $(GLFW_OUT)
+ $(CC_CMD) -D_GLFW_COCOA -D_GLFW_NSGL -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -D_GLFW_USE_OPENGL -Wno-deprecated-declarations
+$(GLFW_OUT)/%.o: $(GLFW_DIR)/src/%.c | $(GLFW_OUT)
+ $(CC_CMD) -D_GLFW_COCOA -D_GLFW_NSGL -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -D_GLFW_USE_OPENGL
+
+GLFW_OBJ := $(addprefix $(GLFW_OUT)/, $(GLFW_SRC))
+GLFW_OBJ := $(GLFW_OBJ:%.c=%.o)
+GLFW_OBJ := $(GLFW_OBJ:%.m=%.o)
+
+$(GLFW_LIB): $(GLFW_OBJ)
+GLFW_LIBS := -framework OpenGL -framework IOKit -framework CoreVideo -framework Cocoa
+
+else
+
GLFW_SRC := \
context.c \
glx_context.c \
@@ -689,7 +720,18 @@ GLFW_SRC := \
x11_init.c \
x11_monitor.c \
x11_window.c \
- xkb_unicode.c \
+ xkb_unicode.c
+
+$(GLFW_OUT)/%.o: $(GLFW_DIR)/src/%.c | $(GLFW_OUT)
+ $(CC_CMD) -D_GLFW_X11 -D_GLFW_GLX -D_GLFW_USE_OPENGL -D_GLFW_HAS_GLXGETPROCADDRESS
+$(GLFW_LIB): $(addprefix $(GLFW_OUT)/, $(GLFW_SRC:%.c=%.o))
+GLFW_LIBS := -lGL -lX11 -lXcursor -lXrandr -lXinerama -lpthread
+
+endif
+
+GLFW_CFLAGS := -I$(GLFW_DIR)/include
+$(GLFW_OUT):
+ $(MKDIR_CMD)
GLFW_SRC_UNUSED := \
egl_context.c \
@@ -708,15 +750,6 @@ GLFW_SRC_UNUSED := \
wl_monitor.c \
wl_window.c \
-$(GLFW_LIB): $(addprefix $(GLFW_OUT)/, $(GLFW_SRC:%.c=%.o))
-$(GLFW_OUT):
- $(MKDIR_CMD)
-$(GLFW_OUT)/%.o: $(GLFW_DIR)/src/%.c | $(GLFW_OUT)
- $(CC_CMD) -D_GLFW_X11 -D_GLFW_GLX -D_GLFW_USE_OPENGL -D_GLFW_HAS_GLXGETPROCADDRESS
-
-GLFW_CFLAGS := -I$(GLFW_DIR)/include
-GLFW_LIBS := -lGL -lX11 -lXcursor -lXrandr -lXinerama -lpthread
-
HAVE_GLFW := yes
else ifeq "$(HAVE_GLFW)" "yes"