diff --git a/.appveyor.yml b/.appveyor.yml index 14708c8d0..e3653f4ee 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2014-2015 libbitcoin-node developers (see COPYING). +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). # # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY # diff --git a/.travis.yml b/.travis.yml index 00f831b82..695a43459 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2014-2015 libbitcoin-node developers (see COPYING). +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). # # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY # diff --git a/Makefile.am b/Makefile.am index 8286a1465..896362b31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2014-2015 libbitcoin-node developers (see COPYING). +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). # # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY # diff --git a/autogen.sh b/autogen.sh index f5874de15..f1a20284e 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################### -# Copyright (c) 2014-2015 libbitcoin-node developers (see COPYING). +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). # # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY # diff --git a/build.cmd b/build.cmd index b57804d93..cdb94e75c 100644 --- a/build.cmd +++ b/build.cmd @@ -1,5 +1,5 @@ REM ########################################################################### -REM # Copyright (c) 2014-2015 libbitcoin-node developers (see COPYING). +REM # Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). REM # REM # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY REM # diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt new file mode 100644 index 000000000..1d3722a7e --- /dev/null +++ b/builds/cmake/CMakeLists.txt @@ -0,0 +1,346 @@ +############################################################################### +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). +# +# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY +# +############################################################################### + +# libbitcoin-node project configuration. +#------------------------------------------------------------------------------ +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + +project(libbitcoin-node LANGUAGES C CXX) + +enable_testing() + +list( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules" ) +include(CheckIncludeFiles) +include(CheckSymbolExists) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +if (MSVC) + set( CANONICAL_LIB_NAME libbitcoin-node ) +else () + set( CANONICAL_LIB_NAME bitcoin-node ) + find_package( PkgConfig REQUIRED ) + + set( prefix "${CMAKE_PREFIX_PATH}" ) + set( exec_prefix "\${prefix}" ) + set( libdir "\${exec_prefix}/lib" ) + set( includedir "\${exec_prefix}/include" ) + + set( PACKAGE_VERSION "4.0.0" ) + set( VERSION "${PACKAGE_VERSION}" ) +endif () + +set( CMAKE_CXX_STANDARD 11 ) +set( CMAKE_CXX_STANDARD_REQUIRED ON ) + +# Add compiler options +#------------------------------------------------------------------------------ +# Warn on all stuff. +add_compile_options( "-Wall" ) + +# Warn on all stuff. +add_compile_options( "-Wall" ) + +# Warn on extra stuff. +add_compile_options( "-Wextra" ) + +# Warn on extra stuff. +add_compile_options( "-Wextra" ) + +# Be really annoying. +add_compile_options( "-Wpedantic" ) + +# Be really annoying. +add_compile_options( "-Wpedantic" ) + +# Disallow warning on style order of declarations. +add_compile_options( "-Wno-reorder" ) + +# Suppress warning for incomplete field initialization. +add_compile_options( "-Wno-missing-field-initializers" ) + +# Conform to style. +add_compile_options( "-Wno-missing-braces" ) + +# Ignore comments within comments or commenting of backslash extended lines. +add_compile_options( "-Wno-comment" ) + +# Conflict in stdlib under clang. +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options( "-Wno-mismatched-tags" ) +endif() + +# Implement -Dbash-completiondir and output ${bash-completiondir} and declare bash-completiondir. +#------------------------------------------------------------------------------ +set( bash-completiondir "no" CACHE BOOL "Install bash completion support, optionally specifying the directory. This option may require elevated permissions." ) + +# Implement -Dpkgconfigdir and output ${pkgconfigdir}. +#------------------------------------------------------------------------------ +set( pkgconfigdir "${libdir}/pkgconfig" CACHE PATH "Path to pkgconfig directory." ) + +# Implement -Dwith-tests and declare with-tests. +#------------------------------------------------------------------------------ +set( with-tests "yes" CACHE BOOL "Compile with unit tests." ) + +# Implement -Dwith-console and declare with-console. +#------------------------------------------------------------------------------ +set( with-console "yes" CACHE BOOL "Compile console application." ) + +# Implement -Denable-ndebug and define NDEBUG. +#------------------------------------------------------------------------------ +set( enable-ndebug "yes" CACHE BOOL "Compile without debug assertions." ) + +if (enable-ndebug) + add_definitions( -DNDEBUG ) +endif() + +# Inherit -Denable-shared and define BOOST_ALL_DYN_LINK. +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + add_definitions( -DBOOST_ALL_DYN_LINK ) +endif() + +# Find boost +#------------------------------------------------------------------------------ +find_package( Boost 1.62.0 REQUIRED COMPONENTS + unit_test_framework ) + +set( boost_unit_test_framework_LIBS "-lboost_unit_test_framework" ) + +if (enable-ndebug) + set( Boost_LIBRARY_DIR "${Boost_LIBRARY_DIR_DEBUG}" ) +else () + set( Boost_LIBRARY_DIR "${Boost_LIBRARY_DIR_RELEASE}" ) +endif() + +set( boost_CPPFLAGS "-I${Boost_INCLUDE_DIR}" ) +set( boost_LDFLAGS "-L${Boost_LIBRARY_DIR}" ) + +# Find bash-completion +#------------------------------------------------------------------------------ +if (bash-completiondir) + find_package( Bash-Completion 2.0.0 REQUIRED ) +endif() + +# Find bitcoin-blockchain +#------------------------------------------------------------------------------ +find_package( Bitcoin-Blockchain 4.0.0 REQUIRED ) + +# Find bitcoin-network +#------------------------------------------------------------------------------ +find_package( Bitcoin-Network 4.0.0 REQUIRED ) + +# Define project common includes directories +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + include_directories( SYSTEM + ${bitcoin_blockchain_INCLUDE_DIRS} + ${bitcoin_network_INCLUDE_DIRS} ) +else() + include_directories( SYSTEM + ${bitcoin_blockchain_STATIC_INCLUDE_DIRS} + ${bitcoin_network_STATIC_INCLUDE_DIRS} ) +endif() + +# Define project common library directories +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + link_directories( + ${bitcoin_blockchain_LIBRARY_DIRS} + ${bitcoin_network_LIBRARY_DIRS} ) +else() + link_directories( + ${bitcoin_blockchain_STATIC_LIBRARY_DIRS} + ${bitcoin_network_STATIC_LIBRARY_DIRS} ) +endif() + +# Define project common libraries/linker flags. +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + link_libraries( + "-fstack-protector" + "-fstack-protector-all" + ${bitcoin_blockchain_LIBRARIES} + ${bitcoin_network_LIBRARIES} ) +else() + link_libraries( + "-fstack-protector" + "-fstack-protector-all" + ${bitcoin_blockchain_STATIC_LIBRARIES} + ${bitcoin_network_STATIC_LIBRARIES} ) +endif() + +add_definitions( + -DSYSCONFDIR=\"${sysconfdir}\" ) + +# Define ${CANONICAL_LIB_NAME} project. +#------------------------------------------------------------------------------ +add_library( ${CANONICAL_LIB_NAME} + "../../src/configuration.cpp" + "../../src/full_node.cpp" + "../../src/parser.cpp" + "../../src/settings.cpp" + "../../src/protocols/protocol_block_in.cpp" + "../../src/protocols/protocol_block_out.cpp" + "../../src/protocols/protocol_block_sync.cpp" + "../../src/protocols/protocol_header_in.cpp" + "../../src/protocols/protocol_transaction_in.cpp" + "../../src/protocols/protocol_transaction_out.cpp" + "../../src/sessions/session_inbound.cpp" + "../../src/sessions/session_manual.cpp" + "../../src/sessions/session_outbound.cpp" + "../../src/utility/check_list.cpp" + "../../src/utility/hash_queue.cpp" + "../../src/utility/performance.cpp" + "../../src/utility/reservation.cpp" + "../../src/utility/reservations.cpp" ) + +# ${CANONICAL_LIB_NAME} project specific include directories. +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE + "../../include" + ${bitcoin_blockchain_INCLUDE_DIRS} + ${bitcoin_network_INCLUDE_DIRS} ) +else() + target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE + "../../include" + ${bitcoin_blockchain_STATIC_INCLUDE_DIRS} + ${bitcoin_network_STATIC_INCLUDE_DIRS} ) +endif() + +target_include_directories( ${CANONICAL_LIB_NAME} PUBLIC +"../../include" ) + +# ${CANONICAL_LIB_NAME} project specific libraries/linker flags. +#------------------------------------------------------------------------------ +if (BUILD_SHARED_LIBS) + target_link_libraries( ${CANONICAL_LIB_NAME} + ${bitcoin_blockchain_LIBRARIES} + ${bitcoin_network_LIBRARIES} ) +else() + target_link_libraries( ${CANONICAL_LIB_NAME} + ${bitcoin_blockchain_STATIC_LIBRARIES} + ${bitcoin_network_STATIC_LIBRARIES} ) +endif() + +# Define libbitcoin-node-test project. +#------------------------------------------------------------------------------ +if (with-tests) + add_executable( libbitcoin-node-test + "../../test/check_list.cpp" + "../../test/configuration.cpp" + "../../test/main.cpp" + "../../test/node.cpp" + "../../test/performance.cpp" + "../../test/reservation.cpp" + "../../test/reservations.cpp" + "../../test/settings.cpp" + "../../test/utility.cpp" + "../../test/utility.hpp" ) + + add_test( NAME libbitcoin-node-test COMMAND libbitcoin-node-test + --run_test=* + --show_progress=no + --detect_memory_leak=0 + --report_level=no + --build_info=yes ) + +# libbitcoin-node-test project specific include directories. +#------------------------------------------------------------------------------ + target_include_directories( libbitcoin-node-test PRIVATE + "../../include" ) + +# libbitcoin-node-test project specific libraries/linker flags. +#------------------------------------------------------------------------------ + target_link_libraries( libbitcoin-node-test + ${CANONICAL_LIB_NAME} + ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) + +endif() + +# Define bn project. +#------------------------------------------------------------------------------ +if (with-console) + add_executable( bn + "../../console/executor.cpp" + "../../console/executor.hpp" + "../../console/libbitcoin.ico" + "../../console/main.cpp" ) + +# bn project specific include directories. +#------------------------------------------------------------------------------ + target_include_directories( bn PRIVATE + "../../include" ) + +# bn project specific libraries/linker flags. +#------------------------------------------------------------------------------ + target_link_libraries( bn + ${CANONICAL_LIB_NAME} ) + +endif() + +# Manage pkgconfig installation. +#------------------------------------------------------------------------------ +configure_file( + "../../libbitcoin-node.pc.in" + "libbitcoin-node.pc" @ONLY ) + +install( FILES + "${CMAKE_CURRENT_BINARY_DIR}/libbitcoin-node.pc" + DESTINATION "${pkgconfigdir}" ) + +# Manage installation of docs. +#------------------------------------------------------------------------------ +install( FILES + "../../AUTHORS" + "../../COPYING" + "../../ChangeLog" + "../../INSTALL" + "../../NEWS" + "../../README" + DESTINATION share/doc/libbitcoin-node ) + +# Manage ${CANONICAL_LIB_NAME} installation. +#------------------------------------------------------------------------------ +install( TARGETS ${CANONICAL_LIB_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include ) + +# Manage bn installation. +#------------------------------------------------------------------------------ +if (with-console) + install( TARGETS bn + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include ) +endif() + +# Manage include installation. +#------------------------------------------------------------------------------ +install( DIRECTORY "../../include/bitcoin" + DESTINATION include ) + +# Manage data installation for bash_completion prefixed product. +#------------------------------------------------------------------------------ +if (bash-completiondir) + install( FILES + "../../data/bn" + DESTINATION etc/libbitcoin ) +endif() + +# Manage data installation for sysconf prefixed product. +#------------------------------------------------------------------------------ +if (with-console) + install( FILES + "../../data/bn.cfg" + DESTINATION etc/libbitcoin ) +endif() + diff --git a/builds/cmake/modules/FindBash-Completion.cmake b/builds/cmake/modules/FindBash-Completion.cmake new file mode 100644 index 000000000..1bd54508c --- /dev/null +++ b/builds/cmake/modules/FindBash-Completion.cmake @@ -0,0 +1,60 @@ +############################################################################### +# Copyright (c) 2014-2018 libbitcoin-server developers (see COPYING). +# +# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY +# +############################################################################### +# FindBash-Completion +# +# Use this module by invoking find_package with the form:: +# +# find_package( Bash-Completion +# [version] # Minimum version +# [REQUIRED] # Fail with error if bash-completion is not found +# ) +# +# Defines the following for use: +# +# bash_completion_FOUND - true if headers and requested libraries were found +# bash_completion_INCLUDE_DIRS - include directories for bash-completion libraries +# bash_completion_LIBRARY_DIRS - link directories for bash-completion libraries +# bash_completion_LIBRARIES - bash-completion libraries to be linked +# bash_completion_PKG - bash-completion pkg-config package specification. +# + +if (MSVC) + if ( Bash-Completion_FIND_REQUIRED ) + set( _bash_completion_MSG_STATUS "SEND_ERROR" ) + else () + set( _bash_completion_MSG_STATUS "STATUS" ) + endif() + + set( bash_completion_FOUND false ) + message( ${_bash_completion_MSG_STATUS} "MSVC environment detection for 'bash-completion' not currently supported." ) +else () + # required + if ( Bash-Completion_FIND_REQUIRED ) + set( _bash_completion_REQUIRED "REQUIRED" ) + endif() + + # quiet + if ( Bash-Completion_FIND_QUIETLY ) + set( _bash_completion_QUIET "QUIET" ) + endif() + + # modulespec + if ( Bash-Completion_FIND_VERSION_COUNT EQUAL 0 ) + set( _bash_completion_MODULE_SPEC "bash-completion" ) + else () + if ( Bash-Completion_FIND_VERSION_EXACT ) + set( _bash_completion_MODULE_SPEC_OP "=" ) + else () + set( _bash_completion_MODULE_SPEC_OP ">=" ) + endif() + + set( _bash_completion_MODULE_SPEC "bash-completion ${_bash_completion_MODULE_SPEC_OP} ${Bash-Completion_FIND_VERSION}" ) + endif() + + pkg_check_modules( bash_completion ${_bash_completion_REQUIRED} ${_bash_completion_QUIET} "${_bash_completion_MODULE_SPEC}" ) + set( bash_completion_PKG "${_bash_completion_MODULE_SPEC}" ) +endif() diff --git a/builds/cmake/modules/FindBitcoin-Blockchain.cmake b/builds/cmake/modules/FindBitcoin-Blockchain.cmake new file mode 100644 index 000000000..99344e66f --- /dev/null +++ b/builds/cmake/modules/FindBitcoin-Blockchain.cmake @@ -0,0 +1,60 @@ +############################################################################### +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). +# +# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY +# +############################################################################### +# FindBitcoin-Blockchain +# +# Use this module by invoking find_package with the form:: +# +# find_package( Bitcoin-Blockchain +# [version] # Minimum version +# [REQUIRED] # Fail with error if bitcoin-blockchain is not found +# ) +# +# Defines the following for use: +# +# bitcoin_blockchain_FOUND - true if headers and requested libraries were found +# bitcoin_blockchain_INCLUDE_DIRS - include directories for bitcoin-blockchain libraries +# bitcoin_blockchain_LIBRARY_DIRS - link directories for bitcoin-blockchain libraries +# bitcoin_blockchain_LIBRARIES - bitcoin-blockchain libraries to be linked +# bitcoin_blockchain_PKG - bitcoin-blockchain pkg-config package specification. +# + +if (MSVC) + if ( Bitcoin-Blockchain_FIND_REQUIRED ) + set( _bitcoin_blockchain_MSG_STATUS "SEND_ERROR" ) + else () + set( _bitcoin_blockchain_MSG_STATUS "STATUS" ) + endif() + + set( bitcoin_blockchain_FOUND false ) + message( ${_bitcoin_blockchain_MSG_STATUS} "MSVC environment detection for 'bitcoin-blockchain' not currently supported." ) +else () + # required + if ( Bitcoin-Blockchain_FIND_REQUIRED ) + set( _bitcoin_blockchain_REQUIRED "REQUIRED" ) + endif() + + # quiet + if ( Bitcoin-Blockchain_FIND_QUIETLY ) + set( _bitcoin_blockchain_QUIET "QUIET" ) + endif() + + # modulespec + if ( Bitcoin-Blockchain_FIND_VERSION_COUNT EQUAL 0 ) + set( _bitcoin_blockchain_MODULE_SPEC "libbitcoin-blockchain" ) + else () + if ( Bitcoin-Blockchain_FIND_VERSION_EXACT ) + set( _bitcoin_blockchain_MODULE_SPEC_OP "=" ) + else () + set( _bitcoin_blockchain_MODULE_SPEC_OP ">=" ) + endif() + + set( _bitcoin_blockchain_MODULE_SPEC "libbitcoin-blockchain ${_bitcoin_blockchain_MODULE_SPEC_OP} ${Bitcoin-Blockchain_FIND_VERSION}" ) + endif() + + pkg_check_modules( bitcoin_blockchain ${_bitcoin_blockchain_REQUIRED} ${_bitcoin_blockchain_QUIET} "${_bitcoin_blockchain_MODULE_SPEC}" ) + set( bitcoin_blockchain_PKG "${_bitcoin_blockchain_MODULE_SPEC}" ) +endif() diff --git a/builds/cmake/modules/FindBitcoin-Network.cmake b/builds/cmake/modules/FindBitcoin-Network.cmake new file mode 100644 index 000000000..23f08806f --- /dev/null +++ b/builds/cmake/modules/FindBitcoin-Network.cmake @@ -0,0 +1,60 @@ +############################################################################### +# Copyright (c) 2014-2018 libbitcoin-node developers (see COPYING). +# +# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY +# +############################################################################### +# FindBitcoin-Network +# +# Use this module by invoking find_package with the form:: +# +# find_package( Bitcoin-Network +# [version] # Minimum version +# [REQUIRED] # Fail with error if bitcoin-network is not found +# ) +# +# Defines the following for use: +# +# bitcoin_network_FOUND - true if headers and requested libraries were found +# bitcoin_network_INCLUDE_DIRS - include directories for bitcoin-network libraries +# bitcoin_network_LIBRARY_DIRS - link directories for bitcoin-network libraries +# bitcoin_network_LIBRARIES - bitcoin-network libraries to be linked +# bitcoin_network_PKG - bitcoin-network pkg-config package specification. +# + +if (MSVC) + if ( Bitcoin-Network_FIND_REQUIRED ) + set( _bitcoin_network_MSG_STATUS "SEND_ERROR" ) + else () + set( _bitcoin_network_MSG_STATUS "STATUS" ) + endif() + + set( bitcoin_network_FOUND false ) + message( ${_bitcoin_network_MSG_STATUS} "MSVC environment detection for 'bitcoin-network' not currently supported." ) +else () + # required + if ( Bitcoin-Network_FIND_REQUIRED ) + set( _bitcoin_network_REQUIRED "REQUIRED" ) + endif() + + # quiet + if ( Bitcoin-Network_FIND_QUIETLY ) + set( _bitcoin_network_QUIET "QUIET" ) + endif() + + # modulespec + if ( Bitcoin-Network_FIND_VERSION_COUNT EQUAL 0 ) + set( _bitcoin_network_MODULE_SPEC "libbitcoin-network" ) + else () + if ( Bitcoin-Network_FIND_VERSION_EXACT ) + set( _bitcoin_network_MODULE_SPEC_OP "=" ) + else () + set( _bitcoin_network_MODULE_SPEC_OP ">=" ) + endif() + + set( _bitcoin_network_MODULE_SPEC "libbitcoin-network ${_bitcoin_network_MODULE_SPEC_OP} ${Bitcoin-Network_FIND_VERSION}" ) + endif() + + pkg_check_modules( bitcoin_network ${_bitcoin_network_REQUIRED} ${_bitcoin_network_QUIET} "${_bitcoin_network_MODULE_SPEC}" ) + set( bitcoin_network_PKG "${_bitcoin_network_MODULE_SPEC}" ) +endif() diff --git a/builds/msvc/vs2013/bn/bn.vcxproj b/builds/msvc/vs2013/bn/bn.vcxproj index 35bd28c6c..863388ad5 100644 --- a/builds/msvc/vs2013/bn/bn.vcxproj +++ b/builds/msvc/vs2013/bn/bn.vcxproj @@ -1,6 +1,6 @@