From 84c52ff59f18a6243f48f1ea62ba502a040c9c04 Mon Sep 17 00:00:00 2001 From: stringintech Date: Tue, 11 Nov 2025 01:57:56 +0330 Subject: [PATCH 1/2] Add windows support --- Makefile | 3 ++- kernel/cgo_unix.go | 9 +++++++++ kernel/cgo_windows.go | 9 +++++++++ kernel/kernel.go | 6 ------ 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 kernel/cgo_unix.go create mode 100644 kernel/cgo_windows.go diff --git a/Makefile b/Makefile index 7c0df1f..05a77df 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ all: build-kernel test build-kernel: cd depend/bitcoin && \ cmake -B build \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_KERNEL_LIB=ON \ -DBUILD_KERNEL_TEST=OFF \ @@ -21,7 +22,7 @@ build-kernel: -DBUILD_UTIL_CHAINSTATE=OFF \ -DBUILD_CLI=OFF \ -DENABLE_IPC=OFF && \ - cmake --build build --target bitcoinkernel -j $(shell nproc 2>/dev/null || echo 4) + cmake --build build --config RelWithDebInfo --parallel$(if $(NUM_JOBS),=$(NUM_JOBS)) # Use NUM_JOBS variable if set (e.g., make build-kernel NUM_JOBS=8), otherwise auto-detect CPU cores build: go build ./... diff --git a/kernel/cgo_unix.go b/kernel/cgo_unix.go new file mode 100644 index 0000000..54a1399 --- /dev/null +++ b/kernel/cgo_unix.go @@ -0,0 +1,9 @@ +//go:build unix + +package kernel + +/* +#cgo CFLAGS: -I../depend/bitcoin/src +#cgo LDFLAGS: -L../depend/bitcoin/build/lib -lbitcoinkernel -Wl,-rpath,${SRCDIR}/../depend/bitcoin/build/lib +*/ +import "C" diff --git a/kernel/cgo_windows.go b/kernel/cgo_windows.go new file mode 100644 index 0000000..83556c6 --- /dev/null +++ b/kernel/cgo_windows.go @@ -0,0 +1,9 @@ +//go:build windows + +package kernel + +/* +#cgo CFLAGS: -I../depend/bitcoin/src +#cgo LDFLAGS: -L../depend/bitcoin/build/bin/RelWithDebInfo -lbitcoinkernel -lbcrypt -lshell32 +*/ +import "C" diff --git a/kernel/kernel.go b/kernel/kernel.go index dbc7102..36bf53a 100644 --- a/kernel/kernel.go +++ b/kernel/kernel.go @@ -16,9 +16,3 @@ // resource cleanup and is not recommended for long-running programs or when working // with many objects. package kernel - -/* -#cgo CFLAGS: -I../depend/bitcoin/src -#cgo LDFLAGS: -L../depend/bitcoin/build/lib -lbitcoinkernel -Wl,-rpath,${SRCDIR}/../depend/bitcoin/build/lib -*/ -import "C" From cde8df335bb6cb37b05abb9e2da22cd5fc8c9147 Mon Sep 17 00:00:00 2001 From: stringintech Date: Tue, 11 Nov 2025 12:58:08 +0330 Subject: [PATCH 2/2] Add windows CI job --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7840946..626699d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,43 @@ jobs: - name: Run tests run: make test + windows: + name: Build and Test on Windows + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23.3' + + - name: Install Boost library + run: | + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg install boost-multi-index:x64-windows boost-headers:x64-windows + + - name: Set environment variables + run: | + echo "BOOST_ROOT=$env:GITHUB_WORKSPACE\vcpkg\installed\x64-windows" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "BOOST_INCLUDEDIR=$env:GITHUB_WORKSPACE\vcpkg\installed\x64-windows\include" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "$env:GITHUB_WORKSPACE\depend\bitcoin\build\bin\RelWithDebInfo" | Out-File -FilePath $env:GITHUB_PATH -Append + + - name: Install make + run: choco install make + + - name: Build Kernel + run: make build-kernel + + - name: Build + run: make build + + - name: Run tests + run: make test + lint: name: Lint runs-on: ubuntu-latest