fix: use correct path for win

This commit is contained in:
Nurul Huda (Apon) 2026-01-26 12:19:32 +06:00
parent 017be9dfda
commit 69faf52da7
No known key found for this signature in database
GPG key ID: 5D3F1DE2855A2F79
2 changed files with 16 additions and 8 deletions

View file

@ -52,12 +52,12 @@ const exe = b.addExecutable(.{
Prebuilt binaries are available for: Prebuilt binaries are available for:
- aarch64-macos - `aarch64-macos`
- x86_64-macos - `x86_64-macos`
- aarch64-linux-gnu - `aarch64-linux-gnu`
- x86_64-linux-gnu - `x86_64-linux-gnu`
- x86_64-windows-gnu - `x86_64-windows-gnu`
- aarch64-windows-gnu - `aarch64-windows-gnu`
For unsupported platforms, the library will automatically build from source if the Rust toolchain is installed. For unsupported platforms, the library will automatically build from source if the Rust toolchain is installed.

View file

@ -21,8 +21,16 @@ pub fn build(b: *std.Build) !void {
// Determine target triple string for pre-built library lookup // Determine target triple string for pre-built library lookup
const arch_str = @tagName(target.result.cpu.arch); const arch_str = @tagName(target.result.cpu.arch);
const os_str = @tagName(target.result.os.tag); const os_str = @tagName(target.result.os.tag);
const target_triple = b.fmt("{s}-{s}", .{ arch_str, os_str }); const abi = target.result.abi;
const lib_name = if (target.result.os.tag == .windows) "temporal_capi.lib" else "libtemporal_capi.a"; const abi_str = @tagName(abi);
const target_triple = if (abi == .none)
b.fmt("{s}-{s}", .{ arch_str, os_str })
else
b.fmt("{s}-{s}-{s}", .{ arch_str, os_str, abi_str });
const lib_name = if (target.result.os.tag == .windows and abi == .msvc)
"temporal_capi.lib"
else
"libtemporal_capi.a";
// Check if pre-built library exists in lib/<target>/ // Check if pre-built library exists in lib/<target>/
const prebuilt_lib_path = b.fmt("lib/{s}/{s}", .{ target_triple, lib_name }); const prebuilt_lib_path = b.fmt("lib/{s}/{s}", .{ target_triple, lib_name });