Skip to content

Commit

Permalink
chore: try windows msvc witthout linker directives
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed May 30, 2024
1 parent 54acc16 commit b193f6c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/scripts/compile_all_targets_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Determine the script's directory and the project root directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"

cd $PROJECT_ROOT/bindings/node

mv $PROJECT_ROOT/.cargo/config.node.cross.toml $PROJECT_ROOT/.cargo/config.toml

npm install -g @napi-rs/cli

napi build --platform --release --target x86_64-unknown-linux-gnu
napi build --platform --release --target aarch64-unknown-linux-gnu
napi build --platform --release --target x86_64-pc-windows-msvc
napi build --platform --release --target x86_64-apple-darwin
napi build --platform --release --target aarch64-apple-darwin

mv $PROJECT_ROOT/.cargo/config.toml $PROJECT_ROOT/.cargo/config.node.cross.toml
14 changes: 14 additions & 0 deletions .github/scripts/install_all_targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# This assumes we are on mac, for the CI we will be running this in Mac
# linkers needed for cross compiling for linux and windows
brew install SergioBenitez/osxct/x86_64-unknown-linux-gnu
brew tap messense/homebrew-macos-cross-toolchains
brew install aarch64-unknown-linux-gnu
brew install mingw-w64

rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-pc-windows-msvc
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
4 changes: 3 additions & 1 deletion bindings/golang/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ package peerdas_kzg
#cgo darwin,arm64 LDFLAGS: ./build/aarch64-apple-darwin/libc_peerdas_kzg.a
#cgo linux,amd64 LDFLAGS: ./build/x86_64-unknown-linux-gnu/libc_peerdas_kzg.a
#cgo linux,arm64 LDFLAGS: ./build/aarch64-unknown-linux-gnu/libc_peerdas_kzg.a
#cgo windows LDFLAGS: ./build/x86_64-pc-windows-gnu/libc_peerdas_kzg.a -lws2_32 -lntdll -luserenv
#cgo windows LDFLAGS: ./build/x86_64-pc-windows-msvc/libc_peerdas_kzg.a
#include "./build/c_peerdas_kzg.h"
*/
import "C"
import "runtime"

// #cgo windows LDFLAGS: ./build/x86_64-pc-windows-gnu/libc_peerdas_kzg.a -lws2_32 -lntdll -luserenv

type ProverContext struct {
_inner *C.ProverContext
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/nim/nim_code/src/utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os
const
buildDir = "build"
universalAppleDarwin = buildDir / "universal-apple-darwin"
x86_64PcWindowsGnu = buildDir / "x86_64-pc-windows-gnu"
x86_64PcWindowsGnu = buildDir / "x86_64-pc-windows-msvc"
x86_64UnknownLinuxGnu = buildDir / "x86_64-unknown-linux-gnu"
aarch64UnknownLinuxGnu = buildDir / "aarch64-unknown-linux-gnu"

Expand Down
2 changes: 1 addition & 1 deletion scripts/compile_to_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ case "$OS" in
# Github runners will return MINGW64_NT-10.0-20348
# so we add a wildcard to match the prefix
MINGW64_NT-*|CYGWIN_NT-*|"Windows")
TARGET_NAME="x86_64-pc-windows-gnu"
TARGET_NAME="x86_64-pc-windows-msvc"
STATIC_LIB_NAME="lib${LIB_NAME}.a"
DYNAMIC_LIB_NAME="${LIB_NAME}.dll"
;;
Expand Down

0 comments on commit b193f6c

Please sign in to comment.