From 3f4a57d6d9237f7298db15934f5344e06509443e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:18:19 +0100 Subject: [PATCH 1/2] fixup! cmake: Build `bitcoind` executable Add `BOOST_NO_CXX98_FUNCTION_BASE` definition when needed. This mirrors the master branch behavior and fixes native build on macOS with Homebrew's `boost@1.76`. --- cmake/module/AddBoostIfNeeded.cmake | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cmake/module/AddBoostIfNeeded.cmake b/cmake/module/AddBoostIfNeeded.cmake index ba9778316fade..25806bbaccc5c 100644 --- a/cmake/module/AddBoostIfNeeded.cmake +++ b/cmake/module/AddBoostIfNeeded.cmake @@ -32,9 +32,30 @@ function(add_boost_if_needed) ) endif() + # Prevent use of std::unary_function, which was removed in C++17, + # and will generate warnings with newer compilers for Boost + # older than 1.80. + # See: https://github.com/boostorg/config/pull/430. + set(CMAKE_REQUIRED_DEFINITIONS -DBOOST_NO_CXX98_FUNCTION_BASE) + set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR}) + include(CMakePushCheckState) + cmake_push_check_state() + include(TryAppendCXXFlags) + set(CMAKE_REQUIRED_FLAGS ${working_compiler_werror_flag}) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + check_cxx_source_compiles(" + #include + " NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE + ) + cmake_pop_check_state() + if(NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE) + target_compile_definitions(Boost::headers INTERFACE + BOOST_NO_CXX98_FUNCTION_BASE + ) + endif() + if(BUILD_TESTS) include(CheckCXXSourceCompiles) - set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR}) check_cxx_source_compiles(" #define BOOST_TEST_MAIN #include From bf49bdedef3db551c30f42831564079c2ffbd529 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:52:14 +0100 Subject: [PATCH 2/2] fixup! ci: Migrate CI scripts to CMake Test old Boost on macOS --- .github/workflows/cmake.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b3a1761cf5564..66e9288c805df 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -520,17 +520,23 @@ jobs: macos-native: - name: '${{ matrix.os.name }}, ${{ matrix.xcode.name }}' - runs-on: ${{ matrix.os.os }} + name: '${{ matrix.conf.name }}, ${{ matrix.xcode.name }}' + runs-on: ${{ matrix.conf.os }} strategy: fail-fast: false matrix: - os: + conf: - name: 'macOS 13 native, x86_64' os: macos-13 + boost_package: 'boost' - name: 'macOS 14 native, arm64' os: macos-14 + boost_package: 'boost' + - name: 'macOS 14 native, arm64, Boost 1.76' + os: macos-14 + boost_package: 'boost@1.76' + build_options: '-DBoost_INCLUDE_DIR=/opt/homebrew/opt/boost@1.76/include' xcode: - name: 'Xcode 15.2' id: 'xcode-15.2' @@ -546,7 +552,7 @@ jobs: clang --version - name: Workaround for Homebrew python link - if: matrix.os.os == 'macos-13' + if: matrix.conf.os == 'macos-13' env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | @@ -556,7 +562,7 @@ jobs: env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | - brew install ccache cmake pkg-config boost libevent berkeley-db@4 qt@5 qrencode libnatpmp miniupnpc zeromq tree + brew install ccache cmake pkg-config ${{ matrix.conf.boost_package }} libevent berkeley-db@4 qt@5 qrencode libnatpmp miniupnpc zeromq tree echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV" - name: CMake version @@ -569,12 +575,12 @@ jobs: id: ccache-cache with: path: ${{ env.CCACHE_DIR }} - key: ${{ matrix.os.os }}-${{ matrix.xcode.id }}-ccache-${{ github.run_id }} - restore-keys: ${{ matrix.os.os }}-${{ matrix.xcode.id }}-ccache- + key: ${{ matrix.conf.os }}-${{ matrix.xcode.id }}-ccache-${{ github.run_id }} + restore-keys: ${{ matrix.conf.os }}-${{ matrix.xcode.id }}-ccache- - name: Generate build system run: | - cmake -B build --preset ci-darwin + cmake -B build --preset ci-darwin ${{ matrix.conf.build_options }} - name: Build env: @@ -593,7 +599,7 @@ jobs: if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true' with: path: ${{ env.CCACHE_DIR }} - key: ${{ matrix.os.os }}-${{ matrix.xcode.id }}-ccache-${{ github.run_id }} + key: ${{ matrix.conf.os }}-${{ matrix.xcode.id }}-ccache-${{ github.run_id }} - name: Test run: |