Skip to content

Commit 1d93dc7

Browse files
add ci build (#110)
* Fix boost dependencies build * Bump minimum required boost version to v1.62 * Improve build script
1 parent e64e666 commit 1d93dc7

3 files changed

Lines changed: 252 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches:
8+
- master
9+
workflow_dispatch:
10+
11+
jobs:
12+
ubuntu:
13+
runs-on: ubuntu-24.04
14+
name: ubuntu-24.04
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v5
19+
with:
20+
submodules: recursive
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt update
25+
sudo apt install -y build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz git curl autoconf libtool gperf nettle-dev libevent-dev
26+
27+
- name: Install expat
28+
run: |
29+
wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2
30+
tar -xf expat-2.4.8.tar.bz2
31+
sudo rm expat-2.4.8.tar.bz2
32+
cd expat-2.4.8
33+
./configure --enable-static --disable-shared
34+
make
35+
sudo make install
36+
cd ../
37+
38+
- name: Install unbound
39+
run: |
40+
wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.22.0.tar.gz
41+
tar xzf unbound-1.22.0.tar.gz
42+
sudo apt install -y build-essential
43+
sudo apt install -y libssl-dev
44+
sudo apt install -y libexpat1-dev
45+
sudo apt-get install -y bison
46+
sudo apt-get install -y flex
47+
cd unbound-1.22.0
48+
./configure --with-libexpat=/usr --with-ssl=/usr --enable-static-exe
49+
make
50+
sudo make install
51+
cd ../
52+
53+
- name: Build monero-project
54+
run: |
55+
cd external/monero-project
56+
mkdir -p build/release
57+
cd build/release
58+
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
59+
make -j3 wallet cryptonote_protocol
60+
cd ../../../../
61+
62+
- name: Build monero-cpp
63+
run: |
64+
mkdir -p build
65+
cd build
66+
cmake ..
67+
cmake --build .
68+
make -j3
69+
cd ..
70+
71+
- name: Upload artifacts
72+
uses: actions/upload-artifact@v7
73+
with:
74+
name: libmonero-cpp-linux-amd64
75+
path: build/libmonero-cpp.so
76+
77+
windows:
78+
name: windows
79+
runs-on: windows-latest
80+
81+
defaults:
82+
run:
83+
shell: msys2 {0}
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v5
88+
with:
89+
submodules: recursive
90+
91+
- name: Setup MSYS2 MINGW64
92+
uses: msys2/setup-msys2@v2
93+
with:
94+
msystem: MINGW64
95+
update: true
96+
install: >-
97+
mingw-w64-x86_64-toolchain
98+
mingw-w64-x86_64-cmake
99+
mingw-w64-x86_64-openssl
100+
mingw-w64-x86_64-zeromq
101+
mingw-w64-x86_64-libsodium
102+
mingw-w64-x86_64-hidapi
103+
mingw-w64-x86_64-unbound
104+
mingw-w64-x86_64-protobuf
105+
mingw-w64-x86_64-libusb
106+
mingw-w64-x86_64-ntldd
107+
git
108+
make
109+
gettext
110+
base-devel
111+
wget
112+
113+
- name: Install ICU v75.1
114+
shell: msys2 {0}
115+
run: |
116+
wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst
117+
pacman -U --noconfirm mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst
118+
119+
- name: Install boost v1.87.0
120+
shell: msys2 {0}
121+
run: |
122+
wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst
123+
pacman -U --noconfirm mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst
124+
125+
- name: Build monero-project
126+
shell: msys2 {0}
127+
run: |
128+
cd external/monero-project
129+
mkdir -p build/release
130+
cd build/release
131+
cmake -G "MSYS Makefiles" \
132+
-D STATIC=ON \
133+
-D ARCH="x86-64" \
134+
-D BUILD_64=ON \
135+
-D CMAKE_BUILD_TYPE=Release \
136+
-D BUILD_TAG="win-x64" \
137+
-D CMAKE_TOOLCHAIN_FILE="../../cmake/64-bit-toolchain.cmake" \
138+
-D MSYS2_FOLDER=$(cd $MINGW_PREFIX/.. && pwd -W) \
139+
-D USE_DEVICE_TREZOR=OFF \
140+
../../
141+
make wallet cryptonote_protocol
142+
143+
- name: Build monero-cpp
144+
shell: msys2 {0}
145+
run: |
146+
mkdir -p build
147+
cd build
148+
cmake ..
149+
cmake --build .
150+
cd ..
151+
152+
- name: Upload artifacts
153+
uses: actions/upload-artifact@v7
154+
with:
155+
name: libmonero-cpp-win-x64
156+
path: |
157+
build/libmonero-cpp.dll
158+
build/libmonero-cpp.dll.a
159+
160+
mac-os:
161+
name: ${{ matrix.os }}
162+
runs-on: ${{ matrix.os }}
163+
164+
strategy:
165+
fail-fast: false
166+
matrix:
167+
os: [macos-14, macos-15, macos-15-intel]
168+
169+
steps:
170+
- name: Checkout repository
171+
uses: actions/checkout@v5
172+
with:
173+
submodules: recursive
174+
175+
- name: Install dependencies
176+
run: |
177+
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost@1.85 hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf unbound
178+
brew unlink boost || true
179+
brew link boost@1.85 --force
180+
181+
- name: Build monero-project
182+
run: |
183+
cd external/monero-project
184+
mkdir -p build/release
185+
cd build/release
186+
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
187+
make -j3 wallet cryptonote_protocol
188+
cd ../../../../
189+
190+
- name: Build monero-cpp
191+
run: |
192+
mkdir -p build
193+
cd build
194+
cmake ..
195+
cmake --build .
196+
make -j3
197+
cd ..
198+
199+
- name: Upload artifacts
200+
uses: actions/upload-artifact@v7
201+
with:
202+
name: libmonero-cpp-${{ matrix.os }}
203+
path: build/libmonero-cpp.dylib

CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,24 @@ set(LibUSB_LIBRARIES ${usb_LIBRARY})
7777

7878
set(Boost_NO_BOOST_CMAKE 1)
7979
set(Boost_USE_MULTITHREADED ON)
80-
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS chrono date_time filesystem program_options regex serialization wserialization system thread)
80+
set(BOOST_COMPONENTS chrono date_time filesystem program_options serialization wserialization thread)
81+
82+
# Find Boost headers
83+
set(BOOST_MIN_VER 1.62)
84+
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
85+
86+
# Boost System is header-only since 1.69
87+
if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
88+
list(APPEND BOOST_COMPONENTS system)
89+
endif()
90+
91+
# Boost Regex is header-only since 1.77
92+
if (Boost_VERSION_STRING VERSION_LESS 1.77.0)
93+
list(APPEND BOOST_COMPONENTS regex)
94+
endif()
95+
96+
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
97+
message(STATUS "Boost components: ${BOOST_COMPONENTS}")
8198
message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIR}")
8299

