Skip to content

Commit 47a346c

Browse files
authored
Merge pull request #5 from stringintech/win
Add windows support with CI job
2 parents 4e19882 + cde8df3 commit 47a346c

File tree

5 files changed

+57
-7
lines changed

5 files changed

+57
-7
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,43 @@ jobs:
5656
- name: Run tests
5757
run: make test
5858

59+
windows:
60+
name: Build and Test on Windows
61+
runs-on: windows-latest
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Set up Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version: '1.23.3'
70+
71+
- name: Install Boost library
72+
run: |
73+
git clone https://github.com/microsoft/vcpkg.git
74+
cd vcpkg
75+
.\bootstrap-vcpkg.bat
76+
.\vcpkg install boost-multi-index:x64-windows boost-headers:x64-windows
77+
78+
- name: Set environment variables
79+
run: |
80+
echo "BOOST_ROOT=$env:GITHUB_WORKSPACE\vcpkg\installed\x64-windows" | Out-File -FilePath $env:GITHUB_ENV -Append
81+
echo "BOOST_INCLUDEDIR=$env:GITHUB_WORKSPACE\vcpkg\installed\x64-windows\include" | Out-File -FilePath $env:GITHUB_ENV -Append
82+
echo "$env:GITHUB_WORKSPACE\depend\bitcoin\build\bin\RelWithDebInfo" | Out-File -FilePath $env:GITHUB_PATH -Append
83+
84+
- name: Install make
85+
run: choco install make
86+
87+
- name: Build Kernel
88+
run: make build-kernel
89+
90+
- name: Build
91+
run: make build
92+
93+
- name: Run tests
94+
run: make test
95+
5996
lint:
6097
name: Lint
6198
runs-on: ubuntu-latest

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ all: build-kernel test
77
build-kernel:
88
cd depend/bitcoin && \
99
cmake -B build \
10+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
1011
-DBUILD_SHARED_LIBS=ON \
1112
-DBUILD_KERNEL_LIB=ON \
1213
-DBUILD_KERNEL_TEST=OFF \
@@ -21,7 +22,7 @@ build-kernel:
2122
-DBUILD_UTIL_CHAINSTATE=OFF \
2223
-DBUILD_CLI=OFF \
2324
-DENABLE_IPC=OFF && \
24-
cmake --build build --target bitcoinkernel -j $(shell nproc 2>/dev/null || echo 4)
25+
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
2526

2627
build:
2728
go build ./...

kernel/cgo_unix.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build unix
2+
3+
package kernel
4+
5+
/*
6+
#cgo CFLAGS: -I../depend/bitcoin/src
7+
#cgo LDFLAGS: -L../depend/bitcoin/build/lib -lbitcoinkernel -Wl,-rpath,${SRCDIR}/../depend/bitcoin/build/lib
8+
*/
9+
import "C"

kernel/cgo_windows.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build windows
2+
3+
package kernel
4+
5+
/*
6+
#cgo CFLAGS: -I../depend/bitcoin/src
7+
#cgo LDFLAGS: -L../depend/bitcoin/build/bin/RelWithDebInfo -lbitcoinkernel -lbcrypt -lshell32
8+
*/
9+
import "C"

kernel/kernel.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@
1616
// resource cleanup and is not recommended for long-running programs or when working
1717
// with many objects.
1818
package kernel
19-
20-
/*
21-
#cgo CFLAGS: -I../depend/bitcoin/src
22-
#cgo LDFLAGS: -L../depend/bitcoin/build/lib -lbitcoinkernel -Wl,-rpath,${SRCDIR}/../depend/bitcoin/build/lib
23-
*/
24-
import "C"

0 commit comments

Comments
 (0)