diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2024-03-13 02:17:28 -0400 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2024-03-13 02:17:28 -0400 |
| commit | 22fd1851bd56dae5b61e5f170671f3af5ef54330 (patch) | |
| tree | 631a1e010de32051879bab6898e5a4b7bede339b /lib/std/Target/Query.zig | |
| parent | 11bc3fb1906e10ed38fb913559a6c36d4c027e22 (diff) | |
| download | zig-22fd1851bd56dae5b61e5f170671f3af5ef54330.tar.gz zig-22fd1851bd56dae5b61e5f170671f3af5ef54330.zip | |
zig libc: allow non-native targets
On macos, allow targets supported by the SDK. This then spawns `xcrun`
and correct paths are emitted for:
- x86_64-macos
- x86_64-ios
- x86_64-tvos
- x86_64-watchos
- x86_64-ios-macbi
- aarch64-macos
- aarch64-ios
- aarch64-tvos
- aarch64-watchos
- aarch64-ios-macbi
On platforms with android NDK, allow android targets. Example usage:
```
CC=/NDK/.../bin/aarch64-linux-android34-clang zig libc -target aarch64-linux-android
```
Diffstat (limited to 'lib/std/Target/Query.zig')
| -rw-r--r-- | lib/std/Target/Query.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/Target/Query.zig b/lib/std/Target/Query.zig index e54ac0c3c6..d290e2a8d2 100644 --- a/lib/std/Target/Query.zig +++ b/lib/std/Target/Query.zig @@ -415,6 +415,15 @@ pub fn isNative(self: Query) bool { return self.isNativeCpu() and self.isNativeOs() and self.isNativeAbi(); } +pub fn canDetectLibC(self: Query) bool { + if (self.isNative()) return true; + if (self.os_tag) |os| { + if (builtin.os.tag == .macos and os.isDarwin()) return true; + if (os == .linux and self.abi == .android) return true; + } + return false; +} + /// Formats a version with the patch component omitted if it is zero, /// unlike SemanticVersion.format which formats all its version components regardless. fn formatVersion(version: SemanticVersion, writer: anytype) !void { |
