enum Tag [src]
Fields
freestanding
other
contiki
fuchsia
hermit
managarm
aix
haiku
hurd
linux
plan9
rtems
serenity
zos
dragonfly
freebsd
netbsd
openbsd
driverkit
ios
macos
tvos
visionos
watchos
illumos
solaris
windows
uefi
@"3ds"
ps3
ps4
ps5
vita
emscripten
wasi
amdhsa
amdpal
cuda
mesa3d
nvcl
opencl
opengl
vulkan
Members
- defaultVersionRange (Function)
- dynamicLibSuffix (Function)
- exeFileExt (Function)
- isBSD (Function)
- isDarwin (Function)
- isSolarish (Function)
- libPrefix (Function)
- staticLibSuffix (Function)
- versionRangeTag (Function)
Source
pub const Tag = enum {
freestanding,
other,
contiki,
fuchsia,
hermit,
managarm,
aix,
haiku,
hurd,
linux,
plan9,
rtems,
serenity,
zos,
dragonfly,
freebsd,
netbsd,
openbsd,
driverkit,
ios,
macos,
tvos,
visionos,
watchos,
illumos,
solaris,
windows,
uefi,
@"3ds",
ps3,
ps4,
ps5,
vita,
emscripten,
wasi,
amdhsa,
amdpal,
cuda,
mesa3d,
nvcl,
opencl,
opengl,
vulkan,
// LLVM tags deliberately omitted:
// - bridgeos
// - darwin
// - kfreebsd
// - nacl
// - shadermodel
pub inline fn isDarwin(tag: Tag) bool {
return switch (tag) {
.driverkit,
.ios,
.macos,
.tvos,
.visionos,
.watchos,
=> true,
else => false,
};
}
pub inline fn isBSD(tag: Tag) bool {
return tag.isDarwin() or switch (tag) {
.freebsd, .openbsd, .netbsd, .dragonfly => true,
else => false,
};
}
pub inline fn isSolarish(tag: Tag) bool {
return tag == .solaris or tag == .illumos;
}
pub fn exeFileExt(tag: Tag, arch: Cpu.Arch) [:0]const u8 {
return switch (tag) {
.windows => ".exe",
.uefi => ".efi",
.plan9 => arch.plan9Ext(),
else => switch (arch) {
.wasm32, .wasm64 => ".wasm",
else => "",
},
};
}
pub fn staticLibSuffix(tag: Tag, abi: Abi) [:0]const u8 {
return switch (abi) {
.msvc, .itanium => ".lib",
else => switch (tag) {
.windows, .uefi => ".lib",
else => ".a",
},
};
}
pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
return switch (tag) {
.windows, .uefi => ".dll",
.driverkit,
.ios,
.macos,
.tvos,
.visionos,
.watchos,
=> ".dylib",
else => ".so",
};
}
pub fn libPrefix(tag: Os.Tag, abi: Abi) [:0]const u8 {
return switch (abi) {
.msvc, .itanium => "",
else => switch (tag) {
.windows, .uefi => "",
else => "lib",
},
};
}
pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch, abi: Abi) Os {
return .{
.tag = tag,
.version_range = .default(arch, tag, abi),
};
}
pub inline fn versionRangeTag(tag: Tag) @typeInfo(TaggedVersionRange).@"union".tag_type.? {
return switch (tag) {
.freestanding,
.other,
.managarm,
.haiku,
.plan9,
.serenity,
.illumos,
.ps3,
.ps4,
.ps5,
.emscripten,
.mesa3d,
=> .none,
.contiki,
.fuchsia,
.hermit,
.aix,
.rtems,
.zos,
.dragonfly,
.freebsd,
.netbsd,
.openbsd,
.driverkit,
.macos,
.ios,
.tvos,
.visionos,
.watchos,
.solaris,
.uefi,
.@"3ds",
.vita,
.wasi,
.amdhsa,
.amdpal,
.cuda,
.nvcl,
.opencl,
.opengl,
.vulkan,
=> .semver,
.hurd => .hurd,
.linux => .linux,
.windows => .windows,
};
}
}