From 923d612ca1961aeffd73c9e048b00115270952e9 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 27 Aug 2023 22:33:32 +0300 Subject: [PATCH] hidapi: sync macOS code with mainstream. this merges mainstream commit 4009466d59c41f (mainstream PR/611) --- src/hidapi/configure.ac | 2 +- src/hidapi/dist/hidapi.podspec | 2 +- src/hidapi/mac/CMakeLists.txt | 2 +- src/hidapi/mac/Makefile-manual | 2 +- src/hidapi/mac/hid.c | 5 +---- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hidapi/configure.ac b/src/hidapi/configure.ac index cc7ceaca00..1b20510521 100644 --- a/src/hidapi/configure.ac +++ b/src/hidapi/configure.ac @@ -74,7 +74,7 @@ case $host in backend="mac" os="darwin" threads="pthreads" - LIBS="${LIBS} -framework IOKit -framework CoreFoundation -framework AppKit" + LIBS="${LIBS} -framework IOKit -framework CoreFoundation" ;; *-freebsd*) AC_MSG_RESULT([ (FreeBSD back-end)]) diff --git a/src/hidapi/dist/hidapi.podspec b/src/hidapi/dist/hidapi.podspec index 74642ef632..8588514ad1 100644 --- a/src/hidapi/dist/hidapi.podspec +++ b/src/hidapi/dist/hidapi.podspec @@ -26,6 +26,6 @@ Pod::Spec.new do |spec| spec.public_header_files = "hidapi/hidapi.h", "mac/hidapi_darwin.h" - spec.frameworks = "IOKit", "CoreFoundation", "AppKit" + spec.frameworks = "IOKit", "CoreFoundation" end diff --git a/src/hidapi/mac/CMakeLists.txt b/src/hidapi/mac/CMakeLists.txt index a83664aaea..ccb0b91d43 100644 --- a/src/hidapi/mac/CMakeLists.txt +++ b/src/hidapi/mac/CMakeLists.txt @@ -12,7 +12,7 @@ find_package(Threads REQUIRED) target_link_libraries(hidapi_darwin PUBLIC hidapi_include PRIVATE Threads::Threads - PRIVATE "-framework IOKit" "-framework CoreFoundation" "-framework AppKit" + PRIVATE "-framework IOKit" "-framework CoreFoundation" ) set_target_properties(hidapi_darwin diff --git a/src/hidapi/mac/Makefile-manual b/src/hidapi/mac/Makefile-manual index 27084922e0..667c863c5b 100644 --- a/src/hidapi/mac/Makefile-manual +++ b/src/hidapi/mac/Makefile-manual @@ -12,7 +12,7 @@ CC=gcc COBJS=hid.o ../hidtest/test.o OBJS=$(COBJS) CFLAGS+=-I../hidapi -I. -Wall -g -c -LIBS=-framework IOKit -framework CoreFoundation -framework AppKit +LIBS=-framework IOKit -framework CoreFoundation hidtest: $(OBJS) diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index 20731186c3..20c664501d 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -38,9 +38,6 @@ #include "hidapi_darwin.h" -/* As defined in AppKit.h, but we don't need the entire AppKit for a single constant. */ -extern const double NSAppKitVersionNumber; - /* Barrier implementation because Mac OSX doesn't have pthread_barrier. It also doesn't have clock_gettime(). So much for POSIX and SUSv2. This implementation came from Brent Priddy and was posted on @@ -477,7 +474,7 @@ int HID_API_EXPORT hid_init(void) register_global_error(NULL); if (!hid_mgr) { - is_macos_10_10_or_greater = (NSAppKitVersionNumber >= 1343); /* NSAppKitVersionNumber10_10 */ + is_macos_10_10_or_greater = (kCFCoreFoundationVersionNumber >= 1151.16); /* kCFCoreFoundationVersionNumber10_10 */ hid_darwin_set_open_exclusive(1); /* Backward compatibility */ return init_hid_manager(); }