Zhiyi Zhang : winemac.drv: Fix build with older macOS SDKs.

Alexandre Julliard julliard at winehq.org
Tue Sep 3 16:34:07 CDT 2019


Module: wine
Branch: master
Commit: 0d23ecd9ec8a0c24e5444e0fc9cf6933cc39c960
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0d23ecd9ec8a0c24e5444e0fc9cf6933cc39c960

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Sep  2 12:04:21 2019 +0800

winemac.drv: Fix build with older macOS SDKs.

macOS SDKs older than 10.11 doesn't support Metal.
macOS 10.11 and 10.12 SDK support Metal but don't
support registryID in MTLDevice protocol. Recommend
using 10.13+ SDK.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure                        | 40 ++++++++++++++++++++++++++++++++++++++++
 configure.ac                     | 12 ++++++++++++
 dlls/winemac.drv/cocoa_display.m |  5 ++---
 include/config.h.in              |  3 +++
 4 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index a52e346..0c54e27 100755
--- a/configure
+++ b/configure
@@ -8954,6 +8954,46 @@ rm -f core conftest.err conftest.$ac_objext \
 
     fi
 
+        if test "$ac_cv_header_Metal_Metal_h" = "yes"
+    then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether MTLDevice protocol supports registryID property" >&5
+$as_echo_n "checking whether MTLDevice protocol supports registryID property... " >&6; }
+        ac_ext=m
+ac_cpp='$OBJCPP $CPPFLAGS'
+ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_objc_compiler_gnu
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <Metal/Metal.h>
+int
+main ()
+{
+id<MTLDevice> device; device.registryID;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_objc_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_MTLDEVICE_REGISTRYID 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    fi
+
         if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"
     then
         ac_save_LIBS="$LIBS"
diff --git a/configure.ac b/configure.ac
index 1592812..b39b6b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -859,6 +859,18 @@ case $host_os in
         AC_SUBST(METAL_LIBS,"-framework Metal -framework QuartzCore")
     fi
 
+    dnl Check for MTLDevice registryID property
+    if test "$ac_cv_header_Metal_Metal_h" = "yes"
+    then
+        AC_MSG_CHECKING([whether MTLDevice protocol supports registryID property])
+        AC_LANG_PUSH([Objective C])
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Metal/Metal.h>]], [[id<MTLDevice> device; device.registryID;]])],
+                              [AC_MSG_RESULT(yes)
+                               AC_DEFINE(HAVE_MTLDEVICE_REGISTRYID, 1, [Define if MTLDevice protocol has registryID property.])],
+                              [AC_MSG_RESULT(no)])
+        AC_LANG_POP([Objective C])
+    fi
+
     dnl Enable Mac driver on Mac OS X 10.6 or later
     if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"
     then
diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
index 3863557..9d95eee 100644
--- a/dlls/winemac.drv/cocoa_display.m
+++ b/dlls/winemac.drv/cocoa_display.m
@@ -21,7 +21,7 @@
 #include "config.h"
 
 #import <AppKit/AppKit.h>
-#ifdef HAVE_METAL_METAL_H
+#ifdef HAVE_MTLDEVICE_REGISTRYID
 #import <Metal/Metal.h>
 #endif
 #include "macdrv_cocoa.h"
@@ -234,7 +234,7 @@ done:
     return ret;
 }
 
-#ifdef HAVE_METAL_METAL_H
+#ifdef HAVE_MTLDEVICE_REGISTRYID
 
 /***********************************************************************
  *              macdrv_get_gpu_info_from_registry_id
@@ -337,7 +337,6 @@ done:
 
 static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
 {
-    TRACE("Metal support not compiled in\n");
     return -1;
 }
 
diff --git a/include/config.h.in b/include/config.h.in
index 924e11e..5f690df 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -584,6 +584,9 @@
 /* Define to 1 if you have the <mpg123.h> header file. */
 #undef HAVE_MPG123_H
 
+/* Define if MTLDevice protocol has registryID property. */
+#undef HAVE_MTLDEVICE_REGISTRYID
+
 /* Define to 1 if you have the <ncurses.h> header file. */
 #undef HAVE_NCURSES_H
 




More information about the wine-cvs mailing list