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 {
7575
7676 pub inline fn isDarwin(tag: Tag) bool {
7777 return switch (tag) {
78 .ios, .macos, .watchos, .tvos, .visionos => true,
78 .driverkit,
79 .ios,
80 .macos,
81 .tvos,
82 .visionos,
83 .watchos,
84 => true,
7985 else => false,
8086 };
8187 }
......@@ -116,7 +122,13 @@ pub const Os = struct {
116122 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
117123 return switch (tag) {
118124 .windows, .uefi => ".dll",
119 .ios, .macos, .watchos, .tvos, .visionos => ".dylib",
125 .driverkit,
126 .ios,
127 .macos,
128 .tvos,
129 .visionos,
130 .watchos,
131 => ".dylib",
120132 else => ".so",
121133 };
122134 }
......@@ -163,7 +175,6 @@ pub const Os = struct {
163175 .hermit,
164176 .hurd,
165177 .emscripten,
166 .driverkit,
167178 .shadermodel,
168179 .uefi,
169180 .opencl, // TODO: OpenCL versions
......@@ -175,6 +186,7 @@ pub const Os = struct {
175186 .other,
176187 => .none,
177188
189 .driverkit,
178190 .freebsd,
179191 .macos,
180192 .ios,
......@@ -392,7 +404,6 @@ pub const Os = struct {
392404 .hermit,
393405 .hurd,
394406 .emscripten,
395 .driverkit,
396407 .shadermodel,
397408 .uefi,
398409 .opencl, // TODO: OpenCL versions
......@@ -410,6 +421,12 @@ pub const Os = struct {
410421 .max = .{ .major = 14, .minor = 0, .patch = 0 },
411422 },
412423 },
424 .driverkit => .{
425 .semver = .{
426 .min = .{ .major = 19, .minor = 0, .patch = 0 },
427 .max = .{ .major = 24, .minor = 0, .patch = 0 },
428 },
429 },
413430 .macos => switch (arch) {
414431 .aarch64 => VersionRange{
415432 .semver = .{
......@@ -555,6 +572,7 @@ pub const Os = struct {
555572 return switch (os.tag) {
556573 .freebsd,
557574 .netbsd,
575 .driverkit,
558576 .macos,
559577 .ios,
560578 .tvos,
......@@ -589,7 +607,6 @@ pub const Os = struct {
589607 .hurd,
590608 .wasi,
591609 .emscripten,
592 .driverkit,
593610 .shadermodel,
594611 .uefi,
595612 .opencl,
......@@ -1802,6 +1819,7 @@ pub const DynamicLinker = struct {
18021819 => none,
18031820 },
18041821
1822 .driverkit,
18051823 .ios,
18061824 .tvos,
18071825 .watchos,
......@@ -1846,7 +1864,6 @@ pub const DynamicLinker = struct {
18461864 .amdpal,
18471865 .hermit,
18481866 .hurd,
1849 .driverkit,
18501867 .shadermodel,
18511868 => none,
18521869 };
......@@ -2261,7 +2278,13 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
22612278 },
22622279 },
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) {
22652288 .char => return 8,
22662289 .short, .ushort => return 16,
22672290 .int, .uint, .float => return 32,
......@@ -2334,7 +2357,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
23342357 .hermit,
23352358 .hurd,
23362359 .opengl,
2337 .driverkit,
23382360 .shadermodel,
23392361 => @panic("TODO specify the C integer and float type sizes for this OS"),
23402362 }