From b193f6c4e7ef7d9098d1c12c70fa0164c67c32a8 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 30 May 2024 22:16:43 +0100 Subject: [PATCH] chore: try windows msvc witthout linker directives --- .github/scripts/compile_all_targets_node.sh | 19 +++++++++++++++++++ .github/scripts/install_all_targets.sh | 14 ++++++++++++++ bindings/golang/prover.go | 4 +++- bindings/nim/nim_code/src/utils.nim | 2 +- scripts/compile_to_native.sh | 2 +- 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/compile_all_targets_node.sh create mode 100644 .github/scripts/install_all_targets.sh diff --git a/.github/scripts/compile_all_targets_node.sh b/.github/scripts/compile_all_targets_node.sh new file mode 100644 index 00000000..460f6771 --- /dev/null +++ b/.github/scripts/compile_all_targets_node.sh @@ -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 \ No newline at end of file diff --git a/.github/scripts/install_all_targets.sh b/.github/scripts/install_all_targets.sh new file mode 100644 index 00000000..435facb6 --- /dev/null +++ b/.github/scripts/install_all_targets.sh @@ -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 \ No newline at end of file diff --git a/bindings/golang/prover.go b/bindings/golang/prover.go index db2d86e4..78946096 100644 --- a/bindings/golang/prover.go +++ b/bindings/golang/prover.go @@ -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 } diff --git a/bindings/nim/nim_code/src/utils.nim b/bindings/nim/nim_code/src/utils.nim index 6d7edd47..afc303c4 100644 --- a/bindings/nim/nim_code/src/utils.nim +++ b/bindings/nim/nim_code/src/utils.nim @@ -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" diff --git a/scripts/compile_to_native.sh b/scripts/compile_to_native.sh index 9dd82462..d592e3f4 100755 --- a/scripts/compile_to_native.sh +++ b/scripts/compile_to_native.sh @@ -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" ;;