From e6ed99980115fbe27813f0b31a1e347f44f89826 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 27 Apr 2023 12:20:10 +0300 Subject: [PATCH] Support for Windows cross-compilation from Linux Since `DirSep` matches the default separator of the target OS, it's not suitable for performing path operations during compile-time on the host OS. The particular fix here solves the issue for cross-compiling a Windows build from a Linux host, but Nim seems to need a more general solution for detecting the host OS during compilation, so a host OS specific separator can be used in paths derived from `currentSourcePath`. --- bindings/nim/kzg_abi.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/nim/kzg_abi.nim b/bindings/nim/kzg_abi.nim index 52e25588..d804e999 100644 --- a/bindings/nim/kzg_abi.nim +++ b/bindings/nim/kzg_abi.nim @@ -12,7 +12,7 @@ const # compiler switch -d: or --define: FIELD_ELEMENTS_PER_BLOB* {.intdefine.} = 4096 # kzgPath: c-kzg-4844 project path, removing 3 last elem - kzgPath = currentSourcePath.rsplit(DirSep, 3)[0] & "/" + kzgPath = currentSourcePath.rsplit({DirSep, AltSep}, 3)[0] & "/" blstPath = kzgPath & "blst/" srcPath = kzgPath & "src/" bindingsPath = blstPath & "bindings" @@ -65,14 +65,14 @@ type # An array of 48 bytes. Represents an untrusted # (potentially invalid) commitment/proof. KzgBytes48* = array[48, byte] - + # An array of 32 bytes. Represents an untrusted # (potentially invalid) field element. KzgBytes32* = array[32, byte] # A trusted (valid) KZG commitment. KzgCommitment* = KzgBytes48 - + # A trusted (valid) KZG proof. KzgProof* = KzgBytes48