Skip to content

Commit

Permalink
Merge #154: cmake: Port changes from PR28981
Browse files Browse the repository at this point in the history
b8fd285 fixup! cmake: Add external signer support (Hennadii Stepanov)

Pull request description:

  This PR ports changes from bitcoin#28981.

ACKs for top commit:
  laanwj:
    Code review ACK b8fd285

Tree-SHA512: 338f0c8b4c94e2c706658c6b2f1306de8b6d9836dcebcefe7b81cd79d5dabf471b03afc597047a42351fda72b6c9ec2828b02c177f03df0011d3b801addda1bf
  • Loading branch information
hebasto committed Apr 24, 2024
2 parents 32f3698 + b8fd285 commit fe0b9dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Expand Up @@ -101,11 +101,8 @@ tristate_option(WITH_USDT
"if sys/sdt.h is found."
AUTO
)
tristate_option(WITH_EXTERNAL_SIGNER
"Enable external signer support."
"if Boost.Process is found."
AUTO
)
cmake_dependent_option(WITH_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF)
set(ENABLE_EXTERNAL_SIGNER ${WITH_EXTERNAL_SIGNER})
tristate_option(WITH_QRENCODE "Enable QR code support." "if libqrencode is found." AUTO)

option(MULTIPROCESS "Build multiprocess bitcoin-node, bitcoin-wallet, and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." OFF)
Expand Down
50 changes: 0 additions & 50 deletions cmake/module/AddBoostIfNeeded.cmake
Expand Up @@ -55,54 +55,4 @@ function(add_boost_if_needed)
endif()
endif()

if(WITH_EXTERNAL_SIGNER)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR})
# Boost 1.78 requires the following workaround.
# See: https://github.com/boostorg/process/issues/235
set(CMAKE_REQUIRED_FLAGS "-Wno-error=narrowing")
# Boost 1.73 requires the following workaround on systems with
# libc<2.34 only, as newer libc has integrated the functionality
# of the libpthread library.
set(CMAKE_REQUIRED_LIBRARIES Threads::Threads)
check_cxx_source_compiles("
#define BOOST_PROCESS_USE_STD_FS
#include <boost/process.hpp>
#include <string>
int main()
{
namespace bp = boost::process;
bp::opstream stdin_stream;
bp::ipstream stdout_stream;
bp::child c(\"dummy\", bp::std_out > stdout_stream, bp::std_err > stdout_stream, bp::std_in < stdin_stream);
stdin_stream << std::string{\"test\"} << std::endl;
if (c.running()) c.terminate();
c.wait();
c.exit_code();
}
" HAVE_BOOST_PROCESS
)
if(HAVE_BOOST_PROCESS)
if(WIN32)
# Boost Process for Windows uses Boost ASIO. Boost ASIO performs
# pre-main init of Windows networking libraries, which we do not
# want.
set(WITH_EXTERNAL_SIGNER OFF PARENT_SCOPE)
set(ENABLE_EXTERNAL_SIGNER OFF PARENT_SCOPE)
else()
set(WITH_EXTERNAL_SIGNER ON PARENT_SCOPE)
set(ENABLE_EXTERNAL_SIGNER ON PARENT_SCOPE)
target_compile_definitions(Boost::headers INTERFACE
BOOST_PROCESS_USE_STD_FS
)
endif()
elseif(WITH_EXTERNAL_SIGNER STREQUAL "AUTO")
set(WITH_EXTERNAL_SIGNER OFF PARENT_SCOPE)
set(ENABLE_EXTERNAL_SIGNER OFF PARENT_SCOPE)
else()
message(FATAL_ERROR "External signing is not supported for this Boost version.")
endif()
endif()

endfunction()

0 comments on commit fe0b9dd

Please sign in to comment.