Skip to content

Commit

Permalink
Support for Windows cross-compilation from Linux
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
zah committed Apr 27, 2023
1 parent f014ea4 commit e6ed999
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bindings/nim/kzg_abi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e6ed999

Please sign in to comment.