Skip to content

Commit

Permalink
CMake: Stop using versioned boost
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzbawls committed Oct 2, 2024
1 parent aa95fe3 commit b59bac1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ jobs:
- name: macOS
os: macos-12
python-version: '3.8'
packages: llvm@13 autoconf automake berkeley-db@4 libtool boost@1.76 miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium
packages: llvm@13 autoconf automake berkeley-db@4 libtool boost miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium
boost_root: true
cc: $(brew --prefix llvm@13)/bin/clang
cxx: $(brew --prefix llvm@13)/bin/clang++

- name: macOS-latest
os: macos-14
python-version: '3.10'
packages: llvm@14 autoconf automake berkeley-db@4 libtool boost@1.76 miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium
packages: llvm@14 autoconf automake berkeley-db@4 libtool boost miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium
boost_root: true
cc: $(brew --prefix llvm@14)/bin/clang
cxx: $(brew --prefix llvm@14)/bin/clang++
Expand Down Expand Up @@ -165,11 +165,11 @@ jobs:
if [ "${{ matrix.config.boost_root }}" = "true" ]; then
export CI_BOOST=1
if [ "${{ matrix.config.os }}" = "macos-14" ]; then
export LDFLAGS="-L/opt/homebrew/opt/boost@1.76/lib"
export CPPFLAGS="-I/opt/homebrew/opt/boost@1.76/include"
export LDFLAGS="-L/opt/homebrew/opt/boost/lib"
export CPPFLAGS="-I/opt/homebrew/opt/boost/include"
else
export CPPFLAGS="-I/usr/local/opt/boost@1.76/include -I/usr/local/opt/berkeley-db@4/include"
export LDFLAGS="-L/usr/local/opt/boost@1.76/lib -L/usr/local/opt/berkeley-db@4/lib"
export CPPFLAGS="-I/usr/local/opt/boost/include -I/usr/local/opt/berkeley-db@4/include"
export LDFLAGS="-L/usr/local/opt/boost/lib -L/usr/local/opt/berkeley-db@4/lib"
fi
fi
fi
Expand Down Expand Up @@ -228,24 +228,24 @@ jobs:
id: macOS-nodepends
os: macos-12
python-version: '3.8'
packages: autoconf automake ccache berkeley-db@4 libtool boost@1.76 miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium librsvg
packages: autoconf automake ccache berkeley-db@4 libtool boost miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium librsvg
unit_tests: true
functional_tests: true
cc: clang
cxx: clang++
BITCOIN_CONFIG: "--enable-zmq --enable-gui --enable-reduce-exports --enable-werror --enable-debug --with-boost=/usr/local/opt/boost@1.76"
BITCOIN_CONFIG: "--enable-zmq --enable-gui --enable-reduce-exports --enable-werror --enable-debug --with-boost=/usr/local/opt/boost"

- name: arm64-macOS-latest
id: macOS-nodepends-latest
os: macos-14
python-version: '3.10'
packages: autoconf automake ccache berkeley-db@4 libtool boost@1.76 miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium librsvg
packages: autoconf automake ccache berkeley-db@4 libtool boost miniupnpc libnatpmp pkg-config qt@5 zmq libevent qrencode gmp libsodium librsvg
unit_tests: true
functional_tests: true
goal: deploy
cc: clang
cxx: clang++
BITCOIN_CONFIG: "--enable-zmq --enable-gui --enable-reduce-exports --enable-werror --enable-debug --with-boost=/opt/homebrew/opt/boost@1.76"
BITCOIN_CONFIG: "--enable-zmq --enable-gui --enable-reduce-exports --enable-werror --enable-debug --with-boost=/opt/homebrew/opt/boost"

