Skip to content

Commit 4009466

Browse files
authored
macOS: Check for macOS 10.10 using kCFCoreFoundationVersionNumber instead of AppKit (#611)
Effectivelty removes the dependency on AppKit for HIDAPI. Fixes: #587
1 parent 8a4de63 commit 4009466

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ case $host in
7474
backend="mac"
7575
os="darwin"
7676
threads="pthreads"
77-
LIBS="${LIBS} -framework IOKit -framework CoreFoundation -framework AppKit"
77+
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
7878
;;
7979
*-freebsd*)
8080
AC_MSG_RESULT([ (FreeBSD back-end)])

dist/hidapi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ Pod::Spec.new do |spec|
2626

2727
spec.public_header_files = "hidapi/hidapi.h", "mac/hidapi_darwin.h"
2828

29-
spec.frameworks = "IOKit", "CoreFoundation", "AppKit"
29+
spec.frameworks = "IOKit", "CoreFoundation"
3030

3131
end

mac/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find_package(Threads REQUIRED)
1212
target_link_libraries(hidapi_darwin
1313
PUBLIC hidapi_include
1414
PRIVATE Threads::Threads
15-
PRIVATE "-framework IOKit" "-framework CoreFoundation" "-framework AppKit"
15+
PRIVATE "-framework IOKit" "-framework CoreFoundation"
1616
)
1717

1818
set_target_properties(hidapi_darwin

mac/Makefile-manual

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CC=gcc
1212
COBJS=hid.o ../hidtest/test.o
1313
OBJS=$(COBJS)
1414
CFLAGS+=-I../hidapi -I. -Wall -g -c
15-
LIBS=-framework IOKit -framework CoreFoundation -framework AppKit
15+
LIBS=-framework IOKit -framework CoreFoundation
1616

1717

1818
hidtest: $(OBJS)

mac/hid.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838

3939
#include "hidapi_darwin.h"
4040

41-
/* As defined in AppKit.h, but we don't need the entire AppKit for a single constant. */
42-
extern const double NSAppKitVersionNumber;
43-
4441
/* Barrier implementation because Mac OSX doesn't have pthread_barrier.
4542
It also doesn't have clock_gettime(). So much for POSIX and SUSv2.
4643
This implementation came from Brent Priddy and was posted on
@@ -466,7 +463,7 @@ int HID_API_EXPORT hid_init(void)
466463
register_global_error(NULL);
467464

468465
if (!hid_mgr) {
469-
is_macos_10_10_or_greater = (NSAppKitVersionNumber >= 1343); /* NSAppKitVersionNumber10_10 */
466+
is_macos_10_10_or_greater = (kCFCoreFoundationVersionNumber >= 1151.16); /* kCFCoreFoundationVersionNumber10_10 */
470467
hid_darwin_set_open_exclusive(1); /* Backward compatibility */
471468
return init_hid_manager();
472469
}

0 commit comments

Comments
 (0)