Something went wrong. Try again.
zig library for building requests to query inference providers usage limits
Something went wrong. Try again.
1.5 kB · 44 lines
Swift
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445// swift-tools-version: 5.9import Foundationimport PackageDescription
// Wraps the Zig usage core for native hosts. Build the library first:// zig build (repo root, produces zig-out/lib/libusage.a)// then:// swift build --package-path swift//// The core does no I/O: it builds the requests and parses the responses, and UsageDriver feeds it// through URLSession. That is the whole point of the split — TLS, proxies and HTTP/2 stay with the// host, and the rules stay in one place shared with the CLI.//// The path to libusage.a is absolute because this package is also consumed as a dependency: a// relative path would be resolved against whoever is building, not against this directory.let packageRoot = URL(fileURLWithPath: #filePath) .deletingLastPathComponent() // the manifest .deletingLastPathComponent() // swift/ .pathlet staticLibrary = "\(packageRoot)/zig-out/lib/libusage.a"
let package = Package( name: "UsageCore", platforms: [.macOS(.v13)], products: [ .library(name: "UsageCore", targets: ["UsageCore"]), .executable(name: "usage-smoke", targets: ["UsageSmoke"]), ], targets: [ .systemLibrary(name: "CUsage", path: "Sources/CUsage"), .target( name: "UsageCore", dependencies: ["CUsage"], path: "Sources/UsageCore", linkerSettings: [.unsafeFlags([staticLibrary])] ), .executableTarget( name: "UsageSmoke", dependencies: ["UsageCore"], path: "Sources/UsageSmoke", linkerSettings: [.unsafeFlags([staticLibrary])] ), ])