authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-08 22:26:02+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-15 10:55:45+02:00
log0def4e0db0a7000739a0bd409c51de377ce7b693
tree1545d5285cb5ef2a4d0be90a941e98f5a67abe5c
parent5d080e25d5b9b69fda4fd9d340cc9571fc0d0939
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Make some functions handle driverkit alongside other Apple OSs.

Reference for versions: https://developer.apple.com/support/xcode

1 files changed, 30 insertions(+), 8 deletions(-)

lib/std/Target.zig+30-8
...@@ -75,7 +75,13 @@ pub const Os = struct {...@@ -75,7 +75,13 @@ pub const Os = struct {
7575
76 pub inline fn isDarwin(tag: Tag) bool {76 pub inline fn isDarwin(tag: Tag) bool {
77 return switch (tag) {77 return switch (tag) {
78 .ios, .macos, .watchos, .tvos, .visionos => true,78 .driverkit,
79 .ios,
80 .macos,
81 .tvos,
82 .visionos,
83 .watchos,
84 => true,
79 else => false,85 else => false,
80 };86 };
81 }87 }
...@@ -116,7 +122,13 @@ pub const Os = struct {...@@ -116,7 +122,13 @@ pub const Os = struct {
116 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {122 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
117 return switch (tag) {123 return switch (tag) {
118 .windows, .uefi => ".dll",124 .windows, .uefi => ".dll",
119 .ios, .macos, .watchos, .tvos, .visionos => ".dylib",125 .driverkit,
126 .ios,
127 .macos,
128 .tvos,
129 .visionos,
130 .watchos,
131 => ".dylib",
120 else => ".so",132 else => ".so",
121 };133 };
122 }134 }
...@@ -163,7 +175,6 @@ pub const Os = struct {...@@ -163,7 +175,6 @@ pub const Os = struct {
163 .hermit,175 .hermit,
164 .hurd,176 .hurd,
165 .emscripten,177 .emscripten,
166 .driverkit,
167 .shadermodel,178 .shadermodel,
168 .uefi,179 .uefi,
169 .opencl, // TODO: OpenCL versions180 .opencl, // TODO: OpenCL versions
...@@ -175,6 +186,7 @@ pub const Os = struct {...@@ -175,6 +186,7 @@ pub const Os = struct {
175 .other,186 .other,
176 => .none,187 => .none,
177188
189 .driverkit,
178 .freebsd,190 .freebsd,
179 .macos,191 .macos,
180 .ios,192 .ios,
...@@ -392,7 +404,6 @@ pub const Os = struct {...@@ -392,7 +404,6 @@ pub const Os = struct {
392 .hermit,404 .hermit,
393 .hurd,405 .hurd,
394 .emscripten,406 .emscripten,
395 .driverkit,
396 .shadermodel,407 .shadermodel,
397 .uefi,408 .uefi,
398 .opencl, // TODO: OpenCL versions409 .opencl, // TODO: OpenCL versions
...@@ -410,6 +421,12 @@ pub const Os = struct {...@@ -410,6 +421,12 @@ pub const Os = struct {
410 .max = .{ .major = 14, .minor = 0, .patch = 0 },421 .max = .{ .major = 14, .minor = 0, .patch = 0 },
411 },422 },
412 },423 },
424 .driverkit => .{
425 .semver = .{
426 .min = .{ .major = 19, .minor = 0, .patch = 0 },
427 .max = .{ .major = 24, .minor = 0, .patch = 0 },
428 },
429 },
413 .macos => switch (arch) {430 .macos => switch (arch) {
414 .aarch64 => VersionRange{431 .aarch64 => VersionRange{
415 .semver = .{432 .semver = .{
...@@ -555,6 +572,7 @@ pub const Os = struct {...@@ -555,6 +572,7 @@ pub const Os = struct {
555 return switch (os.tag) {572 return switch (os.tag) {
556 .freebsd,573 .freebsd,
557 .netbsd,574 .netbsd,
575 .driverkit,
558 .macos,576 .macos,
559 .ios,577 .ios,
560 .tvos,578 .tvos,
...@@ -589,7 +607,6 @@ pub const Os = struct {...@@ -589,7 +607,6 @@ pub const Os = struct {
589 .hurd,607 .hurd,
590 .wasi,608 .wasi,
591 .emscripten,609 .emscripten,
592 .driverkit,
593 .shadermodel,610 .shadermodel,
594 .uefi,611 .uefi,
595 .opencl,612 .opencl,
...@@ -1802,6 +1819,7 @@ pub const DynamicLinker = struct {...@@ -1802,6 +1819,7 @@ pub const DynamicLinker = struct {
1802 => none,1819 => none,
1803 },1820 },
18041821
1822 .driverkit,
1805 .ios,1823 .ios,
1806 .tvos,1824 .tvos,
1807 .watchos,1825 .watchos,
...@@ -1846,7 +1864,6 @@ pub const DynamicLinker = struct {...@@ -1846,7 +1864,6 @@ pub const DynamicLinker = struct {
1846 .amdpal,1864 .amdpal,
1847 .hermit,1865 .hermit,
1848 .hurd,1866 .hurd,
1849 .driverkit,
1850 .shadermodel,1867 .shadermodel,
1851 => none,1868 => none,
1852 };1869 };
...@@ -2261,7 +2278,13 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -2261,7 +2278,13 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2261 },2278 },
2262 },2279 },
22632280
2264 .macos, .ios, .tvos, .watchos, .visionos => switch (c_type) {2281 .driverkit,
2282 .ios,
2283 .macos,
2284 .tvos,
2285 .visionos,
2286 .watchos,
2287 => switch (c_type) {
2265 .char => return 8,2288 .char => return 8,
2266 .short, .ushort => return 16,2289 .short, .ushort => return 16,
2267 .int, .uint, .float => return 32,2290 .int, .uint, .float => return 32,
...@@ -2334,7 +2357,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -2334,7 +2357,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2334 .hermit,2357 .hermit,
2335 .hurd,2358 .hurd,
2336 .opengl,2359 .opengl,
2337 .driverkit,
2338 .shadermodel,2360 .shadermodel,
2339 => @panic("TODO specify the C integer and float type sizes for this OS"),2361 => @panic("TODO specify the C integer and float type sizes for this OS"),
2340 }2362 }