83100
############

bin/build_libmonero_cpp.sh

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,42 @@ git submodule update --init --force || exit 1
66
HOST_NCORES=$(nproc 2>/dev/null || shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
77
if [[ $(uname -s) == "MINGW64_NT"* || $(uname -s) == "MSYS"* ]]; then
88
bit=$(getconf LONG_BIT)
9+
FOLDER=$(cd ${MINGW_PREFIX}/.. && pwd -W)
910
if [ "$bit" == "64" ]; then
10-
make release-static-win64 -j$HOST_NCORES || exit 1
11+
( mkdir -p build/release &&
12+
cd build/release &&
13+
cmake -G "MSYS Makefiles" \
14+
-D STATIC=ON \
15+
-D ARCH="x86-64" \
16+
-D BUILD_64=ON \
17+
-D CMAKE_BUILD_TYPE=Release \
18+
-D BUILD_TAG="win-x64" \
19+
-D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake \
20+
-D MSYS2_FOLDER="$FOLDER" \
21+
-D USE_DEVICE_TREZOR=OFF \
22+
../../ &&
23+
make -j$HOST_NCORES wallet cryptonote_protocol ) || exit 1
1124
else
12-
make release-static-win32 -j$HOST_NCORES || exit 1
25+
( mkdir -p build/release &&
26+
cd build/release &&
27+
cmake -G "MSYS Makefiles" \
28+
-D STATIC=ON \
29+
-D ARCH="i686" \
30+
-D BUILD_64=OFF \
31+
-D CMAKE_BUILD_TYPE=Release \
32+
-D BUILD_TAG="win-x32" \
33+
-D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake \
34+
-D MSYS2_FOLDER="$FOLDER" \
35+
-D USE_DEVICE_TREZOR=OFF \
36+
../../ &&
37+
make -j$HOST_NCORES wallet cryptonote_protocol ) || exit 1
1338
fi
1439
else
1540
# OS is not windows
16-
make release-static -j$HOST_NCORES || exit 1
41+
( mkdir -p build/release &&
42+
cd build/release &&
43+
cmake -DCMAKE_BUILD_TYPE=Release ../../ &&
44+
make -j$HOST_NCORES wallet cryptonote_protocol ) || exit 1
1745
fi
1846
cd ../../
1947

0 commit comments

Comments
 (0)