steps:
- name: Get Source
Expand Down Expand Up @@ -297,8 +297,8 @@ jobs:
fi
if [ "${{ matrix.config.os }}" = "macos-12" ]; then
export CPPFLAGS="-I/usr/local/opt/boost@1.76/include -I/usr/local/opt/berkeley-db@4/include"
export LDFLAGS="-L/usr/local/opt/boost@1.76/lib -L/usr/local/opt/berkeley-db@4/lib"
export CPPFLAGS="-I/usr/local/opt/boost/include -I/usr/local/opt/berkeley-db@4/include"
export LDFLAGS="-L/usr/local/opt/boost/lib -L/usr/local/opt/berkeley-db@4/lib"
fi
if [[ ${{ matrix.config.os }} = ubuntu* ]]; then
Expand Down Expand Up @@ -391,13 +391,13 @@ jobs:
id: macOS-nodepends
os: macos-12
python-version: '3.8'
packages: berkeley-db@4 boost@1.76 miniupnpc libnatpmp pkg-config zmq libevent qrencode gmp libsodium
packages: berkeley-db@4 boost miniupnpc libnatpmp pkg-config zmq libevent qrencode gmp libsodium

- name: arm64-macOS-latest
id: macOS-nodepends-latest
os: macos-14
python-version: '3.10'
packages: berkeley-db@4 boost@1.76 miniupnpc libnatpmp pkg-config zmq libevent qrencode gmp libsodium
packages: berkeley-db@4 boost miniupnpc libnatpmp pkg-config zmq libevent qrencode gmp libsodium

steps:
- name: Initialize Python
Expand Down
27 changes: 18 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Github Actions specific Boost override (macOS only)
if(DEFINED ENV{CI_BOOST})
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm")
set(BOOST_R "--with-boost=/opt/homebrew/opt/boost@1.76")
set(ENV{BOOSTROOT} "/opt/homebrew/opt/boost@1.76")
set(BOOST_R "--with-boost=/opt/homebrew/opt/boost")
set(ENV{BOOSTROOT} "/opt/homebrew/opt/boost")
else()
set(BOOST_R "--with-boost=/usr/local/opt/boost@1.76")
set(ENV{BOOSTROOT} "/usr/local/opt/boost@1.76")
set(BOOST_R "--with-boost=/usr/local/opt/boost")
set(ENV{BOOSTROOT} "/usr/local/opt/boost")
endif()
message(STATUS "Boost Root set to: ${BOOST_R}")
endif()
set(Boost_USE_MULTITHREADED ON)
set(Boost_NO_BOOST_CMAKE ON)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(ENV{target} "Linux")
file(READ "/proc/version" _SYS_VERSION)
Expand Down Expand Up @@ -94,15 +93,25 @@ if(BerkeleyDB_FOUND)
endif()
endif()

find_package(LibEvent REQUIRED)
# Find required Boost library dependency
set(Boost_USE_STATIC_LIBS ON)
set(Boost_VERBOSE ON)
# Use the new upstream BoostConfig.cmake for CMake versions starting with 3.30.0
if(CMAKE_VERSION VERSION_LESS "3.30.0")
else()
cmake_policy(SET CMP0167 NEW)
endif()
find_package(Boost COMPONENTS system filesystem chrono thread unit_test_framework REQUIRED)

# Other required library dependencies
find_package(GMP REQUIRED)
find_package(LibEvent REQUIRED)
find_package(Sodium REQUIRED)

find_package(ZMQ)
# Optional library dependencies
find_package(Miniupnp)
find_package(NAT-PMP)
find_package(Boost COMPONENTS system filesystem chrono thread REQUIRED)
find_package(Sodium REQUIRED)
find_package(ZMQ)

include_directories(${GMP_INCLUDE_DIR})

Expand Down
3 changes: 0 additions & 3 deletions src/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system filesystem chrono thread unit_test_framework REQUIRED)

set(RAW_TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/block2680960.raw)

# Generate raw files
Expand Down
3 changes: 0 additions & 3 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system filesystem chrono thread unit_test_framework REQUIRED)

set(JSON_TEST_FILES
${CMAKE_CURRENT_SOURCE_DIR}/data/script_tests.json
${CMAKE_CURRENT_SOURCE_DIR}/data/base58_keys_valid.json
Expand Down

0 comments on commit b59bac1

Please sign in to comment.