Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VisionOS compatibility by adding missing type definitions #11019

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
#include <vector>

#if defined(__APPLE__) && defined(__MACH__)
#include <TargetConditionals.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
// VisionOS lacks some legacy types definitions
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned short u_short;
#endif
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
#include <vector>

#ifdef __APPLE__
#include <TargetConditionals.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
// VisionOS lacks some legacy types definitions
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned short u_short;
#endif
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-cpu/ggml-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,6 +2382,13 @@ bool ggml_is_numa(void) {
#if defined(__linux__) && defined(__aarch64__)
#include <sys/auxv.h>
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
// VisionOS lacks some legacy types definitions
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned short u_short;
#endif
#include <sys/sysctl.h>
#endif

Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-cpu/ggml-cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#endif

#if defined(__APPLE__)
#include <TargetConditionals.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
// VisionOS lacks some legacy types definitions
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned short u_short;
#endif
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
Expand Down
6 changes: 6 additions & 0 deletions ggml/src/ggml-metal/ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

#import <Metal/Metal.h>

#include <TargetConditionals.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
// VisionOS lacks some legacy types definitions, stdint.h did not help either
typedef unsigned int uint;
#endif

#undef MIN
#undef MAX
#define MIN(a, b) ((a) < (b) ? (a) : (b))
Expand Down
Loading