diff --git a/Builds/CMake/CMakeFuncs.cmake b/Builds/CMake/CMakeFuncs.cmake index 12634c869..a605dc475 100644 --- a/Builds/CMake/CMakeFuncs.cmake +++ b/Builds/CMake/CMakeFuncs.cmake @@ -1,31 +1,6 @@ -# This is a set of common functions and settings for rippled -# and derived products. - -############################################################ - -cmake_minimum_required(VERSION 3.1.0) - -if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - message(WARNING "Builds are strongly discouraged in " - "${CMAKE_SOURCE_DIR}.") -endif() +## "target" parsing..DEPRECATED and will be removed in future macro(parse_target) - - if (NOT target OR target STREQUAL "default") - if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) - endif() - string(TOLOWER ${CMAKE_BUILD_TYPE} target) - if (APPLE) - set(target clang.${target}) - elseif(WIN32) - set(target msvc) - else() - set(target gcc.${target}) - endif() - endif() - if (target) # Parse the target set(remaining ${target}) @@ -76,12 +51,10 @@ macro(parse_target) if (${cur_component} STREQUAL unity) set(unity true) - set(nonunity false) endif() if (${cur_component} STREQUAL nounity) set(unity false) - set(nonunity true) endif() if (${cur_component} STREQUAL debug) @@ -100,14 +73,6 @@ macro(parse_target) if (${cur_component} STREQUAL profile) set(profile true) endif() - - if (${cur_component} STREQUAL ci) - # Workarounds that make various CI builds work, but that - # we don't want in the general case. - set(ci true) - set(openssl_min 1.0.1) - endif() - endwhile() endif() @@ -116,109 +81,15 @@ macro(parse_target) message(FATAL_ERROR "Can not find appropriate compiler for target ${target}") endif() - # If defined, promote the compiler path values to the CACHE, then - # unset the locals to prevent shadowing. Some scenarios do not - # need or want to find a compiler, such as -GNinja under Windows. - # Setting these values in those case may prevent CMake from finding - # a valid compiler. - if (CMAKE_C_COMPILER) - set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE FILEPATH - "Path to a program" FORCE) - unset(CMAKE_C_COMPILER) - endif (CMAKE_C_COMPILER) - if (CMAKE_CXX_COMPILER) - set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH - "Path to a program" FORCE) - unset(CMAKE_CXX_COMPILER) - endif (CMAKE_CXX_COMPILER) - if (release) set(CMAKE_BUILD_TYPE Release) else() set(CMAKE_BUILD_TYPE Debug) endif() - - # ensure that the unity flags are set and exclusive - if (NOT DEFINED unity OR unity) - # Default to unity builds - set(unity true) - set(nonunity false) - else() - set(unity false) - set(nonunity true) - endif() - - if (NOT unity) - set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}Classic) - endif() - # Promote this value to the CACHE, then unset the local - # to prevent shadowing. - set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE INTERNAL - "Choose the type of build, options are in CMAKE_CONFIGURATION_TYPES" - FORCE) - unset(CMAKE_BUILD_TYPE) - endmacro() ############################################################ -macro(setup_build_cache) - set(san "" CACHE STRING "On gcc & clang, add sanitizer - instrumentation") - set_property(CACHE san PROPERTY STRINGS ";address;thread") - set(assert false CACHE BOOL "Enables asserts, even in release builds") - set(static false CACHE BOOL - "On linux, link protobuf, openssl, libc++, and boost statically") - set(jemalloc false CACHE BOOL "Enables jemalloc for heap profiling") - set(perf false CACHE BOOL "Enables flags that assist with perf recording") - - if (static AND (WIN32 OR APPLE)) - message(FATAL_ERROR "Static linking is only supported on linux.") - endif() - - if (perf AND (WIN32 OR APPLE)) - message(FATAL_ERROR "perf flags are only supported on linux.") - endif() - - if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) - endif() - - # Can't exclude files from configurations, so can't support both - # unity and nonunity configurations at the same time - if (NOT DEFINED unity OR unity) - set(CMAKE_CONFIGURATION_TYPES - Debug - Release) - else() - set(CMAKE_CONFIGURATION_TYPES - DebugClassic - ReleaseClassic) - endif() - - # Promote this value to the CACHE, then unset the local - # to prevent shadowing. - set(CMAKE_CONFIGURATION_TYPES - ${CMAKE_CONFIGURATION_TYPES} CACHE STRING "" FORCE) - unset(CMAKE_CONFIGURATION_TYPES) -endmacro() - -############################################################ - -function(prepend var prefix) - set(listVar "") - foreach(f ${ARGN}) - list(APPEND listVar "${prefix}${f}") - endforeach(f) - set(${var} "${listVar}" PARENT_SCOPE) -endfunction() - -macro(append_flags name) - foreach (arg ${ARGN}) - set(${name} "${${name}} ${arg}") - endforeach() -endmacro() - macro(group_sources_in source_dir curdir) file(GLOB children RELATIVE ${source_dir}/${curdir} ${source_dir}/${curdir}/*) @@ -237,637 +108,3 @@ macro(group_sources curdir) group_sources_in(${PROJECT_SOURCE_DIR} ${curdir}) endmacro() -macro(add_with_props src_var files) - list(APPEND ${src_var} ${files}) - foreach (arg ${ARGN}) - set(props "${props} ${arg}") - endforeach() - set_source_files_properties( - ${files} - PROPERTIES COMPILE_FLAGS - ${props}) -endmacro() - -############################################################ - -macro(determine_build_type) - if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang - set(is_clang true) - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(is_gcc true) - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(is_msvc true) - endif() - - if (${CMAKE_GENERATOR} STREQUAL "Xcode") - set(is_xcode true) - else() - set(is_xcode false) - endif() - - if (NOT is_gcc AND NOT is_clang AND NOT is_msvc) - message("Current compiler is ${CMAKE_CXX_COMPILER_ID}") - message(FATAL_ERROR "Missing compiler. Must be GNU, Clang, or MSVC") - endif() -endmacro() - -############################################################ - -macro(check_gcc4_abi) - # Check if should use gcc4's ABI - set(gcc4_abi false) - - if ($ENV{RIPPLED_OLD_GCC_ABI}) - set(gcc4_abi true) - endif() - - if (is_gcc AND NOT gcc4_abi) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5) - execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE lsb) - string(STRIP "${lsb}" lsb) - if ("${lsb}" STREQUAL "Ubuntu") - execute_process(COMMAND lsb_release -sr OUTPUT_VARIABLE lsb) - string(STRIP ${lsb} lsb) - if (${lsb} VERSION_LESS 15.1) - set(gcc4_abi true) - endif() - endif() - endif() - endif() - - if (gcc4_abi) - add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) - endif() -endmacro() - -############################################################ - -macro(special_build_flags) - if (coverage) - add_compile_options(-fprofile-arcs -ftest-coverage) - append_flags(CMAKE_EXE_LINKER_FLAGS -fprofile-arcs -ftest-coverage) - endif() - - if (profile) - add_compile_options(-p -pg) - append_flags(CMAKE_EXE_LINKER_FLAGS -p -pg) - endif() -endmacro() - -############################################################ - -# Params: Boost components to search for. -macro(use_boost) - if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT})) - set(BOOST_ROOT $ENV{BOOST_ROOT}) - endif() - file(TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT) - if(WIN32 OR CYGWIN) - # Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders - if(DEFINED BOOST_ROOT) - if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND IS_DIRECTORY ${BOOST_ROOT}/stage64/lib) - set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage64/lib) - else() - set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage/lib) - endif() - endif() - endif() - - if (is_clang AND DEFINED ENV{CLANG_BOOST_ROOT}) - set(BOOST_ROOT $ENV{CLANG_BOOST_ROOT}) - endif() - - # boost dynamic libraries don't trivially support @rpath - # linking right now (cmake's default), so just force - # static linking for macos, or if requested on linux - # by flag - if (static OR APPLE) - set(Boost_USE_STATIC_LIBS on) - endif() - set(Boost_USE_MULTITHREADED on) - set(Boost_USE_STATIC_RUNTIME off) - if(MSVC) - find_package(Boost REQUIRED) - else() - find_package(Boost REQUIRED ${ARGN}) - endif() - - if (Boost_FOUND OR - ((CYGWIN OR WIN32) AND Boost_INCLUDE_DIRS AND Boost_LIBRARY_DIRS)) - if(NOT Boost_FOUND) - message(WARNING "Boost directory found, but not all components. May not be able to build.") - endif() - - if(Boost_VERSION VERSION_LESS 106700) - message(FATAL_ERROR "Boost version 1.67 or greater is required for boost::beast. Found version: ${Boost_VERSION}") - endif() - - if (is_xcode) - include_directories(BEFORE ${Boost_INCLUDE_DIRS}) - append_flags(CMAKE_CXX_FLAGS --system-header-prefix="boost/") - else() - include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) - endif() - - if(MSVC) - link_directories(${Boost_LIBRARY_DIRS}) - endif() - else() - message(FATAL_ERROR "Boost not found") - endif() -endmacro() - -macro(use_pthread) - if (NOT WIN32) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads) - add_compile_options(${CMAKE_THREAD_LIBS_INIT}) - endif() -endmacro() - -macro(use_openssl openssl_min) - if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR}) - find_program(HOMEBREW brew) - if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND") - execute_process(COMMAND brew --prefix openssl - OUTPUT_VARIABLE OPENSSL_ROOT_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - endif() - - if (WIN32) - if ((NOT DEFINED OPENSSL_ROOT) AND (DEFINED ENV{OPENSSL_ROOT})) - set(OPENSSL_ROOT $ENV{OPENSSL_ROOT}) - endif() - file(TO_CMAKE_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT) - if (DEFINED OPENSSL_ROOT) - include_directories(${OPENSSL_ROOT}/include) - link_directories(${OPENSSL_ROOT}/lib) - endif() - else() - if (static) - set(tmp CMAKE_FIND_LIBRARY_SUFFIXES) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - endif() - - find_package(OpenSSL) - # depending on how openssl is built, it might depend - # on zlib. In fact, the openssl find package should - # figure this out for us, but it does not currently... - # so let's add zlib ourselves to the lib list - find_package(ZLIB) - - if (static) - set(CMAKE_FIND_LIBRARY_SUFFIXES tmp) - endif() - - if (OPENSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) - list(APPEND OPENSSL_LIBRARIES ${ZLIB_LIBRARIES}) - else() - message(FATAL_ERROR "OpenSSL not found") - endif() - if (UNIX AND NOT APPLE AND ${OPENSSL_VERSION} VERSION_LESS ${openssl_min}) - message(FATAL_ERROR - "Your openssl is Version: ${OPENSSL_VERSION}, ${openssl_min} or better is required.") - endif() - endif() -endmacro() - -macro(use_protobuf) - if (WIN32) - if (DEFINED ENV{PROTOBUF_ROOT}) - include_directories($ENV{PROTOBUF_ROOT}/src) - link_directories($ENV{PROTOBUF_ROOT}/src/.libs) - endif() - - # Modified from FindProtobuf.cmake - FUNCTION(PROTOBUF_GENERATE_CPP SRCS HDRS PROTOFILES) - # argument parsing - IF(NOT PROTOFILES) - MESSAGE(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") - RETURN() - ENDIF() - - SET(OUTPATH ${CMAKE_CURRENT_BINARY_DIR}) - SET(PROTOROOT ${CMAKE_CURRENT_SOURCE_DIR}) - # the real logic - SET(${SRCS}) - SET(${HDRS}) - FOREACH(PROTOFILE ${PROTOFILES}) - # ensure that the file ends with .proto - STRING(REGEX MATCH "\\.proto$$" PROTOEND ${PROTOFILE}) - IF(NOT PROTOEND) - MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' does not end with .proto") - ENDIF() - - GET_FILENAME_COMPONENT(PROTO_PATH ${PROTOFILE} PATH) - GET_FILENAME_COMPONENT(ABS_FILE ${PROTOFILE} ABSOLUTE) - GET_FILENAME_COMPONENT(FILE_WE ${PROTOFILE} NAME_WE) - - STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_PATH ${PROTOFILE}) - STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_ABS_FILE ${ABS_FILE}) - - IF(IN_ROOT_PATH) - SET(MATCH_PATH ${PROTOFILE}) - ELSEIF(IN_ROOT_ABS_FILE) - SET(MATCH_PATH ${ABS_FILE}) - ELSE() - MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' is not in protoroot '${PROTOROOT}'") - ENDIF() - - # build the result file name - STRING(REGEX REPLACE "^${PROTOROOT}(/?)" "" ROOT_CLEANED_FILE ${MATCH_PATH}) - STRING(REGEX REPLACE "\\.proto$$" "" EXT_CLEANED_FILE ${ROOT_CLEANED_FILE}) - - SET(CPP_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.cc") - SET(H_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.h") - - LIST(APPEND ${SRCS} "${CPP_FILE}") - LIST(APPEND ${HDRS} "${H_FILE}") - - ADD_CUSTOM_COMMAND( - OUTPUT "${CPP_FILE}" "${H_FILE}" - COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPATH} - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS "--cpp_out=${OUTPATH}" --proto_path "${PROTOROOT}" "${MATCH_PATH}" - DEPENDS ${ABS_FILE} - COMMENT "Running C++ protocol buffer compiler on ${MATCH_PATH} with root ${PROTOROOT}, generating: ${CPP_FILE}" - VERBATIM) - - ENDFOREACH() - - SET_SOURCE_FILES_PROPERTIES(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - SET(${SRCS} ${${SRCS}} PARENT_SCOPE) - SET(${HDRS} ${${HDRS}} PARENT_SCOPE) - - ENDFUNCTION() - - set(PROTOBUF_PROTOC_EXECUTABLE Protoc) # must be on path - else() - if (static) - set(tmp CMAKE_FIND_LIBRARY_SUFFIXES) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - endif() - - find_package(Protobuf REQUIRED) - - if (static) - set(CMAKE_FIND_LIBRARY_SUFFIXES tmp) - endif() - - if (is_clang AND DEFINED ENV{CLANG_PROTOBUF_ROOT}) - link_directories($ENV{CLANG_PROTOBUF_ROOT}/src/.libs) - include_directories($ENV{CLANG_PROTOBUF_ROOT}/src) - else() - include_directories(${PROTOBUF_INCLUDE_DIRS}) - endif() - - if (is_xcode) - append_flags(CMAKE_CXX_FLAGS --system-header-prefix="google/protobuf") - endif() - - endif() - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - - file(GLOB ripple_proto src/ripple/proto/*.proto) - PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${ripple_proto}) - - if (WIN32) - include_directories(src/protobuf/src - src/protobuf/vsprojects - ${CMAKE_CURRENT_BINARY_DIR}/src/ripple/proto) - endif() - -endmacro() - -############################################################ - -macro(setup_build_boilerplate) - if (NOT WIN32 AND san) - add_compile_options(-fsanitize=${san} -fno-omit-frame-pointer) - - append_flags(CMAKE_EXE_LINKER_FLAGS - -fsanitize=${san}) - - string(TOLOWER ${san} ci_san) - if (${ci_san} STREQUAL address) - if (is_gcc) - set(SANITIZER_LIBRARIES asan) - endif() - add_definitions(-DSANITIZER=ASAN) - endif() - if (${ci_san} STREQUAL thread) - if (is_gcc) - set(SANITIZER_LIBRARIES tsan) - endif() - add_definitions(-DSANITIZER=TSAN) - endif() - endif() - - if (perf) - add_compile_options(-fno-omit-frame-pointer) - endif() - - ############################################################ - - add_definitions( - -DOPENSSL_NO_SSL2 - -DDEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER - -DHAVE_USLEEP=1 - -DSOCI_HAVE_CXX_C11=1 - -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS - -DBOOST_NO_AUTO_PTR - -DBOOST_BEAST_ALLOW_DEPRECATED - -DBOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS - ) - - # `ripple.pb.h`, generated from protobuf triggers some warnings - # Set the directory that file lives in as SYSTEM - include_directories(SYSTEM ${CMAKE_BINARY_DIR}) - - if (is_gcc) - add_compile_options(-Wno-unused-but-set-variable -Wno-deprecated) - append_flags(CMAKE_CXX_FLAGS -Wsuggest-override) - - # use gold linker if available - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version - ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) - # NOTE: THE gold linker inserts -rpath as DT_RUNPATH by default - # intead of DT_RPATH, so you might have slightly unexpected - # runtime ld behavior if you were expecting DT_RPATH. - # Specify --disable-new-dtags to gold if you do not want - # the default DT_RUNPATH behavior. This rpath treatment as well - # as static/dynamic selection means that gold does not currently - # have ideal default behavior when we are using jemalloc. Thus - # for simplicity we don't use it when jemalloc is requested. - # An alternative to disabling would be to figure out all the settings - # required to make gold play nicely with jemalloc. - if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc)) - append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=gold -Wl,--no-as-needed) - endif () - unset(LD_VERSION) - endif() - - # Generator expressions are not supported in add_definitions, use set_property instead - set_property( - DIRECTORY - APPEND - PROPERTY COMPILE_DEFINITIONS - $<$,$>:DEBUG _DEBUG>) - - if (NOT assert) - set_property( - DIRECTORY - APPEND - PROPERTY COMPILE_DEFINITIONS - $<$,$,$>:NDEBUG>) - else() - # CMAKE_CXX_FLAGS_RELEASE is created by CMake for most / all generators - # with defaults including /DNDEBUG or -DNDEBUG, and that value is stored - # in the cache. Override that locally so that the cache value will be - # avaiable if "assert" is ever changed. - STRING(REGEX REPLACE "[-/]DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - STRING(REGEX REPLACE "[-/]DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASECLASSIC "${CMAKE_CXX_FLAGS_RELEASECLASSIC}") - STRING(REGEX REPLACE "[-/]DNDEBUG" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") - STRING(REGEX REPLACE "[-/]DNDEBUG" "" CMAKE_C_FLAGS_RELEASECLASSIC "${CMAKE_C_FLAGS_RELEASECLASSIC}") - endif() - - if (jemalloc) - find_package(jemalloc REQUIRED) - add_definitions(-DPROFILE_JEMALLOC) - include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS}) - link_libraries(${JEMALLOC_LIBRARIES}) - get_filename_component(JEMALLOC_LIB_PATH ${JEMALLOC_LIBRARIES} DIRECTORY) - set(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${JEMALLOC_LIB_PATH}) - endif() - - if (NOT WIN32) - add_definitions(-D_FILE_OFFSET_BITS=64) - append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof -Wdeprecated -Wnon-virtual-dtor - -DBOOST_COROUTINE_NO_DEPRECATION_WARNING -DBOOST_COROUTINES_NO_DEPRECATION_WARNING) - add_compile_options(-Wall -Wno-sign-compare -Wno-char-subscripts -Wno-format - -Wno-unused-local-typedefs -g) - # There seems to be an issue using generator experssions with multiple values, - # split the expression - add_compile_options($<$,$>:-O3>) - add_compile_options($<$,$>:-fno-strict-aliasing>) - append_flags(CMAKE_EXE_LINKER_FLAGS -rdynamic -g) - - if (is_clang) - add_compile_options( - -Wno-redeclared-class-member -Wno-mismatched-tags -Wno-deprecated-register) - add_definitions(-DBOOST_ASIO_HAS_STD_ARRAY) - - # use ldd linker if available - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version - ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) - if ("${LD_VERSION}" MATCHES "LLD") - append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=lld) - endif () - unset(LD_VERSION) - endif() - - if (APPLE) - add_compile_options( - -Wno-deprecated-declarations -Wno-unused-function) - endif() - - if (is_gcc) - add_compile_options(-Wno-unused-but-set-variable -Wno-unused-local-typedefs) - add_compile_options($<$,$>:-O0>) - endif (is_gcc) - else(NOT WIN32) - add_compile_options( - /bigobj # Increase object file max size - /EHa # ExceptionHandling all - /fp:precise # Floating point behavior - /Gd # __cdecl calling convention - /Gm- # Minimal rebuild: disabled - /GR # Enable RTTI - /Gy- # Function level linking: disabled - /FS - /MP # Multiprocessor compilation - /openmp- # pragma omp: disabled - /Zc:forScope # Language conformance: for scope - /Zi # Generate complete debug info - /errorReport:none # No error reporting to Internet - /nologo # Suppress login banner - /W3 # Warning level 3 - /WX- # Disable warnings as errors - /wd4018 # Disable signed/unsigned comparison warnings - /wd4244 # Disable float to int possible loss of data warnings - /wd4267 # Disable size_t to T possible loss of data warnings - /wd4800 # Disable C4800(int to bool performance) - /wd4503 # Decorated name length exceeded, name was truncated - ) - add_definitions( - -D_WIN32_WINNT=0x6000 - -D_SCL_SECURE_NO_WARNINGS - -D_CRT_SECURE_NO_WARNINGS - -DWIN32_CONSOLE - -DNOMINMAX - -DBOOST_COROUTINE_NO_DEPRECATION_WARNING - -DBOOST_COROUTINES_NO_DEPRECATION_WARNING) - append_flags(CMAKE_EXE_LINKER_FLAGS - /DEBUG - /DYNAMICBASE - /ERRORREPORT:NONE - /MACHINE:X64 - /MANIFEST - /nologo - /NXCOMPAT - /SUBSYSTEM:CONSOLE - /TLBID:1) - - - # There seems to be an issue using generator experssions with multiple values, - # split the expression - # /GS Buffers security check: enable - add_compile_options($<$,$>:/GS>) - # /MTd Language: Multi-threaded Debug CRT - add_compile_options($<$,$>:/MTd>) - # /Od Optimization: Disabled - add_compile_options($<$,$>:/Od>) - # /RTC1 Run-time error checks: - add_compile_options($<$,$>:/RTC1>) - - # Generator expressions are not supported in add_definitions, use set_property instead - set_property( - DIRECTORY - APPEND - PROPERTY COMPILE_DEFINITIONS - $<$,$>:_CRTDBG_MAP_ALLOC>) - - # /MT Language: Multi-threaded CRT - add_compile_options($<$,$>:/MT>) - add_compile_options($<$,$>:/Ox>) - # /Ox Optimization: Full - - endif (NOT WIN32) - - if (static) - append_flags(CMAKE_EXE_LINKER_FLAGS -static-libstdc++) - # set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_START_STATIC 1) - # set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_END_STATIC 1) - endif() - - ## The following options were migrated from the erstwhile BeastConfig.h - ## Some of these should be considered for removal in the future if - ## unused or unmaintained - - # beast_no_unit_test_inline - # Prevents unit test definitions from being inserted into a global table - if (beast_no_unit_test_inline) - add_definitions(-DBEAST_NO_UNIT_TEST_INLINE=1) - endif() - - # beast_force_debug - # Force BEAST_DEBUG behavior regardless of other compiler settings - if (beast_force_debug) - add_definitions(-DBEAST_FORCE_DEBUG=1) - endif() - - # beast_check_mem_leaks - # Force BEAST_CHECK_MEMORY_LEAKS to be ON. Default is ON only for debug - # builds. Only implemeted for windows builds. - if (beast_check_mem_leaks) - add_definitions(-DBEAST_CHECK_MEMORY_LEAKS=1) - elseif(DEFINED beast_check_mem_leaks) - add_definitions(-DBEAST_CHECK_MEMORY_LEAKS=0) - endif() - - if (WIN32) - # beast_disable_auto_link - # Disables autolinking of system library dependencies on windows - if (beast_disable_auto_link) - add_definitions(-DBEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1) - endif() - endif() - - # dump_leaks_on_exit - # Displays heap blocks and counted objects which were not disposed of - # during exit. Only implemented for windows builds. - if (DEFINED dump_leaks_on_exit AND NOT dump_leaks_on_exit) - add_definitions(-DRIPPLE_DUMP_LEAKS_ON_EXIT=0) - else () - add_definitions(-DRIPPLE_DUMP_LEAKS_ON_EXIT=1) - endif() - - # NOTE - THIS OPTION CURRENTLY DOES NOT COMPILE !! - # verify_nodeobject_keys - # This verifies that the hash of node objects matches the payload. - # This check is expensive - use with caution. - if (verify_nodeobject_keys) - add_definitions(-DRIPPLE_VERIFY_NODEOBJECT_KEYS=1) - endif() - - # single_io_service_thread - # Restricts the number of threads calling io_service::run to one. - # This can be useful when debugging." - if (single_io_service_thread) - add_definitions(-DRIPPLE_SINGLE_IO_SERVICE_THREAD=1) - endif() - - # use_rocksdb - # Controls whether or not the RocksDB database back-end is compiled into - # rippled. RocksDB requires a relatively modern C++ compiler (tested with - # gcc versions 4.8.1 and later) that supports some C++11 features. The - # default is ON for modern unix compilers and OFF for everything else. - if (use_rocksdb) - add_definitions(-DRIPPLE_ROCKSDB_AVAILABLE=1) - elseif(DEFINED use_rocksdb) - add_definitions(-DRIPPLE_ROCKSDB_AVAILABLE=0) - endif() - -endmacro() - -############################################################ - -macro(create_build_folder cur_project) - if (NOT WIN32) - ADD_CUSTOM_TARGET(build_folder ALL - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Creating build output folder") - add_dependencies(${cur_project} build_folder) - endif() -endmacro() - -macro(set_startup_project cur_project) - if (WIN32 AND NOT ci) - if (CMAKE_VERSION VERSION_LESS 3.6) - message(WARNING - "Setting the VS startup project requires cmake 3.6 or later. Please upgrade.") - endif() - set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY - VS_STARTUP_PROJECT ${cur_project}) - endif() -endmacro() - -macro(link_common_libraries cur_project) - if (NOT MSVC) - target_link_libraries(${cur_project} ${Boost_LIBRARIES}) - target_link_libraries(${cur_project} dl) - target_link_libraries(${cur_project} Threads::Threads) - if (APPLE) - find_library(app_kit AppKit) - find_library(foundation Foundation) - target_link_libraries(${cur_project} - ${app_kit} ${foundation}) - else() - target_link_libraries(${cur_project} rt) - endif() - else(NOT MSVC) - target_link_libraries(${cur_project} - $<$,$>:VC/static/ssleay32MTd> - $<$,$>:VC/static/libeay32MTd>) - target_link_libraries(${cur_project} - $<$,$>:VC/static/ssleay32MT> - $<$,$>:VC/static/libeay32MT>) - target_link_libraries(${cur_project} - legacy_stdio_definitions.lib Shlwapi kernel32 user32 gdi32 winspool comdlg32 - advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32 crypt32) - endif (NOT MSVC) -endmacro() diff --git a/Builds/CMake/FindBoost.cmake b/Builds/CMake/FindBoost.cmake new file mode 100644 index 000000000..1771d1bc0 --- /dev/null +++ b/Builds/CMake/FindBoost.cmake @@ -0,0 +1,2098 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindBoost +# --------- +# +# Find Boost include dirs and libraries +# +# Use this module by invoking find_package with the form:: +# +# find_package(Boost +# [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0 +# [REQUIRED] # Fail with error if Boost is not found +# [COMPONENTS ...] # Boost libraries by their canonical name +# # e.g. "date_time" for "libboost_date_time" +# [OPTIONAL_COMPONENTS ...] +# # Optional Boost libraries by their canonical name) +# ) # e.g. "date_time" for "libboost_date_time" +# +# This module finds headers and requested component libraries OR a CMake +# package configuration file provided by a "Boost CMake" build. For the +# latter case skip to the "Boost CMake" section below. For the former +# case results are reported in variables:: +# +# Boost_FOUND - True if headers and requested libraries were found +# Boost_INCLUDE_DIRS - Boost include directories +# Boost_LIBRARY_DIRS - Link directories for Boost libraries +# Boost_LIBRARIES - Boost component libraries to be linked +# Boost__FOUND - True if component was found ( is upper-case) +# Boost__LIBRARY - Libraries to link for component (may include +# target_link_libraries debug/optimized keywords) +# Boost_VERSION - BOOST_VERSION value from boost/version.hpp +# Boost_LIB_VERSION - Version string appended to library filenames +# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) +# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) +# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) +# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) +# - Pass to add_definitions() to have diagnostic +# information about Boost's automatic linking +# displayed during compilation +# +# Note that Boost Python components require a Python version suffix +# (Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the +# versions built against Python 3.6 and 2.7, respectively. This also +# applies to additional components using Python including +# ``mpi_python`` and ``numpy``. Earlier Boost releases may use +# distribution-specific suffixes such as ``2``, ``3`` or ``2.7``. +# These may also be used as suffixes, but note that they are not +# portable. +# +# This module reads hints about search locations from variables:: +# +# BOOST_ROOT - Preferred installation prefix +# (or BOOSTROOT) +# BOOST_INCLUDEDIR - Preferred include directory e.g. /include +# BOOST_LIBRARYDIR - Preferred library directory e.g. /lib +# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not +# specified by these hint variables. Default is OFF. +# Boost_ADDITIONAL_VERSIONS +# - List of Boost versions not known to this module +# (Boost install locations may contain the version) +# +# and saves search results persistently in CMake cache entries:: +# +# Boost_INCLUDE_DIR - Directory containing Boost headers +# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries +# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries +# Boost__LIBRARY_DEBUG - Component library debug variant +# Boost__LIBRARY_RELEASE - Component library release variant +# +# The following :prop_tgt:`IMPORTED` targets are also defined:: +# +# Boost::boost - Target for header-only dependencies +# (Boost include directory) +# Boost:: - Target for specific component dependency +# (shared or static library); is lower- +# case +# Boost::diagnostic_definitions - interface target to enable diagnostic +# information about Boost's automatic linking +# during compilation (adds BOOST_LIB_DIAGNOSTIC) +# Boost::disable_autolinking - interface target to disable automatic +# linking with MSVC (adds BOOST_ALL_NO_LIB) +# Boost::dynamic_linking - interface target to enable dynamic linking +# linking with MSVC (adds BOOST_ALL_DYN_LINK) +# +# Implicit dependencies such as Boost::filesystem requiring +# Boost::system will be automatically detected and satisfied, even +# if system is not specified when using find_package and if +# Boost::system is not added to target_link_libraries. If using +# Boost::thread, then Threads::Threads will also be added automatically. +# +# It is important to note that the imported targets behave differently +# than variables created by this module: multiple calls to +# find_package(Boost) in the same directory or sub-directories with +# different options (e.g. static or shared) will not override the +# values of the targets created by the first call. +# +# Users may set these hints or results as cache entries. Projects +# should not read these entries directly but instead use the above +# result variables. Note that some hint names start in upper-case +# "BOOST". One may specify these as environment variables if they are +# not specified as CMake variables or cache entries. +# +# This module first searches for the Boost header files using the above +# hint variables (excluding BOOST_LIBRARYDIR) and saves the result in +# Boost_INCLUDE_DIR. Then it searches for requested component libraries +# using the above hints (excluding BOOST_INCLUDEDIR and +# Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, +# and the library name configuration settings below. It saves the +# library directories in Boost_LIBRARY_DIR_DEBUG and +# Boost_LIBRARY_DIR_RELEASE and individual library +# locations in Boost__LIBRARY_DEBUG and Boost__LIBRARY_RELEASE. +# When one changes settings used by previous searches in the same build +# tree (excluding environment variables) this module discards previous +# search results affected by the changes and searches again. +# +# Boost libraries come in many variants encoded in their file name. +# Users or projects may tell this module which variant to find by +# setting variables:: +# +# Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search +# and use the debug libraries. Default is ON. +# Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search +# and use the release libraries. Default is ON. +# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded +# libraries ('mt' tag). Default is ON. +# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static +# libraries. Default is OFF. +# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked statically to the C++ runtime +# ('s' tag). Default is platform dependent. +# Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked to the MS debug C++ runtime +# ('g' tag). Default is ON. +# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a +# debug Python build ('y' tag). Default is OFF. +# Boost_USE_STLPORT - Set to ON to use libraries compiled with +# STLPort ('p' tag). Default is OFF. +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# - Set to ON to use libraries compiled with +# STLPort deprecated "native iostreams" +# ('n' tag). Default is OFF. +# Boost_COMPILER - Set to the compiler-specific library suffix +# (e.g. "-gcc43"). Default is auto-computed +# for the C++ compiler in use. A list may be +# used if multiple compatible suffixes should +# be tested for, in decreasing order of +# preference. +# Boost_THREADAPI - Suffix for "thread" component library name, +# such as "pthread" or "win32". Names with +# and without this suffix will both be tried. +# Boost_NAMESPACE - Alternate namespace used to build boost with +# e.g. if set to "myboost", will search for +# myboost_thread instead of boost_thread. +# +# Other variables one may set to control this module are:: +# +# Boost_DEBUG - Set to ON to enable debug output from FindBoost. +# Please enable this before filing any bug report. +# Boost_DETAILED_FAILURE_MSG +# - Set to ON to add detailed information to the +# failure message even when the REQUIRED option +# is not given to the find_package call. +# Boost_REALPATH - Set to ON to resolve symlinks for discovered +# libraries to assist with packaging. For example, +# the "system" component library may be resolved to +# "/usr/lib/libboost_system.so.1.67.0" instead of +# "/usr/lib/libboost_system.so". This does not +# affect linking and should not be enabled unless +# the user needs this information. +# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and +# Boost_LIBRARY_DIR_DEBUG. +# +# On Visual Studio and Borland compilers Boost headers request automatic +# linking to corresponding libraries. This requires matching libraries +# to be linked explicitly or available in the link library search path. +# In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve +# dynamic linking. Boost automatic linking typically requests static +# libraries with a few exceptions (such as Boost.Python). Use:: +# +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# +# to ask Boost to report information about automatic linking requests. +# +# Example to find Boost headers only:: +# +# find_package(Boost 1.36.0) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# +# Example to find Boost libraries and use imported targets:: +# +# find_package(Boost 1.56 REQUIRED COMPONENTS +# date_time filesystem iostreams) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::date_time Boost::filesystem +# Boost::iostreams) +# +# Example to find Boost Python 3.6 libraries and use imported targets:: +# +# find_package(Boost 1.67 REQUIRED COMPONENTS +# python36 numpy36) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::python36 Boost::numpy36) +# +# Example to find Boost headers and some *static* (release only) libraries:: +# +# set(Boost_USE_STATIC_LIBS ON) # only find static libs +# set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and +# set(Boost_USE_RELEASE_LIBS ON) # only find release libs +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# Boost CMake +# ^^^^^^^^^^^ +# +# If Boost was built using the boost-cmake project it provides a package +# configuration file for use with find_package's Config mode. This +# module looks for the package configuration file called +# BoostConfig.cmake or boost-config.cmake and stores the result in cache +# entry "Boost_DIR". If found, the package configuration file is loaded +# and this module returns with no further action. See documentation of +# the Boost CMake package configuration for details on what it provides. +# +# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. + +# Save project's policies +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + +#------------------------------------------------------------------------------- +# Before we go searching, check whether boost-cmake is available, unless the +# user specifically asked NOT to search for boost-cmake. +# +# If Boost_DIR is set, this behaves as any find_package call would. If not, +# it looks at BOOST_ROOT and BOOSTROOT to find Boost. +# +if (NOT Boost_NO_BOOST_CMAKE) + # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives, + # since these are more conventional for Boost. + if ("$ENV{Boost_DIR}" STREQUAL "") + if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") + set(ENV{Boost_DIR} $ENV{BOOST_ROOT}) + elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "") + set(ENV{Boost_DIR} $ENV{BOOSTROOT}) + endif() + endif() + + # Do the same find_package call but look specifically for the CMake version. + # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no + # need to delegate them to this find_package call. + find_package(Boost QUIET NO_MODULE) + mark_as_advanced(Boost_DIR) + + # If we found boost-cmake, then we're done. Print out what we found. + # Otherwise let the rest of the module try to find it. + if (Boost_FOUND) + message(STATUS "Boost ${Boost_FIND_VERSION} found.") + if (Boost_FIND_COMPONENTS) + message(STATUS "Found Boost components:\n ${Boost_FIND_COMPONENTS}") + endif() + # Restore project's policies + cmake_policy(POP) + return() + endif() +endif() + + +#------------------------------------------------------------------------------- +# FindBoost functions & macros +# + +############################################ +# +# Check the existence of the libraries. +# +############################################ +# This macro was taken directly from the FindQt4.cmake file that is included +# with the CMake distribution. This is NOT my work. All work was done by the +# original authors of the FindQt4.cmake file. Only minor modifications were +# made to remove references to Qt and make this file more generally applicable +# And ELSE/ENDIF pairs were removed for readability. +######################################################################### + +macro(_Boost_ADJUST_LIB_VARS basename) + if(Boost_INCLUDE_DIR ) + if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig OR CMAKE_BUILD_TYPE) + set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + else() + # For single-config generators where CMAKE_BUILD_TYPE has no value, + # just use the release libraries + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + endif() + # FIXME: This probably should be set for both cases + set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + endif() + + # if only the release version was found, set the debug variable also to the release version + if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) + set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) + endif() + + # if only the debug version was found, set the release variable also to the debug version + if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) + set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) + endif() + + # If the debug & release library ends up being the same, omit the keywords + if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL "${Boost_${basename}_LIBRARY_DEBUG}") + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} ) + endif() + + if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER) + set(Boost_${basename}_FOUND ON) + if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads) + string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)") + set(Boost_THREAD_FOUND OFF) + endif() + endif() + + endif() + # Make variables changeable to the advanced user + mark_as_advanced( + Boost_${basename}_LIBRARY_RELEASE + Boost_${basename}_LIBRARY_DEBUG + ) +endmacro() + +# Detect changes in used variables. +# Compares the current variable value with the last one. +# In short form: +# v != v_LAST -> CHANGED = 1 +# v is defined, v_LAST not -> CHANGED = 1 +# v is not defined, but v_LAST is -> CHANGED = 1 +# otherwise -> CHANGED = 0 +# CHANGED is returned in variable named ${changed_var} +macro(_Boost_CHANGE_DETECT changed_var) + set(${changed_var} 0) + foreach(v ${ARGN}) + if(DEFINED _Boost_COMPONENTS_SEARCHED) + if(${v}) + if(_${v}_LAST) + string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) + else() + set(_${v}_CHANGED 1) + endif() + elseif(_${v}_LAST) + set(_${v}_CHANGED 1) + endif() + if(_${v}_CHANGED) + set(${changed_var} 1) + endif() + else() + set(_${v}_CHANGED 0) + endif() + endforeach() +endmacro() + +# +# Find the given library (var). +# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds +# +macro(_Boost_FIND_LIBRARY var build_type) + + find_library(${var} ${ARGN}) + + if(${var}) + # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. + if(NOT Boost_LIBRARY_DIR_${build_type}) + get_filename_component(_dir "${${var}}" PATH) + set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE) + endif() + elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. + find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) + endif() + + # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. + if(Boost_LIBRARY_DIR_${build_type}) + set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}" + " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}") + endif() + endif() +endmacro() + +#------------------------------------------------------------------------------- + +# +# Runs compiler with "-dumpversion" and parses major/minor +# version with a regex. +# +function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1\\2" + _boost_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + + set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) +endfunction() + +# +# Take a list of libraries with "thread" in it +# and prepend duplicates with "thread_${Boost_THREADAPI}" +# at the front of the list +# +function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) + set(_orig_libnames ${ARGN}) + string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}") + set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) +endfunction() + +# +# If a library is found, replace its cache entry with its REALPATH +# +function(_Boost_SWAP_WITH_REALPATH _library _docstring) + if(${_library}) + get_filename_component(_boost_filepathreal ${${_library}} REALPATH) + unset(${_library} CACHE) + set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") + endif() +endfunction() + +function(_Boost_CHECK_SPELLING _var) + if(${_var}) + string(TOUPPER ${_var} _var_UC) + message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.") + endif() +endfunction() + +# Guesses Boost's compiler prefix used in built library names +# Returns the guess by setting the variable pointed to by _ret +function(_Boost_GUESS_COMPILER_PREFIX _ret) + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") + if(WIN32) + set (_boost_COMPILER "-iw") + else() + set (_boost_COMPILER "-il") + endif() + elseif (GHSMULTI) + set(_boost_COMPILER "-ghs") + elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) + set(_boost_COMPILER "-vc141;-vc140") + elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + set(_boost_COMPILER "-vc140") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) + set(_boost_COMPILER "-vc120") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + set(_boost_COMPILER "-vc110") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + set(_boost_COMPILER "-vc100") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + set(_boost_COMPILER "-vc90") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + set(_boost_COMPILER "-vc80") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) + set(_boost_COMPILER "-vc71") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck! + set(_boost_COMPILER "-vc7") # yes, this is correct + else() # VS 6.0 Good luck! + set(_boost_COMPILER "-vc6") # yes, this is correct + endif() + elseif (BORLAND) + set(_boost_COMPILER "-bcb") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + set(_boost_COMPILER "-sw") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL") + set(_boost_COMPILER "-xlc") + elseif (MINGW) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + endif() + elseif (UNIX) + if (CMAKE_COMPILER_IS_GNUCXX) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + # Determine which version of GCC we have. + if(APPLE) + if(Boost_MINOR_VERSION) + if(${Boost_MINOR_VERSION} GREATER 35) + # In Boost 1.36.0 and newer, the mangled compiler name used + # on Mac OS X/Darwin is "xgcc". + set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") + else() + # In Boost <= 1.35.0, there is no mangled compiler name for + # the Mac OS X/Darwin version of GCC. + set(_boost_COMPILER "") + endif() + else() + # We don't know the Boost version, so assume it's + # pre-1.36.0. + set(_boost_COMPILER "") + endif() + else() + set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") + endif() + endif() + endif () + else() + # TODO at least Boost_DEBUG here? + set(_boost_COMPILER "") + endif() + set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) +endfunction() + +# +# Get component dependencies. Requires the dependencies to have been +# defined for the Boost release version. +# +# component - the component to check +# _ret - list of library dependencies +# +function(_Boost_COMPONENT_DEPENDENCIES component _ret) + # Note: to add a new Boost release, run + # + # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake + # + # The output may be added in a new block below. If it's the same as + # the previous release, simply update the version range of the block + # for the previous release. Also check if any new components have + # been added, and add any new components to + # _Boost_COMPONENT_HEADERS. + # + # This information was originally generated by running + # BoostScanDeps.cmake against every boost release to date supported + # by FindBoost: + # + # % for version in /path/to/boost/sources/* + # do + # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake + # done + # + # The output was then updated by search and replace with these regexes: + # + # - Strip message(STATUS) prefix dashes + # s;^-- ;; + # - Indent + # s;^set(; set(;; + # - Add conditionals + # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); + # + # This results in the logic seen below, but will require the xxxx + # replacing with the following Boost release version (or the next + # minor version to be released, e.g. 1.59 was the latest at the time + # of writing, making 1.60 the next, so 106000 is the needed version + # number). Identical consecutive releases were then merged together + # by updating the end range of the first block and removing the + # following redundant blocks. + # + # Running the script against all historical releases should be + # required only if the BoostScanDeps.cmake script logic is changed. + # The addition of a new release should only require it to be run + # against the new release. + + # Handle Python version suffixes + if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") + set(component "${CMAKE_MATCH_1}") + set(component_python_version "${CMAKE_MATCH_2}") + endif() + + set(_Boost_IMPORTED_TARGETS TRUE) + if(Boost_VERSION VERSION_LESS 103300) + message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)") + set(_Boost_IMPORTED_TARGETS FALSE) + elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) + set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) + set(_Boost_REGEX_DEPENDENCIES thread) + set(_Boost_WAVE_DEPENDENCIES filesystem thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106100 AND Boost_VERSION VERSION_LESS 106200) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106300 AND Boost_VERSION VERSION_LESS 106500) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + else() + if(NOT Boost_VERSION VERSION_LESS 106700) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + endif() + if(NOT Boost_VERSION VERSION_LESS 106800) + message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") + endif() + endif() + + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") + if (NOT _boost_DEPS_STRING) + set(_boost_DEPS_STRING "(none)") + endif() + # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + +# +# Get component headers. This is the primary header (or headers) for +# a given component, and is used to check that the headers are present +# as well as the library itself as an extra sanity check of the build +# environment. +# +# component - the component to check +# _hdrs +# +function(_Boost_COMPONENT_HEADERS component _hdrs) + # Handle Python version suffixes + if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") + set(component "${CMAKE_MATCH_1}") + set(component_python_version "${CMAKE_MATCH_2}") + endif() + + # Note: new boost components will require adding here. The header + # must be present in all versions of Boost providing a library. + set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") + set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") + set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") + set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") + set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") + set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") + set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") + set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp") + set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp") + set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp") + set(_Boost_GRAPH_PARALLEL_HEADERS "boost/graph/adjacency_list.hpp") + set(_Boost_IOSTREAMS_HEADERS "boost/iostreams/stream.hpp") + set(_Boost_LOCALE_HEADERS "boost/locale.hpp") + set(_Boost_LOG_HEADERS "boost/log/core.hpp") + set(_Boost_LOG_SETUP_HEADERS "boost/log/detail/setup_config.hpp") + set(_Boost_MATH_HEADERS "boost/math_fwd.hpp") + set(_Boost_MATH_C99_HEADERS "boost/math/tr1.hpp") + set(_Boost_MATH_C99F_HEADERS "boost/math/tr1.hpp") + set(_Boost_MATH_C99L_HEADERS "boost/math/tr1.hpp") + set(_Boost_MATH_TR1_HEADERS "boost/math/tr1.hpp") + set(_Boost_MATH_TR1F_HEADERS "boost/math/tr1.hpp") + set(_Boost_MATH_TR1L_HEADERS "boost/math/tr1.hpp") + set(_Boost_MPI_HEADERS "boost/mpi.hpp") + set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") + set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") + set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") + set(_Boost_PROGRAM_OPTIONS_HEADERS "boost/program_options.hpp") + set(_Boost_PYTHON_HEADERS "boost/python.hpp") + set(_Boost_RANDOM_HEADERS "boost/random.hpp") + set(_Boost_REGEX_HEADERS "boost/regex.hpp") + set(_Boost_SERIALIZATION_HEADERS "boost/serialization/serialization.hpp") + set(_Boost_SIGNALS_HEADERS "boost/signals.hpp") + set(_Boost_SYSTEM_HEADERS "boost/system/config.hpp") + set(_Boost_TEST_EXEC_MONITOR_HEADERS "boost/test/test_exec_monitor.hpp") + set(_Boost_THREAD_HEADERS "boost/thread.hpp") + set(_Boost_TIMER_HEADERS "boost/timer.hpp") + set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") + set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") + set(_Boost_WAVE_HEADERS "boost/wave.hpp") + set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") + if(WIN32) + set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") + set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") + endif() + + string(TOUPPER ${component} uppercomponent) + set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) + + string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}") + if (NOT _boost_HDRS_STRING) + set(_boost_HDRS_STRING "(none)") + endif() + # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}") +endfunction() + +# +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# extravar - the indirect dependency list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar extravar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components)) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(_boost_extra_components ${_boost_processed_components}) + if(_boost_extra_components AND ${componentvar}) + list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) + endif() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) + set(${extravar} ${_boost_extra_components} PARENT_SCOPE) +endfunction() + +# +# Some boost libraries may require particular set of compler features. +# The very first one was `boost::fiber` introduced in Boost 1.62. +# One can check required compiler features of it in +# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`. +# +function(_Boost_COMPILER_FEATURES component _ret) + # Boost >= 1.62 and < 1.67 + if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106700) + set(_Boost_FIBER_COMPILER_FEATURES + cxx_alias_templates + cxx_auto_type + cxx_constexpr + cxx_defaulted_functions + cxx_final + cxx_lambdas + cxx_noexcept + cxx_nullptr + cxx_rvalue_references + cxx_thread_local + cxx_variadic_templates + ) + endif() + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) +endfunction() + +# +# Update library search directory hint variable with paths used by prebuilt boost binaries. +# +# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) +# have library directories named using MSVC compiler version and architecture. +# This function would append corresponding directories if MSVC is a current compiler, +# so having `BOOST_ROOT` would be enough to specify to find everything. +# +function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir) + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_arch_suffix 64) + else() + set(_arch_suffix 32) + endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0) + endif() + set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE) + endif() +endfunction() + +# +# End functions/macros +# +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# main. +#------------------------------------------------------------------------------- + + +# If the user sets Boost_LIBRARY_DIR, use it as the default for both +# configurations. +if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR) + set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}") +endif() +if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR) + set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}") +endif() + +if(NOT DEFINED Boost_USE_DEBUG_LIBS) + set(Boost_USE_DEBUG_LIBS TRUE) +endif() +if(NOT DEFINED Boost_USE_RELEASE_LIBS) + set(Boost_USE_RELEASE_LIBS TRUE) +endif() +if(NOT DEFINED Boost_USE_MULTITHREADED) + set(Boost_USE_MULTITHREADED TRUE) +endif() +if(NOT DEFINED Boost_USE_DEBUG_RUNTIME) + set(Boost_USE_DEBUG_RUNTIME TRUE) +endif() + +# Check the version of Boost against the requested version. +if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) + message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") +endif() + +if(Boost_FIND_VERSION_EXACT) + # The version may appear in a directory with or without the patch + # level, even when the patch level is non-zero. + set(_boost_TEST_VERSIONS + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") +else() + # The user has not requested an exact version. Among known + # versions, find those that are acceptable to the user request. + # + # Note: When adding a new Boost release, also update the dependency + # information in _Boost_COMPONENT_DEPENDENCIES and + # _Boost_COMPONENT_HEADERS. See the instructions at the top of + # _Boost_COMPONENT_DEPENDENCIES. + set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" + "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" + "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" + "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" + "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" + "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" + "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" + "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" + "1.34" "1.33.1" "1.33.0" "1.33") + + set(_boost_TEST_VERSIONS) + if(Boost_FIND_VERSION) + set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + # Select acceptable versions. + foreach(version ${_Boost_KNOWN_VERSIONS}) + if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") + # This version is high enough. + list(APPEND _boost_TEST_VERSIONS "${version}") + elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") + # This version is a short-form for the requested version with + # the patch level dropped. + list(APPEND _boost_TEST_VERSIONS "${version}") + endif() + endforeach() + else() + # Any version is acceptable. + set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") + endif() +endif() + +# The reason that we failed to find Boost. This will be set to a +# user-friendly message when we fail to find some necessary piece of +# Boost. +set(Boost_ERROR_REASON) + +if(Boost_DEBUG) + # Output some of their choices + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") +endif() + +# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It +# will only contain any interface definitions on WIN32, but is created +# on all platforms to keep end user code free from platform dependent +# code. Also provide convenience targets to disable autolinking and +# enable dynamic linking. +if(NOT TARGET Boost::diagnostic_definitions) + add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) + add_library(Boost::disable_autolinking INTERFACE IMPORTED) + add_library(Boost::dynamic_linking INTERFACE IMPORTED) +endif() +if(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::diagnostic_definitions PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::disable_autolinking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + set_target_properties(Boost::dynamic_linking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") +endif() + +_Boost_CHECK_SPELLING(Boost_ROOT) +_Boost_CHECK_SPELLING(Boost_LIBRARYDIR) +_Boost_CHECK_SPELLING(Boost_INCLUDEDIR) + +# Collect environment variable inputs as hints. Do not consider changes. +foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) + set(_env $ENV{${v}}) + if(_env) + file(TO_CMAKE_PATH "${_env}" _ENV_${v}) + else() + set(_ENV_${v} "") + endif() +endforeach() +if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) + set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") +endif() + +# Collect inputs and cached results. Detect changes since the last run. +if(NOT BOOST_ROOT AND BOOSTROOT) + set(BOOST_ROOT "${BOOSTROOT}") +endif() +set(_Boost_VARS_DIR + BOOST_ROOT + Boost_NO_SYSTEM_PATHS + ) + +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Declared as CMake or Environmental Variables:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_ROOT = ${BOOST_ROOT}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") +endif() + +# ------------------------------------------------------------------------ +# Search for Boost include DIR +# ------------------------------------------------------------------------ + +set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) +_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) +# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the +# location did. We will find a new one based on the new inputs. +if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) + unset(Boost_INCLUDE_DIR CACHE) +endif() + +if(NOT Boost_INCLUDE_DIR) + set(_boost_INCLUDE_SEARCH_DIRS "") + if(BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) + elseif(_ENV_BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) + endif() + + if( BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) + elseif( _ENV_BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) + endif() + + if( Boost_NO_SYSTEM_PATHS) + list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) + else() + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + foreach(ver ${_Boost_KNOWN_VERSIONS}) + string(REPLACE "." "_" ver "${ver}") + list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}") + endforeach() + endif() + list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS + C:/boost/include + C:/boost + /sw/local/include + ) + endif() + + # Try to find Boost by stepping backwards through the Boost versions + # we know about. + # Build a list of path suffixes for each version. + set(_boost_PATH_SUFFIXES) + foreach(_boost_VER ${_boost_TEST_VERSIONS}) + # Add in a path suffix, based on the required version, ideally + # we could read this from version.hpp, but for that to work we'd + # need to know the include dir already + set(_boost_BOOSTIFIED_VERSION) + + # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 + if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") + elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") + endif() + + list(APPEND _boost_PATH_SUFFIXES + "boost-${_boost_BOOSTIFIED_VERSION}" + "boost_${_boost_BOOSTIFIED_VERSION}" + "boost/boost-${_boost_BOOSTIFIED_VERSION}" + "boost/boost_${_boost_BOOSTIFIED_VERSION}" + ) + + endforeach() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Include debugging info:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") + endif() + + # Look for a standard boost header file. + find_path(Boost_INCLUDE_DIR + NAMES boost/config.hpp + HINTS ${_boost_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ) +endif() + +# ------------------------------------------------------------------------ +# Extract version information from version.hpp +# ------------------------------------------------------------------------ + +# Set Boost_FOUND based only on header location and version. +# It will be updated below for component libraries. +if(Boost_INCLUDE_DIR) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") + endif() + + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + set(Boost_VERSION 0) + set(Boost_LIB_VERSION "") + file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") + set(_Boost_VERSION_REGEX "([0-9]+)") + set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") + foreach(v VERSION LIB_VERSION) + if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") + set(Boost_${v} "${CMAKE_MATCH_1}") + endif() + endforeach() + unset(_boost_VERSION_HPP_CONTENTS) + + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + + string(APPEND Boost_ERROR_REASON + "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "version.hpp reveals boost " + "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + endif() + + if(Boost_FIND_VERSION) + # Set Boost_FOUND based on requested version. + set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "old") + elseif(Boost_FIND_VERSION_EXACT AND + NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "new") + else() + set(Boost_FOUND 1) + endif() + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + string(APPEND Boost_ERROR_REASON + "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) + string(APPEND Boost_ERROR_REASON + ".${Boost_FIND_VERSION_PATCH}") + endif () + if (NOT Boost_FIND_VERSION_EXACT) + string(APPEND Boost_ERROR_REASON " (or newer)") + endif () + string(APPEND Boost_ERROR_REASON ".") + endif () + else() + # Caller will accept any Boost version. + set(Boost_FOUND 1) + endif() +else() + set(Boost_FOUND 0) + string(APPEND Boost_ERROR_REASON + "Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") +endif() + +# ------------------------------------------------------------------------ +# Prefix initialization +# ------------------------------------------------------------------------ + +set(Boost_LIB_PREFIX "") +if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR + (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) + set(Boost_LIB_PREFIX "lib") +endif() + +if ( NOT Boost_NAMESPACE ) + set(Boost_NAMESPACE "boost") +endif() + +# ------------------------------------------------------------------------ +# Suffix initialization and compiler suffix detection. +# ------------------------------------------------------------------------ + +set(_Boost_VARS_NAME + Boost_NAMESPACE + Boost_COMPILER + Boost_THREADAPI + Boost_USE_DEBUG_PYTHON + Boost_USE_MULTITHREADED + Boost_USE_STATIC_LIBS + Boost_USE_STATIC_RUNTIME + Boost_USE_STLPORT + Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS + ) +_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) + +# Setting some more suffixes for the library +if (Boost_COMPILER) + set(_boost_COMPILER ${Boost_COMPILER}) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + endif() +else() + # Attempt to guess the compiler suffix + # NOTE: this is not perfect yet, if you experience any issues + # please report them and use the Boost_COMPILER variable + # to work around the problems. + _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "guessed _boost_COMPILER = ${_boost_COMPILER}") + endif() +endif() + +set (_boost_MULTITHREADED "-mt") +if( NOT Boost_USE_MULTITHREADED ) + set (_boost_MULTITHREADED "") +endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") +endif() + +#====================== +# Systematically build up the Boost ABI tag for the 'tagged' and 'versioned' layouts +# http://boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming +# http://boost.org/doc/libs/1_66_0/boost/config/auto_link.hpp +# http://boost.org/doc/libs/1_66_0/tools/build/src/tools/common.jam +# http://boost.org/doc/libs/1_66_0/boostcpp.jam +set( _boost_RELEASE_ABI_TAG "-") +set( _boost_DEBUG_ABI_TAG "-") +# Key Use this library when: +# s linking statically to the C++ standard library and +# compiler runtime support libraries. +if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") +endif() +# g using debug versions of the standard and runtime +# support libraries +if(WIN32 AND Boost_USE_DEBUG_RUNTIME) + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") + string(APPEND _boost_DEBUG_ABI_TAG "g") + endif() +endif() +# y using special debug build of python +if(Boost_USE_DEBUG_PYTHON) + string(APPEND _boost_DEBUG_ABI_TAG "y") +endif() +# d using a debug version of your code +string(APPEND _boost_DEBUG_ABI_TAG "d") +# p using the STLport standard library rather than the +# default one supplied with your compiler +if(Boost_USE_STLPORT) + string(APPEND _boost_RELEASE_ABI_TAG "p") + string(APPEND _boost_DEBUG_ABI_TAG "p") +endif() +# n using the STLport deprecated "native iostreams" feature +# removed from the documentation in 1.43.0 but still present in +# boost/config/auto_link.hpp +if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + string(APPEND _boost_RELEASE_ABI_TAG "n") + string(APPEND _boost_DEBUG_ABI_TAG "n") +endif() + +# -x86 Architecture and address model tag +# First character is the architecture, then word-size, either 32 or 64 +# Only used in 'versioned' layout, added in Boost 1.66.0 +set(_boost_ARCHITECTURE_TAG "") +# {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers +if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600) + string(APPEND _boost_ARCHITECTURE_TAG "-") + # This needs to be kept in-sync with the section of CMakePlatformId.h.in + # inside 'defined(_WIN32) && defined(_MSC_VER)' + if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "IA64") + string(APPEND _boost_ARCHITECTURE_TAG "i") + elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "X86" + OR ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "x64") + string(APPEND _boost_ARCHITECTURE_TAG "x") + elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} MATCHES "^ARM") + string(APPEND _boost_ARCHITECTURE_TAG "a") + elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "MIPS") + string(APPEND _boost_ARCHITECTURE_TAG "m") + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + string(APPEND _boost_ARCHITECTURE_TAG "64") + else() + string(APPEND _boost_ARCHITECTURE_TAG "32") + endif() +endif() + +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") +endif() + +# ------------------------------------------------------------------------ +# Begin finding boost libraries +# ------------------------------------------------------------------------ + +set(_Boost_VARS_LIB "") +foreach(c DEBUG RELEASE) + set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) + list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}}) + _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) + # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the + # location did. We will find a new one based on the new inputs. + if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) + unset(Boost_LIBRARY_DIR_${c} CACHE) + endif() + + # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. + if(Boost_LIBRARY_DIR_${c}) + set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + else() + set(_boost_LIBRARY_SEARCH_DIRS_${c} "") + if(BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR}) + elseif(_ENV_BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR}) + endif() + + if(BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}") + elseif(_ENV_BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}") + endif() + + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..") + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}") + if( Boost_NO_SYSTEM_PATHS ) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) + else() + foreach(ver ${_Boost_KNOWN_VERSIONS}) + string(REPLACE "." "_" ver "${ver}") + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}") + endforeach() + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost") + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS + C:/boost/lib + C:/boost + /sw/local/lib + ) + endif() + endif() +endforeach() + +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}" + "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") +endif() + +# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES +if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a) + endif() +endif() + +# We want to use the tag inline below without risking double dashes +if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") + endif() +endif() +if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") + endif() +endif() + +# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled +# on WIN32 was to: +# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) +# 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) +# We maintain this behavior since changing it could break people's builds. +# To disable the ambiguous behavior, the user need only +# set Boost_USE_STATIC_RUNTIME either ON or OFF. +set(_boost_STATIC_RUNTIME_WORKAROUND false) +if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND TRUE) + endif() +endif() + +# On versions < 1.35, remove the System library from the considered list +# since it wasn't added until 1.35. +if(Boost_VERSION AND Boost_FIND_COMPONENTS) + if(Boost_VERSION LESS 103500) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() +endif() + +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) + +# If thread is required, get the thread libs as a dependency +if("thread" IN_LIST Boost_FIND_COMPONENTS) + if(Boost_FIND_QUIETLY) + set(_Boost_find_quiet QUIET) + else() + set(_Boost_find_quiet "") + endif() + find_package(Threads ${_Boost_find_quiet}) + unset(_Boost_find_quiet) +endif() + +# If the user changed any of our control inputs flush previous results. +if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) + foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + foreach(c DEBUG RELEASE) + set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) + unset(${_var} CACHE) + set(${_var} "${_var}-NOTFOUND") + endforeach() + endforeach() + set(_Boost_COMPONENTS_SEARCHED "") +endif() + +foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # Compute component-specific hints. + set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") + if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR + ${COMPONENT} STREQUAL "graph_parallel") + foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) + if(IS_ABSOLUTE "${lib}") + get_filename_component(libdir "${lib}" PATH) + string(REPLACE "\\" "/" libdir "${libdir}") + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) + endif() + endforeach() + endif() + + # Handle Python version suffixes + unset(COMPONENT_PYTHON_VERSION_MAJOR) + unset(COMPONENT_PYTHON_VERSION_MINOR) + if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$") + set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") + set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") + elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$") + set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") + set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}") + endif() + + unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + if (COMPONENT_PYTHON_VERSION_MINOR) + # Boost >= 1.67 + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix) + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # Gentoo + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # RPMs + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + endif() + if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR) + # Boost < 1.67 + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}") + endif() + + # Consolidate and report component-specific hints. + if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Component-specific library search names for ${COMPONENT_NAME}: " + "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}") + endif() + endif() + if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Component-specific library search paths for ${COMPONENT}: " + "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") + endif() + endif() + + # + # Find headers + # + _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME) + # Look for a standard boost header file. + if(Boost_${UPPERCOMPONENT}_HEADER_NAME) + if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}") + set(Boost_${UPPERCOMPONENT}_HEADER ON) + else() + set(Boost_${UPPERCOMPONENT}_HEADER OFF) + endif() + else() + set(Boost_${UPPERCOMPONENT}_HEADER ON) + message(WARNING "No header defined for ${COMPONENT}; skipping header check") + endif() + + # + # Find RELEASE libraries + # + unset(_boost_RELEASE_NAMES) + foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) + endforeach() + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endforeach() + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + endforeach() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + endif() + + # if Boost_LIBRARY_DIR_RELEASE is not defined, + # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs + if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG) + list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG}) + endif() + + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") + + if(Boost_USE_RELEASE_LIBS) + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} + NAMES_PER_DIR + DOC "${_boost_docstring_release}" + ) + endif() + + # + # Find DEBUG libraries + # + unset(_boost_DEBUG_NAMES) + foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) + endforeach() + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endforeach() + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + endforeach() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + endif() + + # if Boost_LIBRARY_DIR_DEBUG is not defined, + # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs + if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE) + list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE}) + endif() + + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") + + if(Boost_USE_DEBUG_LIBS) + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} + NAMES_PER_DIR + DOC "${_boost_docstring_debug}" + ) + endif () + + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) + endif() + + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) + + # Check if component requires some compiler features + _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) + +endforeach() + +# Restore the original find library ordering +if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() + +# ------------------------------------------------------------------------ +# End finding boost libraries +# ------------------------------------------------------------------------ + +set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) +set(Boost_LIBRARY_DIRS) +if(Boost_LIBRARY_DIR_RELEASE) + list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE}) +endif() +if(Boost_LIBRARY_DIR_DEBUG) + list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG}) +endif() +if(Boost_LIBRARY_DIRS) + list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) +endif() + +# The above setting of Boost_FOUND was based only on the header files. +# Update it for the requested component libraries. +if(Boost_FOUND) + # The headers were found. Check for requested component libs. + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${UPPERCOMPONENT}_FOUND AND Boost_FIND_REQUIRED_${COMPONENT}) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + endif() + endforeach() + if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS) + # Optional indirect dependencies are not counted as missing. + list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS}) + endif() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + endif() + + if (_Boost_MISSING_COMPONENTS) + set(Boost_FOUND 0) + # We were unable to find some libraries, so generate a sensible + # error message that lists the libraries we were unable to find. + string(APPEND Boost_ERROR_REASON + "\nCould not find the following") + if(Boost_USE_STATIC_LIBS) + string(APPEND Boost_ERROR_REASON " static") + endif() + string(APPEND Boost_ERROR_REASON + " Boost libraries:\n") + foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + string(APPEND Boost_ERROR_REASON + " ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n") + endforeach() + + list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) + list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) + if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + string(APPEND Boost_ERROR_REASON + "No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + else () + string(APPEND Boost_ERROR_REASON + "Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + endif () + endif () + + if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + # Compatibility Code for backwards compatibility with CMake + # 2.4's FindBoost module. + + # Look for the boost library path. + # Note that the user may not have installed any libraries + # so it is quite possible the Boost_LIBRARY_DIRS may not exist. + set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + + if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() + + if("${_boost_LIB_DIR}" MATCHES "/include$") + # Strip off the trailing "/include" in the path. + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() + + if(EXISTS "${_boost_LIB_DIR}/lib") + string(APPEND _boost_LIB_DIR /lib) + elseif(EXISTS "${_boost_LIB_DIR}/stage/lib") + string(APPEND _boost_LIB_DIR "/stage/lib") + else() + set(_boost_LIB_DIR "") + endif() + + if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) + endif() + + endif() +else() + # Boost headers were not found so no components were found. + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND 0) + endforeach() +endif() + +# ------------------------------------------------------------------------ +# Add imported targets +# ------------------------------------------------------------------------ + +if(Boost_FOUND) + # For header-only libraries + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + endif() + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + if(Boost_${UPPERCOMPONENT}_FOUND) + if(Boost_USE_STATIC_LIBS) + add_library(Boost::${COMPONENT} STATIC IMPORTED) + else() + # Even if Boost_USE_STATIC_LIBS is OFF, we might have static + # libraries as a result. + add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) + endif() + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() + if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) + unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) + foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) + endforeach() + if(COMPONENT STREQUAL "thread") + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) + endif() + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + endif() + if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") + endif() + endif() + endif() + endforeach() +endif() + +# ------------------------------------------------------------------------ +# Notification to end user about what was found +# ------------------------------------------------------------------------ + +set(Boost_LIBRARIES "") +if(Boost_FOUND) + if(NOT Boost_FIND_QUIETLY) + message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() + endif() + foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) + string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + if( Boost_${UPPERCOMPONENT}_FOUND ) + if(NOT Boost_FIND_QUIETLY) + message (STATUS " ${COMPONENT}") + endif() + list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY}) + endif() + endforeach() +else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") + else() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in its requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") + endif() + endif() + endif() +endif() + +# Configure display of cache entries in GUI. +foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) + get_property(_type CACHE ${v} PROPERTY TYPE) + if(_type) + set_property(CACHE ${v} PROPERTY ADVANCED 1) + if("x${_type}" STREQUAL "xUNINITIALIZED") + if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") + set_property(CACHE ${v} PROPERTY TYPE STRING) + else() + set_property(CACHE ${v} PROPERTY TYPE PATH) + endif() + endif() + endif() +endforeach() + +# Record last used values of input variables so we can +# detect on the next run if the user changed them. +foreach(v + ${_Boost_VARS_INC} ${_Boost_VARS_LIB} + ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} + ) + if(DEFINED ${v}) + set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") + else() + unset(_${v}_LAST CACHE) + endif() +endforeach() + +# Maintain a persistent list of components requested anywhere since +# the last flush. +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") +list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) +list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) +list(SORT _Boost_COMPONENTS_SEARCHED) +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" + CACHE INTERNAL "Components requested for this build tree.") + +# Restore project's policies +cmake_policy(POP) diff --git a/Builds/CMake/RippleConfig.cmake b/Builds/CMake/RippleConfig.cmake new file mode 100644 index 000000000..f41232a91 --- /dev/null +++ b/Builds/CMake/RippleConfig.cmake @@ -0,0 +1,55 @@ +include (CMakeFindDependencyMacro) +# need to represent system dependencies of the lib here +#[=========================================================[ + Boost +#]=========================================================] +if (static OR APPLE OR MSVC) + set (Boost_USE_STATIC_LIBS ON) +endif () +set (Boost_USE_MULTITHREADED ON) +if (static OR MSVC) + set (Boost_USE_STATIC_RUNTIME ON) +else () + set (Boost_USE_STATIC_RUNTIME OFF) +endif () +find_dependency (Boost 1.67 + COMPONENTS + chrono + context + coroutine + date_time + filesystem + program_options + regex + serialization + system + thread) +#[=========================================================[ + OpenSSL +#]=========================================================] +if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR}) + find_program (HOMEBREW brew) + if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND") + execute_process (COMMAND ${HOMEBREW} --prefix openssl + OUTPUT_VARIABLE OPENSSL_ROOT_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif () +endif () + +if ((NOT DEFINED OPENSSL_ROOT) AND (DEFINED ENV{OPENSSL_ROOT})) + set (OPENSSL_ROOT $ENV{OPENSSL_ROOT}) +endif () +file (TO_CMAKE_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT) + +if (static OR APPLE OR MSVC) + set (OPENSSL_USE_STATIC_LIBS ON) +endif () +set (OPENSSL_MSVC_STATIC_RT ON) +find_dependency (OpenSSL 1.0.2 REQUIRED) +find_dependency (ZLIB) +if (TARGET ZLIB::ZLIB) + set_target_properties(OpenSSL::Crypto PROPERTIES + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) +endif () + +include ("${CMAKE_CURRENT_LIST_DIR}/RippleTargets.cmake") diff --git a/Builds/Test.py b/Builds/Test.py index 1a321c4b9..f42538d8f 100755 --- a/Builds/Test.py +++ b/Builds/Test.py @@ -60,12 +60,12 @@ IS_OS_X = platform.system().lower() == 'darwin' # CMake if IS_WINDOWS: CMAKE_UNITY_CONFIGS = ['Debug', 'Release'] - CMAKE_NONUNITY_CONFIGS = ['DebugClassic', 'ReleaseClassic'] + CMAKE_NONUNITY_CONFIGS = ['Debug', 'Release'] else: CMAKE_UNITY_CONFIGS = [] CMAKE_NONUNITY_CONFIGS = [] -CMAKE_UNITY_COMBOS = { '' : [['rippled', 'rippled_classic'], CMAKE_UNITY_CONFIGS], - '.nounity' : [['rippled', 'rippled_unity'], CMAKE_NONUNITY_CONFIGS] } +CMAKE_UNITY_COMBOS = { '' : [['rippled'], CMAKE_UNITY_CONFIGS], + '.nounity' : [['rippled'], CMAKE_NONUNITY_CONFIGS] } if IS_WINDOWS: CMAKE_DIR_TARGETS = { ('msvc' + unity,) : targets for unity, targets in @@ -204,7 +204,7 @@ def decodeString(line): else: return line.decode() -def shell(cmd, args=(), silent=False): +def shell(cmd, args=(), silent=False, cust_env=None): """"Execute a shell command and return the output.""" silent = ARGS.silent or silent verbose = not silent and ARGS.verbose @@ -219,6 +219,7 @@ def shell(cmd, args=(), silent=False): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + env=cust_env, shell=IS_WINDOWS) lines = [] count = 0 @@ -258,7 +259,25 @@ def run_cmake(directory, cmake_dir, args): args += ( '-GNinja', ) else: args += ( '-GVisual Studio 14 2015 Win64', ) - args += ( '-Dtarget=' + cmake_dir, os.path.join('..', '..', '..'), ) + # hack to extract cmake options/args from the legacy target format + if re.search('\.unity', cmake_dir): + args += ( '-Dunity=ON', ) + if re.search('\.nounity', cmake_dir): + args += ( '-Dunity=OFF', ) + if re.search('coverage', cmake_dir): + args += ( '-Dcoverage=ON', ) + if re.search('profile', cmake_dir): + args += ( '-Dprofile=ON', ) + if re.search('debug', cmake_dir): + args += ( '-DCMAKE_BUILD_TYPE=Debug', ) + if re.search('release', cmake_dir): + args += ( '-DCMAKE_BUILD_TYPE=Release', ) + if re.search('gcc', cmake_dir): + args += ( '-DCMAKE_C_COMPILER=gcc', '-DCMAKE_CXX_COMPILER=g++', ) + if re.search('clang', cmake_dir): + args += ( '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++', ) + + args += ( os.path.join('..', '..', '..'), ) resultcode, lines = shell('cmake', args) if resultcode: diff --git a/Builds/linux/README.md b/Builds/linux/README.md index 0afb56aa7..cb04b6dbf 100644 --- a/Builds/linux/README.md +++ b/Builds/linux/README.md @@ -104,15 +104,16 @@ cd my_build followed by: ``` -cmake -Dtarget=gcc.debug.unity .. +cmake -DCMAKE_BUILD_TYPE=Debug .. ``` -The target variable can be adjusted as needed for `gcc` vs `clang`, `debug` vs. -`release` and `unity` vs. `nounity` builds. `unity` builds are faster to -compile since they combine multiple sources into a single compiliation unit. -`nounity` builds can be helpful for detecting include omissions or for finding -other build-related issues, but aren't generally needed for testing and -running. +`CMAKE_BUILD_TYPE` can be changed as desired for `Debug` vs. +`Release` builds (all four standard cmake build types are supported). + +To select a different compiler (most likely gcc will be found by default), pass +`-DCMAKE_C_COMPILER=` and +`-DCMAKE_CXX_COMPILER=` when configuring. If you prefer, +you can instead set `CC` and `CXX` environment variables which cmake will honor. Once you have generated the build system, you can run the build via cmake: @@ -130,15 +131,94 @@ properly configured) or to run unit tests. #### Options During Configuration: -There are a number of config variables that our CMake files support. These -can be added to the cmake generation command as needed: +The CMake file defines a number of configure-time options which can be +examined by running `cmake-gui` or `ccmake` to generated the build. In +particular, the `unity` option allows you to select between the unity and +non-unity builds. `unity` builds are faster to compile since they combine +multiple sources into a single compiliation unit - this is the default if you +don't specify. `nounity` builds can be helpful for detecting include omissions +or for finding other build-related issues, but aren't generally needed for +testing and running. +* `-Dunity=ON` to enable/disable unity builds (defaults to ON) * `-Dassert=ON` to enable asserts * `-Djemalloc=ON` to enable jemalloc support for heap checking * `-Dsan=thread` to enable the thread sanitizer with clang * `-Dsan=address` to enable the address sanitizer with clang * `-Dstatic=ON` to enable static linking library dependencies +Several other infrequently used options are available - run `ccmake` or +`cmake-gui` for a list of all options. + +#### Optional Installation + +The rippled cmake build supports an installation target that will install +rippled as well as a support library that can be used to sign transactions. In +order to build and install the files, specify the `install` target when +building, e.g.: + +``` +cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/local .. +cmake --build . --target install -- -j +``` + +We recommend specifying `CMAKE_INSTALL_PREFIX` when configuring in order to +explicitly control the install location for your files. Without this setting, +cmake will typically install in `/usr/local`. It is also possible to "rehome" +the installation by specifying the `DESTDIR` env variable during the install phase, +e.g.: + +``` +DESTDIR=~/mylibs cmake --build . --target install -- -j +``` + +in which case, the files would be installed in the `CMAKE_INSTALL_PREFIX` within +the specified `DESTDIR` path. + +#### Signing Library + +If you want to use the signing support library to create an application, there +are two simple mechanisms with cmake + git that facilitate this. + +With either option below, you will have access to a library from the +rippled project that you can link to in your own project's CMakeLists.txt, e.g.: + +``` +target_link_libraries (my-signing-app Ripple::xrpl_core) +``` + +##### Option 1: git submodules + add_subdirectory + +First, add the rippled repo as a submodule to your project repo: + +``` +git submodule add -b master https://github.com/ripple/rippled.git vendor/rippled +``` + +change the `vendor/rippled` path as desired for your repo layout. Furthermore, +change the branch name if you want to track a different rippled branch, such +as `develop`. + +Second, to bring this submodule into your project, just add the rippled subdirectory: + +``` +add_subdirectory (vendor/rippled) +``` + +##### Option 2: installed rippled + find_package + +First, follow the "Optional Installation" instructions above to +build and install the desired version of rippled. + +To make use of the installed files, add the following to your CMakeLists.txt file: + +``` +set (CMAKE_MODULE_PATH /opt/local/lib/cmake/ripple ${CMAKE_MODULE_PATH}) +find_package(Ripple REQUIRED) +``` + +change the `/opt/local` module path above to match your chosen installation prefix. + ## Unit Tests (Recommended) `rippled` builds a set of unit tests into the server executable. To run these unit diff --git a/Builds/macos/README.md b/Builds/macos/README.md index 2e83b3c4f..59ad71851 100644 --- a/Builds/macos/README.md +++ b/Builds/macos/README.md @@ -142,21 +142,17 @@ cd my_build followed by: ``` -cmake -G "Unix Makefiles" -Dtarget=clang.debug.unity .. +cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. ``` or ``` -cmake -G "Ninja" -Dtarget=clang.debug.unity .. +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. ``` -The target variable can be adjusted as needed for `gcc` vs `clang`, `debug` vs. -`release` and `unity` vs. `nounity` builds. `unity` builds are faster to -compile since they combine multiple sources into a single compiliation unit. -`nounity` builds can be helpful for detecting include omissions or for finding -other build-related issues, but aren't generally needed for testing and -running. +`CMAKE_BUILD_TYPE` can be changed as desired for `Debug` vs. +`Release` builds (all four standard cmake build types are supported). Once you have generated the build system, you can run the build via cmake: @@ -190,16 +186,42 @@ cmake --build . -- -jobs 4 This will invoke the `xcodebuild` utility to compile the project. See `xcodebuild --help` for details about build options. +#### Optional installation + +If you'd like to install the artifacts of the build, we have preliminary +support for standard CMake installation targets. We recommend explicitly +setting the installation location when configuring, e.g.: + +``` +cmake -DCMAKE_INSTALL_PREFIX=/opt/local .. +``` + +(change the destination as desired), and then build the `install` target: + +``` +cmake --build . --target install -- -jobs 4 +``` + #### Options During Configuration: -There are a number of config variables that our CMake files support. These -can be added to the cmake generation command as needed: +The CMake file defines a number of configure-time options which can be +examined by running `cmake-gui` or `ccmake` to generated the build. In +particular, the `unity` option allows you to select between the unity and +non-unity builds. `unity` builds are faster to compile since they combine +multiple sources into a single compiliation unit - this is the default if you +don't specify. `nounity` builds can be helpful for detecting include omissions +or for finding other build-related issues, but aren't generally needed for +testing and running. +* `-Dunity=ON` to enable/disable unity builds (defaults to ON) * `-Dassert=ON` to enable asserts * `-Djemalloc=ON` to enable jemalloc support for heap checking * `-Dsan=thread` to enable the thread sanitizer with clang * `-Dsan=address` to enable the address sanitizer with clang +Several other infrequently used options are available - run `ccmake` or +`cmake-gui` for a list of all options. + ## Unit Tests (Recommended) `rippled` builds a set of unit tests into the server executable. To run these unit diff --git a/CMakeLists.txt b/CMakeLists.txt index b6c4e2c46..aff7999ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,506 +1,2026 @@ -# cmake support for building rippled. The rippled specific settings -# below can be set at the command line as `-D=`. -# -# * `target` is a period separated tuple from the sets -# {gcc,clang,msvc} x {debug, release} x {unity, nounity} x {coverage} x {profile} -# -# Example, build gcc debug nonunity build -# -Dtarget=gcc.debug.nounity -# Example, clang release unity build -# -Dtarget=clang.release.unity -# Example, visual studio debug unity build -# -Dtarget=msvc.release.unity -# Example, build gcc release unity build suited for profiling with perf -# -Dtarget=gcc.release.unity.profile -# Example, build gcc debug unity build suited for measuring code coverage -# with gcov -# -Dtarget=gcc.release.unity.coverage -# -# -# The default is a unity debug build using gcc (linux), clang (osx), and -# msvc (windows). -# -# Note the generated Visual Studio solution will always have two projects, -# one unity and one non-unity. If the `target` is unity, the default project -# will be named `rippled` and second non-default (non-unity) project -# will be called `rippled_classic`. Likewise, if the `target` is non-unity, -# the project will have a default project called `rippled` (now non-unity) -# and second non-default (unity) project `rippled_unity`. In either -# case, only the `rippled` build will be enabled by default. -# -# * `assert` whether to enable asserts in release build -# -# Example, enable asserts even in release builds -# -Dassert=True -# -# Default is not to enable asserts in release builds. -# -# * `san` enable clang sanitizers -# -# Example, enable thread sanitizer -# -Dsan=thread -# Example, enable address sanitizer -# -Dsan=address -# -# * `static`, on linux, link protobuf, openssl, libc++, and boost -# statically. -# -# Example, enable static linking -# -Dstatic=True -# -# * `jemalloc`, on linux, enables jemalloc for heap profiling. -# -# Example, enable jemalloc -# -Djemallc=True -# -######################################################### -# CMAKE_C_COMPILER and CMAKE_CXX_COMPILER must be defined -# before the project statement; However, the project -# statement will clear CMAKE_BUILD_TYPE. CACHE variables, -# along with the order of this code, are used to work -# around these constraints. -# -# Don't put any code above or in this block, unless it -# has similar constraints. -cmake_minimum_required(VERSION 3.1.0) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Builds/CMake") -include(CMakeFuncs) -set(openssl_min 1.0.2) -parse_target() -project(rippled) -######################################################### -if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - set(dir "build") - set(cmd "cmake") - if (target) - set(dir "${dir}/${target}") - set(cmd "${cmd} -Dtarget=${target}") - elseif(CMAKE_BUILD_TYPE) - set(dir "${dir}/${CMAKE_BUILD_TYPE}") - set(cmd "${cmd} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") - else() - set(dir "${dir}/default") - endif() - set(cmd "${cmd} ${CMAKE_SOURCE_DIR}") +cmake_minimum_required (VERSION 3.9.0) +set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake ${CMAKE_MODULE_PATH}) +include (CMakeFuncs) +include (CheckCXXCompilerFlag) +if (target) + message (WARNING + "The target option is deprecated and will be removed in a future release") + parse_target() +endif () +project (rippled) - message(FATAL_ERROR "Builds are not allowed in ${CMAKE_SOURCE_DIR}.\n" - "Instead:\n" - "1) Remove the CMakeCache.txt file and CMakeFiles directory " - "from ${CMAKE_SOURCE_DIR}.\n" - "2) Create a directory to hold your build files, for example: ${dir}.\n" - "3) Change to that directory.\n" - "4) Run cmake targetting ${CMAKE_SOURCE_DIR}, for example: ${cmd}") -endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND +#[===================================================================[ + convenience variables and sanity checks +#]===================================================================] + +get_property (is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if (is_multiconfig STREQUAL "NOTFOUND") + if (${CMAKE_GENERATOR} STREQUAL "Xcode" OR ${CMAKE_GENERATOR} MATCHES "^Visual Studio") + set (is_multiconfig TRUE) + endif () +endif () + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang + set (is_clang TRUE) +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set (is_gcc TRUE) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) + message (FATAL_ERROR "This project requires GCC 5.1 or later") + endif () +endif () +if (${CMAKE_GENERATOR} STREQUAL "Xcode") + set (is_xcode TRUE) +endif () + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set (is_linux TRUE) +else () + set (is_linux FALSE) +endif () + +if (NOT is_multiconfig AND NOT CMAKE_BUILD_TYPE) + message (STATUS "Build type not specified - defaulting to Release") + set (CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE) +endif () + +# check for in-source build and fail +if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message (FATAL_ERROR "Builds (in-source) are not allowed in " + "${CMAKE_CURRENT_SOURCE_DIR}. Please remove CMakeCache.txt and the CMakeFiles " + "directory from ${CMAKE_CURRENT_SOURCE_DIR} and try building in a separate directory.") +endif () + +if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND NOT ("${CMAKE_GENERATOR}" MATCHES .*Win64.*)) - message(FATAL_ERROR "Visual Studio 32-bit build is unsupported. Use - -G\"${CMAKE_GENERATOR} Win64\"") -endif() + message (FATAL_ERROR + "Visual Studio 32-bit build is not supported. Use -G\"${CMAKE_GENERATOR} Win64\"") +endif () -setup_build_cache() +if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + message (FATAL_ERROR "Rippled requires a 64 bit target architecture.\n" + "The most likely cause of this warning is trying to build rippled with a 32-bit OS.") +endif () -if(nonunity) - get_cmake_property(allvars VARIABLES) - string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}") - foreach(var IN LISTS matchvars) - string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var}) - set(${newvar} ${${var}}) - endforeach() +#[===================================================================[ + read version from source +#]===================================================================] - get_cmake_property(allvars CACHE_VARIABLES) - string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}") - foreach(var IN LISTS matchvars) - string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var}) - set(${newvar} ${${var}} CACHE STRING "Copied from ${var}") - endforeach() -endif() +file (STRINGS src/ripple/protocol/impl/BuildInfo.cpp BUILD_INFO) +foreach (line_ ${BUILD_INFO}) + if (line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"") + set (rippled_version ${CMAKE_MATCH_1}) + endif () +endforeach () +if (rippled_version) + message (STATUS "rippled version: ${rippled_version}") +else () + message (FATAL_ERROR "unable to determine rippled version") +endif () -determine_build_type() +#[===================================================================[ + declare user options/settings +#]===================================================================] -check_gcc4_abi() +option (assert "Enables asserts, even in release builds" OFF) +option (unity "Creates a build based on unity sources. This is the default" ON) +if (is_gcc OR is_clang) + option (coverage "Generates coverage info." OFF) + option (profile "Add profiling flags" OFF) +else () + set (profile OFF CACHE BOOL "gcc/clang only" FORCE) + set (coverage OFF CACHE BOOL "gcc/clang only" FORCE) +endif () +if (is_linux) + option (BUILD_SHARED_LIBS "build shared ripple libraries" OFF) + option (static "link protobuf, openssl, libc++, and boost statically" ON) + option (perf "Enables flags that assist with perf recording" OFF) + option (use_gold "enables detection of gold (binutils) linker" ON) +else () + # we are not ready to allow shared-libs on windows because it would require + # export declarations. On macos it's more feasible, but static openssl + # produces odd linker errors, thus we disable shared lib builds for now. + set (BUILD_SHARED_LIBS OFF CACHE BOOL "build shared ripple libraries - OFF for win/macos" FORCE) + set (static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE) + set (perf OFF CACHE BOOL "perf flags, linux only" FORCE) + set (use_gold OFF CACHE BOOL "gold linker, linux only" FORCE) +endif () +option (jemalloc "Enables jemalloc for heap profiling" OFF) +option (werr "treat warnings as errors" OFF) -############################################################ +# this one is a string and therefore can't be an option +set (san "" CACHE STRING "On gcc & clang, add sanitizer instrumentation") +set_property (CACHE san PROPERTY STRINGS ";undefined;memory;address;thread") +if (san) + string (TOLOWER ${san} san) + set (SAN_FLAG "-fsanitize=${san}") + set (SAN_LIB "") + if (is_gcc) + if (san STREQUAL "address") + set (SAN_LIB "asan") + elseif (san STREQUAL "thread") + set (SAN_LIB "tsan") + elseif (san STREQUAL "memory") + set (SAN_LIB "msan") + elseif (san STREQUAL "undefined") + set (SAN_LIB "ubsan") + endif () + endif () + set (_saved_CRL ${CMAKE_REQUIRED_LIBRARIES}) + set (CMAKE_REQUIRED_LIBRARIES "${SAN_FLAG};${SAN_LIB}") + check_cxx_compiler_flag (${SAN_FLAG} COMPILER_SUPPORTS_SAN) + set (CMAKE_REQUIRED_LIBRARIES ${_saved_CRL}) + if (NOT COMPILER_SUPPORTS_SAN) + message (FATAL_ERROR "${san} sanitizer does not seem to be supported by your compiler") + endif () +endif () -include_directories( - src - src/beast - src/beast/extras - src/nudb/include - src/soci/src - src/soci/include) +# the remaining options are obscure and rarely used +option (beast_no_unit_test_inline + "Prevents unit test definitions from being inserted into global table" + OFF) +option (beast_force_debug + "Force BEAST_DEBUG regardless of DEBUG settings" + OFF) +# NOTE - THIS OPTION CURRENTLY DOES NOT COMPILE : +# TODO: fix or remove +option (verify_nodeobject_keys + "This verifies that the hash of node objects matches the payload. \ + This check is expensive - use with caution." + OFF) +option (dump_leaks_on_exit + "Displays heap blocks and counted objects which were not disposed of\ + during exit. Only implemented for windows builds." + ON) +option (single_io_service_thread + "Restricts the number of threads calling io_service::run to one. \ + This can be useful when debugging." + OFF) +option (boost_show_deprecated + "Allow boost to fail on deprecated usage. Only useful if you're trying\ + to find deprecated calls." + OFF) +# beast_check_mem_leaks can't be an option() because we want to support an +# "undefined" which means use default behavior +# option (beast_check_mem_leaks +# "Force beast mem leak checking. Default is on for DEBUG builds. Only implemented on WIN32" +if (WIN32) + option (beast_disable_autolink "Disables autolinking of system libraries on WIN32" OFF) +else () + set (beast_disable_autolink OFF CACHE BOOL "WIN32 only" FORCE) +endif () +if (coverage) + message (STATUS "coverage build requested - forcing Debug build") + set (CMAKE_BUILD_TYPE Debug) +endif () -special_build_flags() +#[===================================================================[ + setup project-wide compiler settings +#]===================================================================] -############################################################ +#[=========================================================[ + TODO some/most of these common settings belong in a + toolchain file, especially the ABI-impacting ones +#]=========================================================] +add_library (common INTERFACE) +add_library (Ripple::common ALIAS common) +# add a single global dependency on this interface lib +link_libraries (Ripple::common) +set_target_properties (common + PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON) +target_compile_features (common INTERFACE cxx_std_14) +target_compile_definitions (common + INTERFACE + $<$:_DEBUG> + $<$,$>>:NDEBUG>) -use_boost( - # resist the temptation to alphabetize these. coroutine - # must come before context. - chrono - coroutine - context - date_time - filesystem - program_options - regex - serialization - system - thread) +if (MSVC) + # remove existing exception flag since we set it to -EHa + string (REGEX REPLACE "[-/]EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + # also remove dynamic runtime + foreach (var_ + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + string (REGEX REPLACE "[-/]MD[d]*" " " ${var_} "${${var_}}") + endforeach () -use_pthread() + target_compile_options (common + INTERFACE + -bigobj # Increase object file max size + -fp:precise # Floating point behavior + -Gd # __cdecl calling convention + -Gm- # Minimal rebuild: disabled + -Gy- # Function level linking: disabled + -MP # Multiprocessor compilation + -openmp- # pragma omp: disabled + -errorReport:none # No error reporting to Internet + -nologo # Suppress login banner + -wd4018 # Disable signed/unsigned comparison warnings + -wd4244 # Disable float to int possible loss of data warnings + -wd4267 # Disable size_t to T possible loss of data warnings + -wd4800 # Disable C4800(int to bool performance) + -wd4503 # Decorated name length exceeded, name was truncated + $<$: + -EHa + -GR + > + $<$:-Ox> + $<$,$>: + -GS + -Zc:forScope + > + # static runtime + $<$:-MTd> + $<$>:-MT> + $<$:-WX> + ) + target_compile_definitions (common + INTERFACE + _WIN32_WINNT=0x6000 + _SCL_SECURE_NO_WARNINGS + _CRT_SECURE_NO_WARNINGS + WIN32_CONSOLE + NOMINMAX + $<$,$>:_CRTDBG_MAP_ALLOC>) + target_link_libraries (common + INTERFACE + -errorreport:none + -machine:X64) +else () + # HACK : because these need to come first, before any warning demotion + string (APPEND CMAKE_CXX_FLAGS "-Wall -Wdeprecated") + # not MSVC + target_compile_options (common + INTERFACE + $<$:-Werror> + $<$: + -frtti + -Wnon-virtual-dtor + > + -Wno-sign-compare + -Wno-char-subscripts + -Wno-format + -Wno-unused-local-typedefs + $<$: + -Wno-unused-but-set-variable + -Wno-deprecated + > + $<$>:-fno-strict-aliasing> + # tweak gcc optimization for debug + $<$,$>:-O0> + # Add debug symbols to release config + $<$:-g>) + target_link_libraries (common + INTERFACE + -rdynamic + $<$,$>>:-static-libstdc++>) +endif () -use_openssl(${openssl_min}) - -use_protobuf() - -setup_build_boilerplate() - -############################################################ +if (use_gold AND is_gcc) + # use gold linker if available + execute_process ( + COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version + ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + #[=========================================================[ + NOTE: THE gold linker inserts -rpath as DT_RUNPATH by + default intead of DT_RPATH, so you might have slightly + unexpected runtime ld behavior if you were expecting + DT_RPATH. Specify --disable-new-dtags to gold if you do + not want the default DT_RUNPATH behavior. This rpath + treatment as well as static/dynamic selection means that + gold does not currently have ideal default behavior when + we are using jemalloc. Thus for simplicity we don't use + it when jemalloc is requested. An alternative to + disabling would be to figure out all the settings + required to make gold play nicely with jemalloc. + #]=========================================================] + if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc)) + target_link_libraries (common + INTERFACE + -fuse-ld=gold + -Wl,--no-as-needed + #[=========================================================[ + see https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638/comments/5 + DT_RUNPATH does not work great for transitive + dependencies (of which boost has a few) - so just + switch to DT_RPATH if doing dynamic linking with gold + #]=========================================================] + $<$>:-Wl,--disable-new-dtags>) + endif () + unset (LD_VERSION) +endif () if (is_clang) - set(rocks_db_system_header --system-header-prefix=rocksdb2) -else() - unset(rocks_db_system_header) + # use lld linker if available + execute_process ( + COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version + ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + if ("${LD_VERSION}" MATCHES "LLD") + target_link_libraries (common INTERFACE -fuse-ld=lld) + endif () + unset (LD_VERSION) endif() -set(soci_extra_includes - -I"${CMAKE_SOURCE_DIR}/"src/soci/src/core - -I"${CMAKE_SOURCE_DIR}/"src/soci/include/private - -I"${CMAKE_SOURCE_DIR}/"src/sqlite) +if (assert) + foreach (var_ + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELWITHDEBINFO) + STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}") + endforeach () +endif () -############################################################ +#[===================================================================[ + rippled compile options/settings via an interface library +#]===================================================================] -# Unity sources -prepend(beast_unity_srcs -src/ripple/beast/unity/ -beast_insight_unity.cpp -beast_net_unity.cpp -beast_hash_unity.cpp -beast_utility_unity.cpp) +add_library (opts INTERFACE) +add_library (Ripple::opts ALIAS opts) +target_compile_definitions (opts + INTERFACE + BOOST_NO_AUTO_PTR + BOOST_ASIO_HAS_STD_ARRAY + BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS + $<$: + BOOST_ASIO_NO_DEPRECATED + BOOST_FILESYSTEM_NO_DEPRECATED + > + $<$>: + BOOST_COROUTINES_NO_DEPRECATION_WARNING + BOOST_BEAST_ALLOW_DEPRECATED + BOOST_FILESYSTEM_DEPRECATED + > + BEAST_CHECK_MEMORY_LEAKS=$ + RIPPLE_DUMP_LEAKS_ON_EXIT=$ + $<$:BEAST_NO_UNIT_TEST_INLINE=1> + $<$:BEAST_FORCE_DEBUG=1> + $<$:BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1> + $<$:RIPPLE_SINGLE_IO_SERVICE_THREAD=1> + # doesn't currently compile ? : + $<$:RIPPLE_VERIFY_NODEOBJECT_KEYS=1>) +target_compile_options (opts + INTERFACE + $<$,$>:-Wsuggest-override> + $<$:-fno-omit-frame-pointer> + $<$:-fprofile-arcs -ftest-coverage> + $<$:-pg> + $<$,$>:-p>) -prepend(ripple_unity_srcs -src/ripple/unity/ -app_consensus.cpp -app_ledger.cpp -app_ledger_impl.cpp -app_main1.cpp -app_main2.cpp -app_misc.cpp -app_misc_impl.cpp -app_paths.cpp -app_tx.cpp -conditions.cpp -consensus.cpp -core.cpp -basics.cpp -crypto.cpp -ledger.cpp -net.cpp -overlay1.cpp -overlay2.cpp -peerfinder.cpp -json.cpp -protocol.cpp -resource.cpp -rpcx1.cpp -rpcx2.cpp -shamap.cpp -server.cpp) +target_link_libraries (opts + INTERFACE + $<$:-fprofile-arcs -ftest-coverage> + $<$:-pg> + $<$,$>:-p>) -prepend(test_unity_srcs -src/test/unity/ -app_test_unity1.cpp -app_test_unity2.cpp -basics_test_unity.cpp -beast_test_unity1.cpp -beast_test_unity2.cpp -conditions_test_unity.cpp -consensus_test_unity.cpp -core_test_unity.cpp -crypto_test_unity.cpp -json_test_unity.cpp -ledger_test_unity.cpp -overlay_test_unity.cpp -peerfinder_test_unity.cpp -protocol_test_unity.cpp -resource_test_unity.cpp -rpc_test_unity.cpp -server_test_unity.cpp -server_status_test_unity.cpp -shamap_test_unity.cpp -jtx_unity1.cpp -jtx_unity2.cpp -csf_unity.cpp) +if (jemalloc) + find_package (jemalloc REQUIRED) + target_compile_definitions (opts INTERFACE PROFILE_JEMALLOC) + target_include_directories (opts SYSTEM INTERFACE ${JEMALLOC_INCLUDE_DIRS}) + target_link_libraries (opts INTERFACE ${JEMALLOC_LIBRARIES}) + get_filename_component (JEMALLOC_LIB_PATH ${JEMALLOC_LIBRARIES} DIRECTORY) + ## TODO see if we can use the BUILD_RPATH target property (is it transitive?) + set (CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${JEMALLOC_LIB_PATH}) +endif () -list(APPEND rippled_src_unity ${beast_unity_srcs} ${ripple_unity_srcs} ${test_unity_srcs}) +if (san) + target_compile_options (opts + INTERFACE + ${SAN_FLAG} + -fno-omit-frame-pointer) + target_compile_definitions (opts + INTERFACE + $<$:SANITIZER=ASAN> + $<$:SANITIZER=TSAN> + $<$:SANITIZER=MSAN> + $<$:SANITIZER=UBSAN>) + target_link_libraries (opts INTERFACE ${SAN_FLAG} ${SAN_LIB}) +endif () -add_with_props(rippled_src_unity src/test/unity/nodestore_test_unity.cpp --I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include --I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy --I"${CMAKE_SOURCE_DIR}/"src/snappy/config -${rocks_db_system_header}) +#[===================================================================[ + rippled transitive library deps via an interface library +#]===================================================================] -add_with_props(rippled_src_unity src/ripple/unity/nodestore.cpp --I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include --I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy --I"${CMAKE_SOURCE_DIR}/"src/snappy/config -${rocks_db_system_header}) +add_library (ripple_syslibs INTERFACE) +add_library (Ripple::syslibs ALIAS ripple_syslibs) +target_link_libraries (ripple_syslibs + INTERFACE + $<$: + legacy_stdio_definitions.lib + Shlwapi + kernel32 + user32 + gdi32 + winspool + comdlg32 + advapi32 + shell32 + ole32 + oleaut32 + uuid + odbc32 + odbccp32 + crypt32 + > + $<$>:dl> + $<$,$>>:rt>) -add_with_props(rippled_src_unity src/ripple/unity/soci_ripple.cpp ${soci_extra_includes}) +if (NOT MSVC) + set (THREADS_PREFER_PTHREAD_FLAG ON) + find_package (Threads) + target_link_libraries (ripple_syslibs INTERFACE Threads::Threads) +endif () -list(APPEND ripple_unity_srcs ${beast_unity_srcs} ${test_unity_srcs} -src/ripple/unity/nodestore.cpp -src/ripple/unity/soci_ripple.cpp -src/test/unity/nodestore_test_unity.cpp) +add_library (ripple_libs INTERFACE) +add_library (Ripple::libs ALIAS ripple_libs) +target_link_libraries (ripple_libs INTERFACE Ripple::syslibs) -############################################################ +#[===================================================================[ + NIH dep: boost +#]===================================================================] -# Non-unity sources -file(GLOB_RECURSE core_srcs src/ripple/core/*.cpp) -add_with_props(rippled_src_nonunity "${core_srcs}" - -I"${CMAKE_SOURCE_DIR}/"src/soci/src/core - -I"${CMAKE_SOURCE_DIR}/"src/sqlite) +if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT})) + set (BOOST_ROOT $ENV{BOOST_ROOT}) +endif () +file (TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT) +if (WIN32 OR CYGWIN) + # Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders + if (DEFINED BOOST_ROOT) + if (IS_DIRECTORY ${BOOST_ROOT}/stage64/lib) + set (BOOST_LIBRARYDIR ${BOOST_ROOT}/stage64/lib) + else () + set (BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib) + endif () + endif () +endif () +message (STATUS "BOOST_ROOT: ${BOOST_ROOT}") +message (STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}") -set(non_unity_srcs ${core_srcs}) +# uncomment the following as needed to debug FindBoost issues: +#set (Boost_DEBUG ON) -foreach(curdir - beast/clock - beast/container - beast/hash - beast/insight - beast/net - beast/utility - app - basics - conditions - consensus - crypto - json - ledger - legacy - net - overlay - peerfinder - protocol - resource - rpc - server - shamap) - file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp) - list(APPEND rippled_src_nonunity "${cursrcs}") - list(APPEND non_unity_srcs "${cursrcs}") -endforeach() +#[=========================================================[ + boost dynamic libraries don't trivially support @rpath + linking right now (cmake's default), so just force + static linking for macos, or if requested on linux by flag +#]=========================================================] +if (static) + set (Boost_USE_STATIC_LIBS ON) +endif () +set (Boost_USE_MULTITHREADED ON) +if (static AND NOT APPLE) + set (Boost_USE_STATIC_RUNTIME ON) +else () + set (Boost_USE_STATIC_RUNTIME OFF) +endif () +find_package (Boost 1.67 REQUIRED + COMPONENTS + chrono + context + coroutine + date_time + filesystem + program_options + regex + serialization + system + thread) -file(GLOB_RECURSE nodestore_srcs src/ripple/nodestore/*.cpp - src/test/nodestore/*.cpp) - -add_with_props(rippled_src_nonunity "${nodestore_srcs}" - -I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include - -I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy - -I"${CMAKE_SOURCE_DIR}/"src/snappy/config - ${rocks_db_system_header}) - -list(APPEND non_unity_srcs "${nodestore_srcs}") - -# unit test sources -foreach(curdir - app - basics - beast - conditions - consensus - core - crypto - csf - json - jtx - ledger - nodestore - overlay - peerfinder - protocol - resource - rpc - server - shamap - unit_test) - file(GLOB_RECURSE cursrcs src/test/${curdir}/*.cpp) - list(APPEND test_srcs "${cursrcs}") -endforeach() - -add_with_props(rippled_src_nonunity "${test_srcs}" - -I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include - -I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy - -I"${CMAKE_SOURCE_DIR}/"src/snappy/config - ${rocks_db_system_header}) - -list(APPEND non_unity_srcs "${test_srcs}") - -if(WIN32 OR is_xcode) - # Rippled headers. Only needed for IDEs. - file(GLOB_RECURSE rippled_headers src/*.h src/*.hpp *.md) - list(APPEND rippled_headers Builds/CMake/CMakeFuncs.cmake) - foreach(curdir - beast/asio - beast/core - beast/crypto - beast/cxx17 - proto - validators - websocket) - file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp) - list(APPEND rippled_headers "${cursrcs}") - endforeach() - list(APPEND rippled_src_nonunity "${rippled_headers}") - - set_property( - SOURCE ${rippled_headers} - APPEND - PROPERTY HEADER_FILE_ONLY - true) - # Doesn't work - # $,$>) +add_library (ripple_boost INTERFACE) +add_library (Ripple::boost ALIAS ripple_boost) +if (is_xcode) + target_include_directories (ripple_boost BEFORE INTERFACE ${Boost_INCLUDE_DIRS}) + target_compile_options (ripple_boost INTERFACE --system-header-prefix="boost/") +else () + target_include_directories (ripple_boost SYSTEM INTERFACE ${Boost_INCLUDE_DIRS}) endif() -if (WIN32 OR is_xcode) - # Documentation sources. Only needed for IDEs. - prepend(doc_srcs - docs/ - source.dox) +target_link_libraries (ripple_boost + INTERFACE + Boost::boost + Boost::chrono + Boost::coroutine + Boost::date_time + Boost::filesystem + Boost::program_options + Boost::regex + Boost::serialization + Boost::system + Boost::thread) - file(GLOB_RECURSE other_docs docs/*.md) - list(APPEND doc_srcs "${other_docs}") - set_property( - SOURCE ${doc_srcs} - APPEND - PROPERTY HEADER_FILE_ONLY - true) - # Doesn't work - # $,$>) -endif() +#[===================================================================[ + NIH dep: openssl +#]===================================================================] -############################################################ +if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR}) + find_program (HOMEBREW brew) + if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND") + execute_process (COMMAND ${HOMEBREW} --prefix openssl + OUTPUT_VARIABLE OPENSSL_ROOT_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif () +endif () -add_with_props(rippled_src_all src/ripple/unity/soci.cpp - ${soci_extra_includes}) +if ((NOT DEFINED OPENSSL_ROOT) AND (DEFINED ENV{OPENSSL_ROOT})) + set (OPENSSL_ROOT $ENV{OPENSSL_ROOT}) +endif () +file (TO_CMAKE_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT) -if (NOT is_msvc) - set(no_unused_w -Wno-unused-function) -else() - unset(no_unused_w) -endif() +if (static) + set (OPENSSL_USE_STATIC_LIBS ON) +endif () +set (OPENSSL_MSVC_STATIC_RT ON) +set (_ssl_min_ver 1.0.2) +# HACK for travis +if ("$ENV{CI}" STREQUAL "true" AND "$ENV{TRAVIS}" STREQUAL "true") + set (_ssl_min_ver 1.0.1) +endif () +find_package (OpenSSL ${_ssl_min_ver} REQUIRED) +target_link_libraries (ripple_libs + INTERFACE + OpenSSL::SSL + OpenSSL::Crypto) +# disable SSLv2...this can also be done when building/configuring OpenSSL +set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2) +#[=========================================================[ + https://gitlab.kitware.com/cmake/cmake/issues/16885 + depending on how openssl is built, it might depend + on zlib. In fact, the openssl find package should + figure this out for us, but it does not currently... + so let's add zlib ourselves to the lib list + TODO: investigate linking to static zlib for static + build option +#]=========================================================] +find_package (ZLIB) +if (TARGET ZLIB::ZLIB) + #target_link_libraries (OpenSSL::Crypto INTERFACE ZLIB::ZLIB) + set_target_properties(OpenSSL::Crypto PROPERTIES + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) +endif () -add_with_props(rippled_src_all src/ripple/unity/secp256k1.cpp - -I"${CMAKE_SOURCE_DIR}/"src/secp256k1 - ${no_unused_w} - ) +#[===================================================================[ + NIH dep: secp256k1 +#]===================================================================] -foreach(cursrc - src/ripple/unity/beast.cpp - src/ripple/unity/lz4.c - src/ripple/unity/protobuf.cpp - src/ripple/unity/ripple.proto.cpp) +add_library (secp256k1 STATIC + src/secp256k1/src/secp256k1.c) +target_compile_definitions (secp256k1 + PRIVATE + USE_NUM_NONE + USE_FIELD_10X26 + USE_FIELD_INV_BUILTIN + USE_SCALAR_8X32 + USE_SCALAR_INV_BUILTIN) +target_include_directories (secp256k1 + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/secp256k1) +target_compile_options (secp256k1 + PRIVATE + $<$:-wd4319> + $<$>: + -Wno-deprecated-declarations + -Wno-unused-function + > + $<$:-Wno-nonnull-compare>) +add_library (NIH::secp256k1 ALIAS secp256k1) +target_link_libraries (ripple_libs INTERFACE NIH::secp256k1) +#[===========================[ + headers installation +#]===========================] +install ( + FILES + src/secp256k1/include/secp256k1.h + DESTINATION include/secp256k1/include) - add_with_props(rippled_src_all ${cursrc} - ${rocks_db_system_header} +#[===================================================================[ + NIH dep: ed25519-donna +#]===================================================================] + +add_library (ed25519-donna STATIC + src/ed25519-donna/ed25519.c) +target_include_directories (ed25519-donna + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src/ed25519-donna) +#[=========================================================[ + NOTE for macos: + https://github.com/floodyberry/ed25519-donna/issues/29 + our source for ed25519-donna-portable.h has been + patched to workaround this. +#]=========================================================] +target_link_libraries (ed25519-donna PUBLIC OpenSSL::SSL) +add_library (NIH::ed25519-donna ALIAS ed25519-donna) +target_link_libraries (ripple_libs INTERFACE NIH::ed25519-donna) +#[===========================[ + headers installation +#]===========================] +install ( + FILES + src/ed25519-donna/ed25519.h + DESTINATION include/ed25519-donna) + +#[===================================================================[ + NIH dep: lz4 +#]===================================================================] + +add_library (lz4 STATIC + src/lz4/lib/lz4.c + src/lz4/lib/lz4hc.c + src/lz4/lib/lz4frame.c + src/lz4/lib/xxhash.c) +target_compile_definitions (lz4 + PRIVATE XXH_NAMESPACE=LZ4_) +add_library (NIH::lz4 ALIAS lz4) +target_link_libraries (ripple_libs INTERFACE NIH::lz4) +## pseudo-install our files so that dependent builds can find them +file (MAKE_DIRECTORY + ${CMAKE_BINARY_DIR}/lz4/include + ${CMAKE_BINARY_DIR}/lz4/lib) +target_include_directories (lz4 PUBLIC ${CMAKE_BINARY_DIR}/lz4/include) +add_custom_command (TARGET lz4 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/src/lz4/lib/lz4.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/lz4/lib/lz4frame.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/lz4/lib/lz4hc.h + ${CMAKE_BINARY_DIR}/lz4/include + COMMAND ${CMAKE_COMMAND} -E copy + $ ${CMAKE_BINARY_DIR}/lz4/lib) + +#[===================================================================[ + NIH dep: sqlite +#]===================================================================] + +add_library (sqlite3 STATIC + src/sqlite/sqlite/sqlite3.c) +#[=========================================================[ + When compiled with SQLITE_THREADSAFE=1, SQLite operates + in serialized mode. In this mode, SQLite can be safely + used by multiple threads with no restriction. + + VFALCO NOTE: This implies a global mutex! + + When compiled with SQLITE_THREADSAFE=2, SQLite can be + used in a multithreaded program so long as no two + threads attempt to use the same database connection at + the same time. + + VFALCO NOTE: This is the preferred threading model. +#]=========================================================] +target_compile_definitions (sqlite3 + PRIVATE + SQLITE_THREADSAFE=1 + HAVE_USLEEP=1) +target_compile_options (sqlite3 + PRIVATE + $<$: + -wd4100 + -wd4127 + -wd4232 + -wd4244 + -wd4701 + -wd4706 + -wd4996 + > + $<$>:-Wno-array-bounds>) +add_library (NIH::sqlite3 ALIAS sqlite3) +target_link_libraries (sqlite3 PUBLIC $<$>:dl>) +target_link_libraries (ripple_libs INTERFACE NIH::sqlite3) +file (MAKE_DIRECTORY + ${CMAKE_BINARY_DIR}/sqlite3/include + ${CMAKE_BINARY_DIR}/sqlite3/lib) +target_include_directories (sqlite3 + PRIVATE + src/sqlite + src/sqlite/sqlite + INTERFACE + ${CMAKE_BINARY_DIR}/sqlite3/include) +add_custom_command (TARGET sqlite3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite/sqlite ${CMAKE_BINARY_DIR}/sqlite3/include + COMMAND ${CMAKE_COMMAND} -E copy + $ ${CMAKE_BINARY_DIR}/sqlite3/lib + BYPRODUCTS ${CMAKE_BINARY_DIR}/sqlite3/include/sqlite3.h) + +#[===================================================================[ + NIH dep: soci +#]===================================================================] + +add_library (soci STATIC + #[=========================================================[ + this unity file is our interpretation of + what sources constitute soci-lib. + #]=========================================================] + src/ripple/unity/soci.cpp + # this header is here to create dependency on the sqlite post-build step + ${CMAKE_BINARY_DIR}/sqlite3/include/sqlite3.h) +target_compile_definitions (soci PUBLIC SOCI_HAVE_CXX_C11=1) +target_include_directories (soci + PUBLIC + src/soci/src + src/soci/include + #[=========================================================[ + HACK for ninja..which doesn't properly see + the POST_BUILD dependency on sqlite (TODO: diagnose) + so we must include the original source dir + #]=========================================================] + $<$: + ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite + > + PRIVATE + src + src/soci/src/core + src/soci/include/private) +target_link_libraries (soci + NIH::sqlite3 + Ripple::boost) +add_library (NIH::soci ALIAS soci) +target_link_libraries (ripple_libs INTERFACE NIH::soci) + +#[===================================================================[ + NIH dep: snappy +#]===================================================================] + +add_library (snappy STATIC + src/snappy/snappy/snappy.cc + src/snappy/snappy/snappy-sinksource.cc + src/snappy/snappy/snappy-stubs-internal.cc) +target_compile_options (snappy + PRIVATE + $<$>: + -Wno-deprecated + -Wno-unused-function + > + $<$:-Wno-nonnull-compare>) +target_include_directories (snappy + PUBLIC + src/snappy/snappy + src/snappy/config) +add_library (NIH::snappy ALIAS snappy) +target_link_libraries (ripple_libs INTERFACE NIH::snappy) + +#[===================================================================[ + NIH dep: rocksdb +#]===================================================================] + +if (NOT MSVC) + add_library (rocksdb STATIC + #[=========================================================[ + this unity file is our interpretation of what sources + constitute rocksdb + #]=========================================================] + src/ripple/unity/rocksdb.cpp) + target_compile_options (rocksdb + PRIVATE + $<$:-w> + PUBLIC + $<$,$>: + -Wno-inconsistent-missing-override + -Wno-uninitialized + > + $<$:--system-header-prefix=rocksdb2>) + target_include_directories (rocksdb + PRIVATE + src + src/rocksdb2 + PUBLIC + src/rocksdb2/include) + target_compile_definitions (rocksdb + PUBLIC + SNAPPY + RIPPLE_ROCKSDB_AVAILABLE=1 + $<$:ROCKSDB_PLATFORM_WINDOWS> + $<$>: + ROCKSDB_PLATFORM_POSIX + ROCKSDB_LIB_IO_POSIX + > + $<$:OS_MACOSX=1> + $<$:OS_LINUX> ) + target_link_libraries (rocksdb NIH::snappy) +else () + add_library (rocksdb INTERFACE) + target_compile_definitions (rocksdb INTERFACE RIPPLE_ROCKSDB_AVAILABLE=0) +endif () +add_library (NIH::rocksdb ALIAS rocksdb) +target_link_libraries (ripple_libs INTERFACE NIH::rocksdb) -endforeach() +#[===================================================================[ + NIH dep: nudb -if (NOT is_msvc) - set(extra_props -Wno-array-bounds) -else() - unset(extra_props) -endif() + NuDB is header-only, thus is an INTERFACE lib in CMake. + TODO: move this into NuDB repo, add proper targets and + export/install +#]===================================================================] -add_with_props(rippled_src_all src/sqlite/sqlite_unity.c - ${extra_props}) +add_library (nudb INTERFACE) +target_include_directories (nudb INTERFACE src/nudb/include) +target_link_libraries (nudb + INTERFACE + Boost::thread + Boost::system) +add_library (NIH::nudb ALIAS nudb) +target_link_libraries (ripple_libs INTERFACE NIH::nudb) -add_with_props(rippled_src_all src/ripple/unity/ed25519_donna.c - -I"${CMAKE_SOURCE_DIR}/"src/ed25519-donna) +#[===================================================================[ + import protobuf (lib and compiler) and create a lib + from our proto message definitions. There is fallback + logic for windows that builds some version of the protobuf + core library from source and downloads the protoc compiler + if needed +#]===================================================================] -if (is_gcc) - set(no_gcc_warnings -w) -else() - unset(no_gcc_warnings) -endif() +if (static) + set (Protobuf_USE_STATIC_LIBS ON) +endif () +find_package (Protobuf) +if (MSVC AND NOT TARGET protobuf::protoc) + find_program (my_protoc NAMES protoc) + if (NOT my_protoc) + message (WARNING "No protoc found -- downloading now") + file (DOWNLOAD + "https://ripple.github.io/Downloads/protoc/2.5.1/protoc.exe" + ${CMAKE_BINARY_DIR}/tools/protoc.exe + STATUS status + TIMEOUT 30) + list (GET status 0 status_code) + list (GET status 1 status_string) + if (NOT status_code EQUAL 0) + message (FATAL_ERROR "Failed to download protoc: ${status_string}") + endif () + set (my_protoc ${CMAKE_BINARY_DIR}/tools/protoc.exe) + endif () + add_executable (protobuf::protoc IMPORTED) + set_target_properties (protobuf::protoc PROPERTIES + IMPORTED_LOCATION "${my_protoc}") +endif () -add_with_props(rippled_src_all src/ripple/unity/rocksdb.cpp - -I"${CMAKE_SOURCE_DIR}/"src/rocksdb2 - -I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include - -I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy - -I"${CMAKE_SOURCE_DIR}/"src/snappy/config - ${no_gcc_warnings} ${rocks_db_system_header}) +file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/proto_gen) +set (save_CBD ${CMAKE_CURRENT_BINARY_DIR}) +set (CMAKE_CURRENT_BINARY_DIR ${CMAKE_BINARY_DIR}/proto_gen) +protobuf_generate_cpp ( + PROTO_SRCS + PROTO_HDRS + src/ripple/proto/ripple.proto) +set (CMAKE_CURRENT_BINARY_DIR ${save_CBD}) -if (NOT is_msvc) - set(no_unused_w -Wno-unused-function) -endif() +add_library (pbufs STATIC ${PROTO_SRCS} ${PROTO_HDRS}) +if ((NOT TARGET protobuf::libprotobuf) AND (NOT Protobuf_LIBRARIES)) + message (STATUS "protobuf lib not found - adding unity source for lib") + target_sources (pbufs PRIVATE src/ripple/unity/protobuf.cpp) + target_include_directories (pbufs + PUBLIC + src/protobuf/src + src/protobuf/vsprojects + src/ripple/proto) + target_compile_definitions (pbufs + PRIVATE + _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS) +endif () +target_include_directories (pbufs PRIVATE src) +target_include_directories (pbufs + SYSTEM PUBLIC + ${CMAKE_BINARY_DIR}/proto_gen) +if (NOT MSVC) + if (TARGET protobuf::libprotobuf) + target_link_libraries (pbufs protobuf::libprotobuf) + else () + target_link_libraries (pbufs ${Protobuf_LIBRARIES}) + target_include_directories (pbufs PUBLIC ${Protobuf_INCLUDE_DIR}) + endif () +endif () +target_compile_options (pbufs + PUBLIC + $<$: + --system-header-prefix="google/protobuf" + -Wno-deprecated-dynamic-exception-spec + > + $<$: + -wd4251 + -wd4146 + > + PRIVATE + $<$: + -wd4018 + -wd4244 + -wd4800 + -wd4996 + >) +add_library (Ripple::pbufs ALIAS pbufs) +target_link_libraries (ripple_libs INTERFACE Ripple::pbufs) -add_with_props(rippled_src_all src/ripple/unity/snappy.cpp - -I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy - -I"${CMAKE_SOURCE_DIR}/"src/snappy/config - ${no_unused_w}) +#[===================================================================[ + xrpl_core + core functionality, useable by some client software perhaps +#]===================================================================] -list(APPEND rippled_src_unity "${rippled_src_all}") -list(APPEND rippled_src_nonunity "${rippled_src_all}") +file (GLOB_RECURSE rb_headers + src/ripple/beast/*.h + src/ripple/beast/*.hpp) -############################################################ +add_library (xrpl_core + ${rb_headers} ## headers added here for benefit of IDEs + #[===============================[ + beast/legacy FILES: + TODO: review these sources for removal or replacement + #]===============================] + $<$: + src/ripple/beast/core/core.unity.cpp + src/ripple/beast/unity/beast_hash_unity.cpp + src/ripple/beast/unity/beast_insight_unity.cpp + src/ripple/beast/unity/beast_net_unity.cpp + src/ripple/beast/unity/beast_utility_unity.cpp + > + $<$>: + src/ripple/beast/core/CurrentThreadName.cpp + src/ripple/beast/core/SemanticVersion.cpp + src/ripple/beast/core/WaitableEvent.cpp + src/ripple/beast/hash/impl/xxhash.cpp + src/ripple/beast/insight/impl/Collector.cpp + src/ripple/beast/insight/impl/Group.cpp + src/ripple/beast/insight/impl/Groups.cpp + src/ripple/beast/insight/impl/Hook.cpp + src/ripple/beast/insight/impl/Metric.cpp + src/ripple/beast/insight/impl/NullCollector.cpp + src/ripple/beast/insight/impl/StatsDCollector.cpp + src/ripple/beast/net/impl/IPAddressConversion.cpp + src/ripple/beast/net/impl/IPAddressV4.cpp + src/ripple/beast/net/impl/IPAddressV6.cpp + src/ripple/beast/net/impl/IPEndpoint.cpp + src/ripple/beast/utility/src/beast_Debug.cpp + src/ripple/beast/utility/src/beast_Journal.cpp + src/ripple/beast/utility/src/beast_PropertyStream.cpp + > + # END beast/legacy -if (WIN32 OR is_xcode) + #[===============================[ + core sources + #]===============================] + $<$: + src/ripple/unity/basics1.cpp + src/ripple/unity/json.cpp + src/ripple/unity/protocol.cpp + src/ripple/unity/crypto.cpp + > + $<$>: + #[===============================[ + nounity, main sources: + subdir: basics (partial) + #]===============================] + src/ripple/basics/impl/contract.cpp + src/ripple/basics/impl/CountedObject.cpp + src/ripple/basics/impl/Log.cpp + src/ripple/basics/impl/strHex.cpp + src/ripple/basics/impl/StringUtilities.cpp + #[===============================[ + nounity, main sources: + subdir: json + #]===============================] + src/ripple/json/impl/JsonPropertyStream.cpp + src/ripple/json/impl/Object.cpp + src/ripple/json/impl/Output.cpp + src/ripple/json/impl/Writer.cpp + src/ripple/json/impl/json_reader.cpp + src/ripple/json/impl/json_value.cpp + src/ripple/json/impl/json_valueiterator.cpp + src/ripple/json/impl/json_writer.cpp + src/ripple/json/impl/to_string.cpp + #[===============================[ + nounity, main sources: + subdir: protocol + #]===============================] + src/ripple/protocol/impl/AccountID.cpp + src/ripple/protocol/impl/Book.cpp + src/ripple/protocol/impl/BuildInfo.cpp + src/ripple/protocol/impl/ErrorCodes.cpp + src/ripple/protocol/impl/Feature.cpp + src/ripple/protocol/impl/HashPrefix.cpp + src/ripple/protocol/impl/IOUAmount.cpp + src/ripple/protocol/impl/Indexes.cpp + src/ripple/protocol/impl/InnerObjectFormats.cpp + src/ripple/protocol/impl/Issue.cpp + src/ripple/protocol/impl/Keylet.cpp + src/ripple/protocol/impl/LedgerFormats.cpp + src/ripple/protocol/impl/PublicKey.cpp + src/ripple/protocol/impl/Quality.cpp + src/ripple/protocol/impl/Rate2.cpp + src/ripple/protocol/impl/SField.cpp + src/ripple/protocol/impl/SOTemplate.cpp + src/ripple/protocol/impl/STAccount.cpp + src/ripple/protocol/impl/STAmount.cpp + src/ripple/protocol/impl/STArray.cpp + src/ripple/protocol/impl/STBase.cpp + src/ripple/protocol/impl/STBlob.cpp + src/ripple/protocol/impl/STInteger.cpp + src/ripple/protocol/impl/STLedgerEntry.cpp + src/ripple/protocol/impl/STObject.cpp + src/ripple/protocol/impl/STParsedJSON.cpp + src/ripple/protocol/impl/STPathSet.cpp + src/ripple/protocol/impl/STTx.cpp + src/ripple/protocol/impl/STValidation.cpp + src/ripple/protocol/impl/STVar.cpp + src/ripple/protocol/impl/STVector256.cpp + src/ripple/protocol/impl/SecretKey.cpp + src/ripple/protocol/impl/Seed.cpp + src/ripple/protocol/impl/Serializer.cpp + src/ripple/protocol/impl/Sign.cpp + src/ripple/protocol/impl/TER.cpp + src/ripple/protocol/impl/TxFormats.cpp + src/ripple/protocol/impl/UintTypes.cpp + src/ripple/protocol/impl/digest.cpp + src/ripple/protocol/impl/tokens.cpp + #[===============================[ + nounity, main sources: + subdir: crypto + #]===============================] + src/ripple/crypto/impl/GenerateDeterministicKey.cpp + src/ripple/crypto/impl/KeyType.cpp + src/ripple/crypto/impl/RFC1751.cpp + src/ripple/crypto/impl/csprng.cpp + src/ripple/crypto/impl/ec_key.cpp + src/ripple/crypto/impl/openssl.cpp + >) +add_library (Ripple::xrpl_core ALIAS xrpl_core) +target_include_directories (xrpl_core + PUBLIC + $ + $ + # this one is for beast/legacy files: + $ + $) +target_compile_options (xrpl_core + PUBLIC + $<$:-Wno-maybe-uninitialized>) +target_link_libraries (xrpl_core + PUBLIC + OpenSSL::Crypto + NIH::secp256k1 + NIH::ed25519-donna + Ripple::syslibs + Ripple::boost + Ripple::opts) +#[=================================[ + main/core headers installation +#]=================================] +install ( + FILES + src/ripple/basics/Blob.h + src/ripple/basics/Buffer.h + src/ripple/basics/CountedObject.h + src/ripple/basics/LocalValue.h + src/ripple/basics/Log.h + src/ripple/basics/Slice.h + src/ripple/basics/StringUtilities.h + src/ripple/basics/ToString.h + src/ripple/basics/UnorderedContainers.h + src/ripple/basics/base_uint.h + src/ripple/basics/chrono.h + src/ripple/basics/contract.h + src/ripple/basics/date.h + src/ripple/basics/hardened_hash.h + src/ripple/basics/strHex.h + DESTINATION include/ripple/basics) +install ( + FILES + src/ripple/crypto/GenerateDeterministicKey.h + src/ripple/crypto/KeyType.h + src/ripple/crypto/RFC1751.h + src/ripple/crypto/csprng.h + DESTINATION include/ripple/crypto) +install ( + FILES + src/ripple/crypto/impl/ec_key.h + src/ripple/crypto/impl/openssl.h + DESTINATION include/ripple/crypto/impl) +install ( + FILES + src/ripple/json/JsonPropertyStream.h + src/ripple/json/Object.h + src/ripple/json/Output.h + src/ripple/json/Writer.h + src/ripple/json/json_forwards.h + src/ripple/json/json_reader.h + src/ripple/json/json_value.h + src/ripple/json/json_writer.h + src/ripple/json/to_string.h + DESTINATION include/ripple/json) +install ( + FILES + src/ripple/json/impl/json_assert.h + DESTINATION include/ripple/json/impl) +install ( + FILES + src/ripple/protocol/AccountID.h + src/ripple/protocol/AmountConversions.h + src/ripple/protocol/Book.h + src/ripple/protocol/BuildInfo.h + src/ripple/protocol/ErrorCodes.h + src/ripple/protocol/Feature.h + src/ripple/protocol/HashPrefix.h + src/ripple/protocol/IOUAmount.h + src/ripple/protocol/Indexes.h + src/ripple/protocol/InnerObjectFormats.h + src/ripple/protocol/Issue.h + src/ripple/protocol/JsonFields.h + src/ripple/protocol/Keylet.h + src/ripple/protocol/KnownFormats.h + src/ripple/protocol/LedgerFormats.h + src/ripple/protocol/Protocol.h + src/ripple/protocol/PublicKey.h + src/ripple/protocol/Quality.h + src/ripple/protocol/Rate.h + src/ripple/protocol/SField.h + src/ripple/protocol/SOTemplate.h + src/ripple/protocol/STAccount.h + src/ripple/protocol/STAmount.h + src/ripple/protocol/STArray.h + src/ripple/protocol/STBase.h + src/ripple/protocol/STBitString.h + src/ripple/protocol/STBlob.h + src/ripple/protocol/STExchange.h + src/ripple/protocol/STInteger.h + src/ripple/protocol/STLedgerEntry.h + src/ripple/protocol/STObject.h + src/ripple/protocol/STParsedJSON.h + src/ripple/protocol/STPathSet.h + src/ripple/protocol/STTx.h + src/ripple/protocol/STValidation.h + src/ripple/protocol/STVector256.h + src/ripple/protocol/SecretKey.h + src/ripple/protocol/Seed.h + src/ripple/protocol/Serializer.h + src/ripple/protocol/Sign.h + src/ripple/protocol/SystemParameters.h + src/ripple/protocol/TER.h + src/ripple/protocol/TxFlags.h + src/ripple/protocol/TxFormats.h + src/ripple/protocol/UintTypes.h + src/ripple/protocol/XRPAmount.h + src/ripple/protocol/digest.h + src/ripple/protocol/tokens.h + DESTINATION include/ripple/protocol) +install ( + FILES + src/ripple/protocol/impl/STVar.h + src/ripple/protocol/impl/secp256k1.h + DESTINATION include/ripple/protocol/impl) + +#[===================================[ + beast/legacy headers installation +#]===================================] +install ( + FILES + src/ripple/beast/clock/abstract_clock.h + src/ripple/beast/clock/basic_seconds_clock.h + src/ripple/beast/clock/manual_clock.h + DESTINATION include/ripple/beast/clock) +install ( + FILES + src/ripple/beast/core/CompilerConfig.h + src/ripple/beast/core/Config.h + src/ripple/beast/core/ConfigCheck.h + src/ripple/beast/core/LexicalCast.h + src/ripple/beast/core/List.h + src/ripple/beast/core/PlatformConfig.h + src/ripple/beast/core/SemanticVersion.h + src/ripple/beast/core/StandardConfig.h + DESTINATION include/ripple/beast/core) +install ( + FILES + src/ripple/beast/crypto/detail/mac_facade.h + src/ripple/beast/crypto/detail/ripemd_context.h + src/ripple/beast/crypto/detail/sha2_context.h + src/ripple/beast/crypto/ripemd.h + src/ripple/beast/crypto/secure_erase.h + src/ripple/beast/crypto/sha2.h + DESTINATION include/ripple/beast/crypto) +install ( + FILES + src/ripple/beast/hash/endian.h + src/ripple/beast/hash/hash_append.h + src/ripple/beast/hash/meta.h + src/ripple/beast/hash/uhash.h + src/ripple/beast/hash/xxhasher.h + DESTINATION include/ripple/beast/hash) +install ( + FILES src/ripple/beast/hash/impl/xxhash.h + DESTINATION include/ripple/beast/hash/impl) +install ( + FILES + src/ripple/beast/rfc2616.h + src/ripple/beast/type_name.h + src/ripple/beast/unit_test.h + src/ripple/beast/xor_shift_engine.h + DESTINATION include/ripple/beast) +install ( + FILES + src/ripple/beast/utility/Journal.h + src/ripple/beast/utility/PropertyStream.h + src/ripple/beast/utility/Zero.h + src/ripple/beast/utility/rngfill.h + DESTINATION include/ripple/beast/utility) +# WARNING!! -- horrible levelization ahead +# (these files should be isolated or moved...but +# unfortunately unit_test.h above creates this dependency) +install ( + FILES + src/beast/extras/beast/unit_test/amount.hpp + src/beast/extras/beast/unit_test/dstream.hpp + src/beast/extras/beast/unit_test/global_suites.hpp + src/beast/extras/beast/unit_test/match.hpp + src/beast/extras/beast/unit_test/recorder.hpp + src/beast/extras/beast/unit_test/reporter.hpp + src/beast/extras/beast/unit_test/results.hpp + src/beast/extras/beast/unit_test/runner.hpp + src/beast/extras/beast/unit_test/suite.hpp + src/beast/extras/beast/unit_test/suite_info.hpp + src/beast/extras/beast/unit_test/suite_list.hpp + src/beast/extras/beast/unit_test/thread.hpp + DESTINATION include/beast/unit_test) +install ( + FILES + src/beast/extras/beast/unit_test/detail/const_container.hpp + DESTINATION include/beast/unit_test/detail) + +#[===================================================================[ + rippled executable +#]===================================================================] + +#[=========================================================[ + this one header is added as source just to keep older + versions of cmake happy. cmake 3.10+ allows + add_executable with no sources +#]=========================================================] +add_executable (rippled src/ripple/app/main/Application.h) +target_sources (rippled PRIVATE + $<$: + #[===============================[ + unity, main sources + #]===============================] + src/ripple/unity/app_consensus.cpp + src/ripple/unity/app_ledger.cpp + src/ripple/unity/app_ledger_impl.cpp + src/ripple/unity/app_main1.cpp + src/ripple/unity/app_main2.cpp + src/ripple/unity/app_misc.cpp + src/ripple/unity/app_misc_impl.cpp + src/ripple/unity/app_paths.cpp + src/ripple/unity/app_tx.cpp + src/ripple/unity/conditions.cpp + src/ripple/unity/consensus.cpp + src/ripple/unity/core.cpp + src/ripple/unity/basics2.cpp + src/ripple/unity/ledger.cpp + src/ripple/unity/net.cpp + src/ripple/unity/nodestore.cpp + src/ripple/unity/overlay1.cpp + src/ripple/unity/overlay2.cpp + src/ripple/unity/peerfinder.cpp + src/ripple/unity/resource.cpp + src/ripple/unity/rpcx1.cpp + src/ripple/unity/rpcx2.cpp + src/ripple/unity/shamap.cpp + src/ripple/unity/server.cpp + src/ripple/unity/soci_ripple.cpp + #[===============================[ + unity, test sources + #]===============================] + src/test/unity/app_test_unity1.cpp + src/test/unity/app_test_unity2.cpp + src/test/unity/basics_test_unity.cpp + src/test/unity/beast_test_unity1.cpp + src/test/unity/beast_test_unity2.cpp + src/test/unity/conditions_test_unity.cpp + src/test/unity/consensus_test_unity.cpp + src/test/unity/core_test_unity.cpp + src/test/unity/crypto_test_unity.cpp + src/test/unity/json_test_unity.cpp + src/test/unity/ledger_test_unity.cpp + src/test/unity/nodestore_test_unity.cpp + src/test/unity/overlay_test_unity.cpp + src/test/unity/peerfinder_test_unity.cpp + src/test/unity/protocol_test_unity.cpp + src/test/unity/resource_test_unity.cpp + src/test/unity/rpc_test_unity.cpp + src/test/unity/server_test_unity.cpp + src/test/unity/server_status_test_unity.cpp + src/test/unity/shamap_test_unity.cpp + src/test/unity/jtx_unity1.cpp + src/test/unity/jtx_unity2.cpp + src/test/unity/csf_unity.cpp + > + $<$>: + #[===============================[ + nounity, main sources: + subdir: app + #]===============================] + src/ripple/app/consensus/RCLConsensus.cpp + src/ripple/app/consensus/RCLCxPeerPos.cpp + src/ripple/app/consensus/RCLValidations.cpp + src/ripple/app/ledger/AcceptedLedger.cpp + src/ripple/app/ledger/AcceptedLedgerTx.cpp + src/ripple/app/ledger/AccountStateSF.cpp + src/ripple/app/ledger/BookListeners.cpp + src/ripple/app/ledger/ConsensusTransSetSF.cpp + src/ripple/app/ledger/Ledger.cpp + src/ripple/app/ledger/LedgerHistory.cpp + src/ripple/app/ledger/OrderBookDB.cpp + src/ripple/app/ledger/TransactionStateSF.cpp + src/ripple/app/ledger/impl/BuildLedger.cpp + src/ripple/app/ledger/impl/InboundLedger.cpp + src/ripple/app/ledger/impl/InboundLedgers.cpp + src/ripple/app/ledger/impl/InboundTransactions.cpp + src/ripple/app/ledger/impl/LedgerCleaner.cpp + src/ripple/app/ledger/impl/LedgerMaster.cpp + src/ripple/app/ledger/impl/LedgerReplay.cpp + src/ripple/app/ledger/impl/LedgerToJson.cpp + src/ripple/app/ledger/impl/LocalTxs.cpp + src/ripple/app/ledger/impl/OpenLedger.cpp + src/ripple/app/ledger/impl/TransactionAcquire.cpp + src/ripple/app/ledger/impl/TransactionMaster.cpp + src/ripple/app/main/Application.cpp + src/ripple/app/main/BasicApp.cpp + src/ripple/app/main/CollectorManager.cpp + src/ripple/app/main/DBInit.cpp + src/ripple/app/main/LoadManager.cpp + src/ripple/app/main/Main.cpp + src/ripple/app/main/NodeIdentity.cpp + src/ripple/app/main/NodeStoreScheduler.cpp + src/ripple/app/misc/CanonicalTXSet.cpp + src/ripple/app/misc/FeeVoteImpl.cpp + src/ripple/app/misc/HashRouter.cpp + src/ripple/app/misc/NetworkOPs.cpp + src/ripple/app/misc/SHAMapStoreImp.cpp + src/ripple/app/misc/impl/AccountTxPaging.cpp + src/ripple/app/misc/impl/AmendmentTable.cpp + src/ripple/app/misc/impl/LoadFeeTrack.cpp + src/ripple/app/misc/impl/Manifest.cpp + src/ripple/app/misc/impl/Transaction.cpp + src/ripple/app/misc/impl/TxQ.cpp + src/ripple/app/misc/impl/ValidatorKeys.cpp + src/ripple/app/misc/impl/ValidatorList.cpp + src/ripple/app/misc/impl/ValidatorSite.cpp + src/ripple/app/paths/AccountCurrencies.cpp + src/ripple/app/paths/Credit.cpp + src/ripple/app/paths/Flow.cpp + src/ripple/app/paths/Node.cpp + src/ripple/app/paths/PathRequest.cpp + src/ripple/app/paths/PathRequests.cpp + src/ripple/app/paths/PathState.cpp + src/ripple/app/paths/Pathfinder.cpp + src/ripple/app/paths/RippleCalc.cpp + src/ripple/app/paths/RippleLineCache.cpp + src/ripple/app/paths/RippleState.cpp + src/ripple/app/paths/cursor/AdvanceNode.cpp + src/ripple/app/paths/cursor/DeliverNodeForward.cpp + src/ripple/app/paths/cursor/DeliverNodeReverse.cpp + src/ripple/app/paths/cursor/EffectiveRate.cpp + src/ripple/app/paths/cursor/ForwardLiquidity.cpp + src/ripple/app/paths/cursor/ForwardLiquidityForAccount.cpp + src/ripple/app/paths/cursor/Liquidity.cpp + src/ripple/app/paths/cursor/NextIncrement.cpp + src/ripple/app/paths/cursor/ReverseLiquidity.cpp + src/ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp + src/ripple/app/paths/cursor/RippleLiquidity.cpp + src/ripple/app/paths/impl/BookStep.cpp + src/ripple/app/paths/impl/DirectStep.cpp + src/ripple/app/paths/impl/PaySteps.cpp + src/ripple/app/paths/impl/XRPEndpointStep.cpp + src/ripple/app/tx/impl/ApplyContext.cpp + src/ripple/app/tx/impl/BookTip.cpp + src/ripple/app/tx/impl/CancelCheck.cpp + src/ripple/app/tx/impl/CancelOffer.cpp + src/ripple/app/tx/impl/CancelTicket.cpp + src/ripple/app/tx/impl/CashCheck.cpp + src/ripple/app/tx/impl/Change.cpp + src/ripple/app/tx/impl/CreateCheck.cpp + src/ripple/app/tx/impl/CreateOffer.cpp + src/ripple/app/tx/impl/CreateTicket.cpp + src/ripple/app/tx/impl/DepositPreauth.cpp + src/ripple/app/tx/impl/Escrow.cpp + src/ripple/app/tx/impl/InvariantCheck.cpp + src/ripple/app/tx/impl/OfferStream.cpp + src/ripple/app/tx/impl/PayChan.cpp + src/ripple/app/tx/impl/Payment.cpp + src/ripple/app/tx/impl/SetAccount.cpp + src/ripple/app/tx/impl/SetRegularKey.cpp + src/ripple/app/tx/impl/SetSignerList.cpp + src/ripple/app/tx/impl/SetTrust.cpp + src/ripple/app/tx/impl/SignerEntries.cpp + src/ripple/app/tx/impl/Taker.cpp + src/ripple/app/tx/impl/Transactor.cpp + src/ripple/app/tx/impl/apply.cpp + src/ripple/app/tx/impl/applySteps.cpp + #[===============================[ + nounity, main sources: + subdir: basics (partial) + #]===============================] + src/ripple/basics/impl/BasicConfig.cpp + src/ripple/basics/impl/PerfLogImp.cpp + src/ripple/basics/impl/ResolverAsio.cpp + src/ripple/basics/impl/Sustain.cpp + src/ripple/basics/impl/UptimeClock.cpp + src/ripple/basics/impl/make_SSLContext.cpp + src/ripple/basics/impl/mulDiv.cpp + #[===============================[ + nounity, main sources: + subdir: conditions + #]===============================] + src/ripple/conditions/impl/Condition.cpp + src/ripple/conditions/impl/Fulfillment.cpp + src/ripple/conditions/impl/error.cpp + #[===============================[ + nounity, main sources: + subdir: core + #]===============================] + src/ripple/core/impl/Config.cpp + src/ripple/core/impl/DatabaseCon.cpp + src/ripple/core/impl/DummySociDynamicBackend.cpp + src/ripple/core/impl/Job.cpp + src/ripple/core/impl/JobQueue.cpp + src/ripple/core/impl/LoadEvent.cpp + src/ripple/core/impl/LoadMonitor.cpp + src/ripple/core/impl/SNTPClock.cpp + src/ripple/core/impl/SociDB.cpp + src/ripple/core/impl/Stoppable.cpp + src/ripple/core/impl/TerminateHandler.cpp + src/ripple/core/impl/TimeKeeper.cpp + src/ripple/core/impl/Workers.cpp + #[===============================[ + nounity, main sources: + subdir: consensus + #]===============================] + src/ripple/consensus/Consensus.cpp + #[===============================[ + nounity, main sources: + subdir: ledger + #]===============================] + src/ripple/ledger/impl/ApplyStateTable.cpp + src/ripple/ledger/impl/ApplyView.cpp + src/ripple/ledger/impl/ApplyViewBase.cpp + src/ripple/ledger/impl/ApplyViewImpl.cpp + src/ripple/ledger/impl/BookDirs.cpp + src/ripple/ledger/impl/CachedSLEs.cpp + src/ripple/ledger/impl/CachedView.cpp + src/ripple/ledger/impl/CashDiff.cpp + src/ripple/ledger/impl/Directory.cpp + src/ripple/ledger/impl/OpenView.cpp + src/ripple/ledger/impl/PaymentSandbox.cpp + src/ripple/ledger/impl/RawStateTable.cpp + src/ripple/ledger/impl/ReadView.cpp + src/ripple/ledger/impl/TxMeta.cpp + src/ripple/ledger/impl/View.cpp + #[===============================[ + nounity, main sources: + subdir: net + #]===============================] + src/ripple/net/impl/HTTPClient.cpp + src/ripple/net/impl/InfoSub.cpp + src/ripple/net/impl/RPCCall.cpp + src/ripple/net/impl/RPCErr.cpp + src/ripple/net/impl/RPCSub.cpp + src/ripple/net/impl/RegisterSSLCerts.cpp + #[===============================[ + nounity, main sources: + subdir: nodestore + #]===============================] + src/ripple/nodestore/backend/MemoryFactory.cpp + src/ripple/nodestore/backend/NuDBFactory.cpp + src/ripple/nodestore/backend/NullFactory.cpp + src/ripple/nodestore/backend/RocksDBFactory.cpp + src/ripple/nodestore/backend/RocksDBQuickFactory.cpp + src/ripple/nodestore/impl/BatchWriter.cpp + src/ripple/nodestore/impl/Database.cpp + src/ripple/nodestore/impl/DatabaseNodeImp.cpp + src/ripple/nodestore/impl/DatabaseRotatingImp.cpp + src/ripple/nodestore/impl/DatabaseShardImp.cpp + src/ripple/nodestore/impl/DecodedBlob.cpp + src/ripple/nodestore/impl/DummyScheduler.cpp + src/ripple/nodestore/impl/EncodedBlob.cpp + src/ripple/nodestore/impl/ManagerImp.cpp + src/ripple/nodestore/impl/NodeObject.cpp + src/ripple/nodestore/impl/Shard.cpp + #[===============================[ + nounity, main sources: + subdir: overlay + #]===============================] + src/ripple/overlay/impl/Cluster.cpp + src/ripple/overlay/impl/ConnectAttempt.cpp + src/ripple/overlay/impl/Message.cpp + src/ripple/overlay/impl/OverlayImpl.cpp + src/ripple/overlay/impl/PeerImp.cpp + src/ripple/overlay/impl/PeerSet.cpp + src/ripple/overlay/impl/TMHello.cpp + src/ripple/overlay/impl/TrafficCount.cpp + #[===============================[ + nounity, main sources: + subdir: peerfinder + #]===============================] + src/ripple/peerfinder/impl/Bootcache.cpp + src/ripple/peerfinder/impl/Endpoint.cpp + src/ripple/peerfinder/impl/PeerfinderConfig.cpp + src/ripple/peerfinder/impl/PeerfinderManager.cpp + src/ripple/peerfinder/impl/SlotImp.cpp + src/ripple/peerfinder/impl/SourceStrings.cpp + #[===============================[ + nounity, main sources: + subdir: resource + #]===============================] + src/ripple/resource/impl/Charge.cpp + src/ripple/resource/impl/Consumer.cpp + src/ripple/resource/impl/Fees.cpp + src/ripple/resource/impl/ResourceManager.cpp + #[===============================[ + nounity, main sources: + subdir: rpc + #]===============================] + src/ripple/rpc/handlers/AccountChannels.cpp + src/ripple/rpc/handlers/AccountCurrenciesHandler.cpp + src/ripple/rpc/handlers/AccountInfo.cpp + src/ripple/rpc/handlers/AccountLines.cpp + src/ripple/rpc/handlers/AccountObjects.cpp + src/ripple/rpc/handlers/AccountOffers.cpp + src/ripple/rpc/handlers/AccountTx.cpp + src/ripple/rpc/handlers/AccountTxOld.cpp + src/ripple/rpc/handlers/AccountTxSwitch.cpp + src/ripple/rpc/handlers/BlackList.cpp + src/ripple/rpc/handlers/BookOffers.cpp + src/ripple/rpc/handlers/CanDelete.cpp + src/ripple/rpc/handlers/Connect.cpp + src/ripple/rpc/handlers/ConsensusInfo.cpp + src/ripple/rpc/handlers/DepositAuthorized.cpp + src/ripple/rpc/handlers/Feature1.cpp + src/ripple/rpc/handlers/Fee1.cpp + src/ripple/rpc/handlers/FetchInfo.cpp + src/ripple/rpc/handlers/GatewayBalances.cpp + src/ripple/rpc/handlers/GetCounts.cpp + src/ripple/rpc/handlers/LedgerAccept.cpp + src/ripple/rpc/handlers/LedgerCleanerHandler.cpp + src/ripple/rpc/handlers/LedgerClosed.cpp + src/ripple/rpc/handlers/LedgerCurrent.cpp + src/ripple/rpc/handlers/LedgerData.cpp + src/ripple/rpc/handlers/LedgerEntry.cpp + src/ripple/rpc/handlers/LedgerHandler.cpp + src/ripple/rpc/handlers/LedgerHeader.cpp + src/ripple/rpc/handlers/LedgerRequest.cpp + src/ripple/rpc/handlers/LogLevel.cpp + src/ripple/rpc/handlers/LogRotate.cpp + src/ripple/rpc/handlers/NoRippleCheck.cpp + src/ripple/rpc/handlers/OwnerInfo.cpp + src/ripple/rpc/handlers/PathFind.cpp + src/ripple/rpc/handlers/PayChanClaim.cpp + src/ripple/rpc/handlers/Peers.cpp + src/ripple/rpc/handlers/Ping.cpp + src/ripple/rpc/handlers/Print.cpp + src/ripple/rpc/handlers/Random.cpp + src/ripple/rpc/handlers/RipplePathFind.cpp + src/ripple/rpc/handlers/ServerInfo.cpp + src/ripple/rpc/handlers/ServerState.cpp + src/ripple/rpc/handlers/SignFor.cpp + src/ripple/rpc/handlers/SignHandler.cpp + src/ripple/rpc/handlers/Stop.cpp + src/ripple/rpc/handlers/Submit.cpp + src/ripple/rpc/handlers/SubmitMultiSigned.cpp + src/ripple/rpc/handlers/Subscribe.cpp + src/ripple/rpc/handlers/TransactionEntry.cpp + src/ripple/rpc/handlers/Tx.cpp + src/ripple/rpc/handlers/TxHistory.cpp + src/ripple/rpc/handlers/UnlList.cpp + src/ripple/rpc/handlers/Unsubscribe.cpp + src/ripple/rpc/handlers/ValidationCreate.cpp + src/ripple/rpc/handlers/ValidationSeed.cpp + src/ripple/rpc/handlers/ValidatorListSites.cpp + src/ripple/rpc/handlers/Validators.cpp + src/ripple/rpc/handlers/WalletPropose.cpp + src/ripple/rpc/impl/Handler.cpp + src/ripple/rpc/impl/LegacyPathFind.cpp + src/ripple/rpc/impl/RPCHandler.cpp + src/ripple/rpc/impl/RPCHelpers.cpp + src/ripple/rpc/impl/Role.cpp + src/ripple/rpc/impl/ServerHandlerImp.cpp + src/ripple/rpc/impl/Status.cpp + src/ripple/rpc/impl/TransactionSign.cpp + #[===============================[ + nounity, main sources: + subdir: server + #]===============================] + src/ripple/server/impl/JSONRPCUtil.cpp + src/ripple/server/impl/Port.cpp + #[===============================[ + nounity, main sources: + subdir: shamap + #]===============================] + src/ripple/shamap/impl/SHAMap.cpp + src/ripple/shamap/impl/SHAMapDelta.cpp + src/ripple/shamap/impl/SHAMapItem.cpp + src/ripple/shamap/impl/SHAMapMissingNode.cpp + src/ripple/shamap/impl/SHAMapNodeID.cpp + src/ripple/shamap/impl/SHAMapSync.cpp + src/ripple/shamap/impl/SHAMapTreeNode.cpp + #[===============================[ + nounity, test sources: + subdir: app + #]===============================] + src/test/app/AccountTxPaging_test.cpp + src/test/app/AmendmentTable_test.cpp + src/test/app/Check_test.cpp + src/test/app/CrossingLimits_test.cpp + src/test/app/DeliverMin_test.cpp + src/test/app/DepositAuth_test.cpp + src/test/app/Discrepancy_test.cpp + src/test/app/Escrow_test.cpp + src/test/app/Flow_test.cpp + src/test/app/Freeze_test.cpp + src/test/app/HashRouter_test.cpp + src/test/app/LedgerHistory_test.cpp + src/test/app/LedgerLoad_test.cpp + src/test/app/LedgerReplay_test.cpp + src/test/app/LoadFeeTrack_test.cpp + src/test/app/Manifest_test.cpp + src/test/app/MultiSign_test.cpp + src/test/app/OfferStream_test.cpp + src/test/app/Offer_test.cpp + src/test/app/OversizeMeta_test.cpp + src/test/app/Path_test.cpp + src/test/app/PayChan_test.cpp + src/test/app/PayStrand_test.cpp + src/test/app/PseudoTx_test.cpp + src/test/app/RCLValidations_test.cpp + src/test/app/Regression_test.cpp + src/test/app/SHAMapStore_test.cpp + src/test/app/SetAuth_test.cpp + src/test/app/SetRegularKey_test.cpp + src/test/app/SetTrust_test.cpp + src/test/app/Taker_test.cpp + src/test/app/Ticket_test.cpp + src/test/app/Transaction_ordering_test.cpp + src/test/app/TrustAndBalance_test.cpp + src/test/app/TxQ_test.cpp + src/test/app/ValidatorKeys_test.cpp + src/test/app/ValidatorList_test.cpp + src/test/app/ValidatorSite_test.cpp + #[===============================[ + nounity, test sources: + subdir: basics + #]===============================] + src/test/basics/Buffer_test.cpp + src/test/basics/DetectCrash_test.cpp + src/test/basics/KeyCache_test.cpp + src/test/basics/PerfLog_test.cpp + src/test/basics/RangeSet_test.cpp + src/test/basics/Slice_test.cpp + src/test/basics/StringUtilities_test.cpp + src/test/basics/TaggedCache_test.cpp + src/test/basics/base_uint_test.cpp + src/test/basics/contract_test.cpp + src/test/basics/hardened_hash_test.cpp + src/test/basics/mulDiv_test.cpp + src/test/basics/tagged_integer_test.cpp + #[===============================[ + nounity, test sources: + subdir: beast + #]===============================] + src/test/beast/IPEndpoint_test.cpp + src/test/beast/LexicalCast_test.cpp + src/test/beast/SemanticVersion_test.cpp + src/test/beast/aged_associative_container_test.cpp + src/test/beast/beast_CurrentThreadName_test.cpp + src/test/beast/beast_Debug_test.cpp + src/test/beast/beast_Journal_test.cpp + src/test/beast/beast_PropertyStream_test.cpp + src/test/beast/beast_Zero_test.cpp + src/test/beast/beast_abstract_clock_test.cpp + src/test/beast/beast_asio_error_test.cpp + src/test/beast/beast_basic_seconds_clock_test.cpp + src/test/beast/beast_weak_fn_test.cpp + src/test/beast/define_print.cpp + #[===============================[ + nounity, test sources: + subdir: conditions + #]===============================] + src/test/conditions/PreimageSha256_test.cpp + #[===============================[ + nounity, test sources: + subdir: consensus + #]===============================] + src/test/consensus/ByzantineFailureSim_test.cpp + src/test/consensus/Consensus_test.cpp + src/test/consensus/DistributedValidatorsSim_test.cpp + src/test/consensus/LedgerTiming_test.cpp + src/test/consensus/LedgerTrie_test.cpp + src/test/consensus/ScaleFreeSim_test.cpp + src/test/consensus/Validations_test.cpp + #[===============================[ + nounity, test sources: + subdir: core + #]===============================] + src/test/core/ClosureCounter_test.cpp + src/test/core/Config_test.cpp + src/test/core/Coroutine_test.cpp + src/test/core/CryptoPRNG_test.cpp + src/test/core/JobQueue_test.cpp + src/test/core/SociDB_test.cpp + src/test/core/Stoppable_test.cpp + src/test/core/TerminateHandler_test.cpp + src/test/core/Workers_test.cpp + #[===============================[ + nounity, test sources: + subdir: crypto + #]===============================] + src/test/crypto/Openssl_test.cpp + #[===============================[ + nounity, test sources: + subdir: csf + #]===============================] + src/test/csf/BasicNetwork_test.cpp + src/test/csf/Digraph_test.cpp + src/test/csf/Histogram_test.cpp + src/test/csf/Scheduler_test.cpp + src/test/csf/impl/Sim.cpp + src/test/csf/impl/ledgers.cpp + #[===============================[ + nounity, test sources: + subdir: json + #]===============================] + src/test/json/Object_test.cpp + src/test/json/Output_test.cpp + src/test/json/Writer_test.cpp + src/test/json/json_value_test.cpp + #[===============================[ + nounity, test sources: + subdir: jtx + #]===============================] + src/test/jtx/Env_test.cpp + src/test/jtx/WSClient_test.cpp + src/test/jtx/impl/Account.cpp + src/test/jtx/impl/Env.cpp + src/test/jtx/impl/JSONRPCClient.cpp + src/test/jtx/impl/ManualTimeKeeper.cpp + src/test/jtx/impl/WSClient.cpp + src/test/jtx/impl/amount.cpp + src/test/jtx/impl/balance.cpp + src/test/jtx/impl/delivermin.cpp + src/test/jtx/impl/deposit.cpp + src/test/jtx/impl/envconfig.cpp + src/test/jtx/impl/fee.cpp + src/test/jtx/impl/flags.cpp + src/test/jtx/impl/jtx_json.cpp + src/test/jtx/impl/memo.cpp + src/test/jtx/impl/multisign.cpp + src/test/jtx/impl/offer.cpp + src/test/jtx/impl/owners.cpp + src/test/jtx/impl/paths.cpp + src/test/jtx/impl/pay.cpp + src/test/jtx/impl/quality2.cpp + src/test/jtx/impl/rate.cpp + src/test/jtx/impl/regkey.cpp + src/test/jtx/impl/sendmax.cpp + src/test/jtx/impl/seq.cpp + src/test/jtx/impl/sig.cpp + src/test/jtx/impl/tag.cpp + src/test/jtx/impl/ticket.cpp + src/test/jtx/impl/trust.cpp + src/test/jtx/impl/txflags.cpp + src/test/jtx/impl/utility.cpp + #[===============================[ + nounity, test sources: + subdir: ledger + #]===============================] + src/test/ledger/BookDirs_test.cpp + src/test/ledger/CashDiff_test.cpp + src/test/ledger/Directory_test.cpp + src/test/ledger/Invariants_test.cpp + src/test/ledger/PaymentSandbox_test.cpp + src/test/ledger/PendingSaves_test.cpp + src/test/ledger/SHAMapV2_test.cpp + src/test/ledger/SkipList_test.cpp + src/test/ledger/View_test.cpp + #[===============================[ + nounity, test sources: + subdir: nodestore + #]===============================] + src/test/nodestore/Backend_test.cpp + src/test/nodestore/Basics_test.cpp + src/test/nodestore/Database_test.cpp + src/test/nodestore/Timing_test.cpp + src/test/nodestore/import_test.cpp + src/test/nodestore/varint_test.cpp + #[===============================[ + nounity, test sources: + subdir: overlay + #]===============================] + src/test/overlay/TMHello_test.cpp + src/test/overlay/cluster_test.cpp + src/test/overlay/short_read_test.cpp + #[===============================[ + nounity, test sources: + subdir: peerfinder + #]===============================] + src/test/peerfinder/Livecache_test.cpp + src/test/peerfinder/PeerFinder_test.cpp + #[===============================[ + nounity, test sources: + subdir: protocol + #]===============================] + src/test/protocol/BuildInfo_test.cpp + src/test/protocol/IOUAmount_test.cpp + src/test/protocol/InnerObjectFormats_test.cpp + src/test/protocol/Issue_test.cpp + src/test/protocol/PublicKey_test.cpp + src/test/protocol/Quality_test.cpp + src/test/protocol/STAccount_test.cpp + src/test/protocol/STAmount_test.cpp + src/test/protocol/STObject_test.cpp + src/test/protocol/STTx_test.cpp + src/test/protocol/STValidation_test.cpp + src/test/protocol/SecretKey_test.cpp + src/test/protocol/Seed_test.cpp + src/test/protocol/TER_test.cpp + src/test/protocol/XRPAmount_test.cpp + src/test/protocol/digest_test.cpp + src/test/protocol/types_test.cpp + #[===============================[ + nounity, test sources: + subdir: resource + #]===============================] + src/test/resource/Logic_test.cpp + #[===============================[ + nounity, test sources: + subdir: rpc + #]===============================] + src/test/rpc/AccountCurrencies_test.cpp + src/test/rpc/AccountInfo_test.cpp + src/test/rpc/AccountLinesRPC_test.cpp + src/test/rpc/AccountObjects_test.cpp + src/test/rpc/AccountOffers_test.cpp + src/test/rpc/AccountSet_test.cpp + src/test/rpc/AccountTx_test.cpp + src/test/rpc/AmendmentBlocked_test.cpp + src/test/rpc/Book_test.cpp + src/test/rpc/DepositAuthorized_test.cpp + src/test/rpc/Feature_test.cpp + src/test/rpc/GatewayBalances_test.cpp + src/test/rpc/GetCounts_test.cpp + src/test/rpc/JSONRPC_test.cpp + src/test/rpc/KeyGeneration_test.cpp + src/test/rpc/LedgerClosed_test.cpp + src/test/rpc/LedgerData_test.cpp + src/test/rpc/LedgerRPC_test.cpp + src/test/rpc/LedgerRequestRPC_test.cpp + src/test/rpc/NoRippleCheck_test.cpp + src/test/rpc/NoRipple_test.cpp + src/test/rpc/OwnerInfo_test.cpp + src/test/rpc/Peers_test.cpp + src/test/rpc/RPCOverload_test.cpp + src/test/rpc/RobustTransaction_test.cpp + src/test/rpc/ServerInfo_test.cpp + src/test/rpc/Status_test.cpp + src/test/rpc/Subscribe_test.cpp + src/test/rpc/TransactionEntry_test.cpp + src/test/rpc/TransactionHistory_test.cpp + src/test/rpc/ValidatorRPC_test.cpp + #[===============================[ + nounity, test sources: + subdir: server + #]===============================] + src/test/server/ServerStatus_test.cpp + src/test/server/Server_test.cpp + #[===============================[ + nounity, test sources: + subdir: shamap + #]===============================] + src/test/shamap/FetchPack_test.cpp + src/test/shamap/SHAMapSync_test.cpp + src/test/shamap/SHAMap_test.cpp + #[===============================[ + nounity, test sources: + subdir: unit_test + #]===============================] + src/test/unit_test/multi_runner.cpp + >) +target_link_libraries (rippled + Ripple::opts + Ripple::libs + Ripple::boost + Ripple::xrpl_core) + +#[===================================================================[ + install stuff +#]===================================================================] + +install ( + TARGETS + secp256k1 + ed25519-donna + common + opts + ripple_syslibs + ripple_boost + xrpl_core + EXPORT RippleExports + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include) +install (EXPORT RippleExports + FILE RippleTargets.cmake + NAMESPACE Ripple:: + DESTINATION lib/cmake/ripple) +include (CMakePackageConfigHelpers) +write_basic_package_version_file ( + RippleConfigVersion.cmake + VERSION ${rippled_version} + COMPATIBILITY SameMajorVersion) + +if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) + install (TARGETS rippled RUNTIME DESTINATION bin) + set_target_properties(rippled PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON) + install ( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/RippleConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/RippleConfigVersion.cmake + DESTINATION lib/cmake/ripple) + # sample configs should not overwrite existing files + # install if-not-exists workaround as suggested by + # https://cmake.org/Bug/view.php?id=12646 + install(CODE " + macro (copy_if_not_exists SRC DEST NEWNAME) + if (NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DEST}/\${NEWNAME}\") + file (INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${DEST}\" FILES \"\${SRC}\" RENAME \"\${NEWNAME}\") + else () + message (\"-- Skipping : \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DEST}/\${NEWNAME}\") + endif () + endmacro() + copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/rippled-example.cfg\" etc rippled.cfg) + copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt) + ") +else () + set_target_properties (rippled PROPERTIES EXCLUDE_FROM_ALL ON) + set_target_properties (rippled PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON) +endif () + +#[===================================================================[ + multiconfig misc +#]===================================================================] + +if (is_multiconfig) + # Rippled headers. Only useful for IDEs. + file (GLOB_RECURSE rippled_headers src/*.h src/*.hpp *.md) + target_sources (rippled PRIVATE ${rippled_headers}) + set_property ( + SOURCE ${rippled_headers} + APPEND + PROPERTY HEADER_FILE_ONLY true) + if (MSVC) + set_property( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY VS_STARTUP_PROJECT rippled) + endif () +endif () + +if (is_multiconfig) group_sources(src) group_sources(docs) group_sources(Builds) -endif() +endif () -if(unity) - add_executable(rippled ${rippled_src_unity} ${PROTO_HDRS}) - add_executable(rippled_classic EXCLUDE_FROM_ALL ${rippled_src_nonunity} ${PROTO_HDRS}) - set(other_target rippled_classic) -else() - add_executable(rippled ${rippled_src_nonunity} ${PROTO_HDRS}) - add_executable(rippled_unity EXCLUDE_FROM_ALL ${rippled_src_unity} ${PROTO_HDRS}) - set(other_target rippled_unity) -endif() -list(APPEND targets "rippled") -list(APPEND targets ${other_target}) -# Not the same as EXCLUDE_FROM_ALL. Prevents Visual Studio from building the -# other_target when the user builds the solution (default when pressing ) -set_property(TARGET ${other_target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD true) +#[===================================================================[ + docs target (optional) +#]===================================================================] -find_package(Doxygen) -if(TARGET Doxygen::doxygen) - # read the source config and make a modified one - # that points the output files to our build directory - FILE(READ "${CMAKE_SOURCE_DIR}/docs/source.dox" dox_content) - string(REGEX REPLACE "[\t ]*OUTPUT_DIRECTORY[\t ]*=(.*)" - "OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}\n\\1" - new_config "${dox_content}") - FILE(WRITE "${CMAKE_BINARY_DIR}/source.dox" "${new_config}") - add_custom_target(docs - COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/source.dox" - BYPRODUCTS "${CMAKE_BINARY_DIR}/html_doc/index.html" - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs" - SOURCES "${doc_srcs}" - ) -else() - message(WARNING - "doxygen executable not found. docs target will not be buildable") - if(${CMAKE_VERSION} VERSION_LESS "3.9.0") - message("...consider updating to CMake 3.9.0 or greater for better doxygen support") - endif() -endif() +find_package (Doxygen) +if (TARGET Doxygen::doxygen) + set (doc_srcs docs/source.dox) + file (GLOB_RECURSE other_docs docs/*.md) + list (APPEND doc_srcs "${other_docs}") + # read the source config and make a modified one + # that points the output files to our build directory + file (READ "${CMAKE_CURRENT_SOURCE_DIR}/docs/source.dox" dox_content) + string (REGEX REPLACE "[\t ]*OUTPUT_DIRECTORY[\t ]*=(.*)" + "OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}\n\\1" + new_config "${dox_content}") + file (WRITE "${CMAKE_BINARY_DIR}/source.dox" "${new_config}") + add_custom_target (docs + COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/source.dox" + BYPRODUCTS "${CMAKE_BINARY_DIR}/html_doc/index.html" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs" + SOURCES "${doc_srcs}") + if (is_multiconfig) + set_property ( + SOURCE ${doc_srcs} + APPEND + PROPERTY HEADER_FILE_ONLY + true) + endif () +else () + message (STATUS "doxygen executable not found -- skipping docs target") +endif () -set_startup_project(rippled) - -foreach(target IN LISTS targets) - target_link_libraries(${target} - ${OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARIES} ${SANITIZER_LIBRARIES}) - - link_common_libraries(${target}) -endforeach() - -if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - message(WARNING "Rippled requires a 64 bit target architecture.\n" - "The most likely cause of this warning is trying to build rippled with a 32-bit OS.") -endif() diff --git a/Jenkinsfile b/Jenkinsfile index 1237531d1..5bc016820 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,26 +110,26 @@ try { stage ('Parallel Build') { String[][] variants = [ - ['gcc.release.unity', '-Dassert=true', 'MANUAL_TESTS=true'], - ['coverage'], - ['docs'], - ['msvc.debug'], - // This one does not currently build (TBD): - //['msvc.debug.nounity'], - ['msvc.debug', '', 'PROJECT_NAME=rippled_classic'], - ['msvc.release'], - ['clang.debug.unity'], - ['clang.debug.unity', '', 'PARALLEL_TESTS=false'], - ['clang.debug.nounity'], - ['gcc.debug.unity'], - ['gcc.debug.nounity'], - ['clang.release.unity', '-Dassert=true'], - ['gcc.release.unity', '-Dassert=true'], - // add a static build just to make sure it works - ['gcc.debug.unity', '-Dstatic=true'], - // TODO - sanitizer runs currently fail - //['gcc.debug.nounity' , '-Dsan=address', 'PARALLEL_TESTS=false'], - //['gcc.debug.nounity' , '-Dsan=thread', 'PARALLEL_TESTS=false'], + ['gcc.Release' ,'-Dassert=ON' ,'MANUAL_TESTS=true' ], + ['gcc.Debug' ,'-Dcoverage=ON' ], + ['docs' ], + ['msvc.Debug' ], + ['msvc.Debug' ,'' ,'NINJA_BUILD=true' ], + ['msvc.Debug' ,'-Dunity=OFF' ], + ['msvc.Release' ], + ['clang.Debug' ], + ['clang.Debug' ,'-Dunity=OFF' ], + ['gcc.Debug' ], + ['gcc.Debug' ,'-Dunity=OFF' ], + ['clang.Release' ,'-Dassert=ON' ], + ['gcc.Release' ,'-Dassert=ON' ], + ['gcc.Debug' ,'-Dstatic=OFF' ], + ['gcc.Debug' ,'-Dstatic=OFF -DBUILD_SHARED_LIBS=ON' ], + ['gcc.Debug' ,'' ,'NINJA_BUILD=true' ], + ['clang.Debug' ,'-Dunity=OFF -Dsan=address' ,'PARALLEL_TESTS=false', 'DEBUGGER=false'], + ['clang.Debug' ,'-Dunity=OFF -Dsan=undefined' ,'PARALLEL_TESTS=false'], + // TODO - tsan runs currently fail/hang + //['clang.Debug' ,'-Dunity=OFF -Dsan=thread' ,'PARALLEL_TESTS=false'], ] // create a map of all builds @@ -149,31 +149,31 @@ try { bldlabel = bldlabel.replace('=', '_') def compiler = getFirstPart(bldtype) - def target = getSecondPart(bldtype) - def config = getFirstPart(target) - if (compiler == 'coverage' || compiler == 'docs') { + def config = getSecondPart(bldtype) + if (compiler == 'docs') { compiler = 'gcc' } def cc = (compiler == 'clang') ? '/opt/llvm-5.0.1/bin/clang' : 'gcc' def cxx = (compiler == 'clang') ? '/opt/llvm-5.0.1/bin/clang++' : 'g++' - def ucc = isNoUnity(target) ? 'true' : 'false' + def ucc = isNoUnity(cmake_extra) ? 'true' : 'false' def node_type = (compiler == 'msvc') ? 'rippled-win' : 'rippled-dev' // the default disposition for parallel test..disabled // for coverage, enabled otherwise. Can still be overridden // by explicitly setting with extra env settings above. - def pt = (compiler == 'coverage') ? 'false' : 'true' + def pt = isCoverage(cmake_extra) ? 'false' : 'true' + def max_minutes = 25 def env_vars = [ - "TARGET=${target}", - "CONFIG_TYPE=${config}", + "BUILD_TYPE=${config}", "COMPILER=${compiler}", "PARALLEL_TESTS=${pt}", 'BUILD=cmake', + "MAX_TIME=${max_minutes}m", "BUILD_DIR=${bldlabel}", - "CMAKE_EXTRA_ARGS=${cmake_extra}", + "CMAKE_EXTRA_ARGS=-Werr=ON ${cmake_extra}", 'VERBOSE_BUILD=true'] builds[bldlabel] = { @@ -185,8 +185,7 @@ try { def cdir = upDir(pwd()) echo "BASEDIR: ${cdir}" echo "COMPILER: ${compiler}" - echo "TARGET: ${target}" - echo "CONFIG: ${config}" + echo "BUILD_TYPE: ${config}" echo "USE_CC: ${ucc}" if (compiler == 'msvc') { env_vars.addAll([ @@ -223,28 +222,33 @@ try { withEnv(env_vars) { myStage(bldlabel) try { - if (compiler == 'msvc') { - powershell "Remove-Item -Path \"${bldlabel}.txt\" -Force -ErrorAction Ignore" - // we capture stdout to variable because I could - // not figure out how to make powershell redirect internally - output = powershell ( - returnStdout: true, - script: windowsBuildCmd()) - // if the powershell command fails (has nonzero exit) - // then the command above throws, we don't get our output, - // and we never create this output file. - // SEE https://issues.jenkins-ci.org/browse/JENKINS-44930 - // Alternatively, figure out how to reliably redirect - // all output above to a file (Start/Stop transcript does not work) - writeFile( - file: "${bldlabel}.txt", - text: output) - } - else { - sh "rm -fv ${bldlabel}.txt" - // execute the bld command in a redirecting shell - // to capture output - sh redhatBuildCmd(bldlabel) + timeout( + time: max_minutes * 2, + units: 'MINUTES') + { + if (compiler == 'msvc') { + powershell "Remove-Item -Path \"${bldlabel}.txt\" -Force -ErrorAction Ignore" + // we capture stdout to variable because I could + // not figure out how to make powershell redirect internally + output = powershell ( + returnStdout: true, + script: windowsBuildCmd()) + // if the powershell command fails (has nonzero exit) + // then the command above throws, we don't get our output, + // and we never create this output file. + // SEE https://issues.jenkins-ci.org/browse/JENKINS-44930 + // Alternatively, figure out how to reliably redirect + // all output above to a file (Start/Stop transcript does not work) + writeFile( + file: "${bldlabel}.txt", + text: output) + } + else { + sh "rm -fv ${bldlabel}.txt" + // execute the bld command in a redirecting shell + // to capture output + sh redhatBuildCmd(bldlabel) + } } } finally { @@ -518,7 +522,13 @@ def getFirstPart(bld) { @NonCPS def isNoUnity(bld) { - def matcher = bld =~ /\.nounity\s*$/ + def matcher = bld =~ /-Dunity=(off|OFF)/ + matcher ? true : false +} + +@NonCPS +def isCoverage(bld) { + def matcher = bld =~ /-Dcoverage=(on|ON)/ matcher ? true : false } @@ -544,7 +554,7 @@ set -ex log_file=''' + "${bldlabel}.txt" + ''' exec 3>&1 1>>${log_file} 2>&1 ccache -s -source /opt/rh/devtoolset-6/enable +source /opt/rh/devtoolset-7/enable /usr/bin/time -p ./bin/ci/ubuntu/build-and-test.sh 2>&1 ccache -s ''' @@ -568,10 +578,10 @@ $sw = [Diagnostics.Stopwatch]::StartNew() try { Push-Location "build/$env:BUILD_DIR" if ($env:NINJA_BUILD -eq "true") { - cmake -G"Ninja" -Dtarget="$env:COMPILER.$env:TARGET" -DCMAKE_VERBOSE_MAKEFILE=ON ../.. + Invoke-Expression "& cmake -G`"Ninja`" -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=ON $env:CMAKE_EXTRA_ARGS ../.." } else { - cmake -G"Visual Studio 15 2017 Win64" -Dtarget="$env:COMPILER.$env:TARGET" -DCMAKE_VERBOSE_MAKEFILE=ON ../.. + Invoke-Expression "& cmake -G`"Visual Studio 15 2017 Win64`" -DCMAKE_VERBOSE_MAKEFILE=ON $env:CMAKE_EXTRA_ARGS ../.." } if ($LastExitCode -ne 0) { throw "CMake failed" } @@ -584,11 +594,11 @@ try { ninja -j $env:NUMBER_OF_PROCESSORS -v } else { - msbuild /fl /m /nr:false /p:Configuration="$env:CONFIG_TYPE" /p:Platform=x64 /p:GenerateFullPaths=True /v:normal /nologo /clp:"ShowCommandLine;DisableConsoleColor" "$env:PROJECT_NAME.vcxproj" + msbuild /fl /m /nr:false /p:Configuration="$env:BUILD_TYPE" /p:Platform=x64 /p:GenerateFullPaths=True /v:normal /nologo /clp:"ShowCommandLine;DisableConsoleColor" "$env:PROJECT_NAME.vcxproj" } if ($LastExitCode -ne 0) { throw "CMake build failed" } - $exe = "./$env:CONFIG_TYPE/$env:PROJECT_NAME" + $exe = "./$env:BUILD_TYPE/$env:PROJECT_NAME" if ($env:NINJA_BUILD -eq "true") { $exe = "./$env:PROJECT_NAME" } @@ -711,9 +721,24 @@ def reportStatus(label, type, bldurl) { def txtcolor = fail_count == 0 ? 'DarkGreen' : 'Crimson' def shortbld = label - shortbld = shortbld.replace('debug', 'dbg') - shortbld = shortbld.replace('release', 'rel') - shortbld = shortbld.replace('unity', 'un') + // this is just an attempt to shorten the + // summary text label to the point of absurdity.. + shortbld = shortbld.replace('Debug', 'dbg') + shortbld = shortbld.replace('Release', 'rel') + shortbld = shortbld.replace('true', 'Y') + shortbld = shortbld.replace('false', 'N') + shortbld = shortbld.replace('Dcoverage', 'cov') + shortbld = shortbld.replace('Dassert', 'asrt') + shortbld = shortbld.replace('Dunity', 'unty') + shortbld = shortbld.replace('Dsan=address', 'asan') + shortbld = shortbld.replace('Dsan=thread', 'tsan') + shortbld = shortbld.replace('Dsan=undefined', 'ubsan') + shortbld = shortbld.replace('PARALLEL_TEST', 'PL') + shortbld = shortbld.replace('MANUAL_TESTS', 'MAN') + shortbld = shortbld.replace('NINJA_BUILD', 'ninja') + shortbld = shortbld.replace('DEBUGGER', 'gdb') + shortbld = shortbld.replace('ON', 'Y') + shortbld = shortbld.replace('OFF', 'N') manager.addShortText( "${shortbld}: ${st}, t: ${time}", txtcolor, diff --git a/appveyor.yml b/appveyor.yml index b3c221881..f2ba8ba55 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: # that it's a small download. We also use appveyor's free cache, avoiding fees # downloading from S3 each time. # TODO: script to create this package. - RIPPLED_DEPS_PATH: rippled_deps17.03 + RIPPLED_DEPS_PATH: rippled_deps17.04 RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip # CMake honors these environment variables, setting the include/lib paths. @@ -72,7 +72,7 @@ build_script: "$cmake_target" New-Item -ItemType Directory -Force -Path "build/$cmake_target" Push-Location "build/$cmake_target" - cmake -G"Visual Studio 15 2017 Win64" -Dtarget="$cmake_target" ../.. + cmake -G"Visual Studio 15 2017 Win64" ../.. if ($LastExitCode -ne 0) { throw "CMake failed" } cmake --build . --config $env:buildconfig -- -m if ($LastExitCode -ne 0) { throw "CMake build failed" } diff --git a/bin/ci/ubuntu/build-and-test.sh b/bin/ci/ubuntu/build-and-test.sh index 08b0d649a..512c38f40 100755 --- a/bin/ci/ubuntu/build-and-test.sh +++ b/bin/ci/ubuntu/build-and-test.sh @@ -7,12 +7,15 @@ set -ex __dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) echo "using CC: $CC" "${CC}" --version +export CC COMPNAME=$(basename $CC) echo "using CXX: ${CXX:-notset}" if [[ $CXX ]]; then "${CXX}" --version + export CXX fi -echo "using TARGET: $TARGET" +: ${BUILD_TYPE:=Debug} +echo "BUILD TYPE: $BUILD_TYPE" # Ensure APP defaults to rippled if it's not set. : ${APP:=rippled} @@ -36,15 +39,18 @@ echo "cmake building ${APP}" if [[ ${NINJA_BUILD:-} == true ]]; then CMAKE_EXTRA_ARGS+=" -G Ninja" fi -CMAKE_TARGET=${COMPNAME}.${TARGET} -if [[ ${CI:-} == true ]]; then - CMAKE_TARGET=$CMAKE_TARGET.ci + +coverage=false +if [[ "${CMAKE_EXTRA_ARGS}" =~ -Dcoverage=((on)|(ON)) ]] ; then + echo "coverage option detected." + coverage=true fi + # # allow explicit setting of the name of the build -# dir, otherwise default to the CMAKE_TARGET value +# dir, otherwise default to the compiler.build_type # -: "${BUILD_DIR:=$CMAKE_TARGET}" +: "${BUILD_DIR:=${COMPNAME}.${BUILD_TYPE}}" BUILDARGS=" -j${JOBS}" if [[ ${VERBOSE_BUILD:-} == true ]]; then CMAKE_EXTRA_ARGS+=" -DCMAKE_VERBOSE_MAKEFILE=ON" @@ -67,8 +73,8 @@ fi mkdir -p "build/${BUILD_DIR}" pushd "build/${BUILD_DIR}" -$time cmake ../.. -Dtarget=$CMAKE_TARGET ${CMAKE_EXTRA_ARGS} -if [[ ${TARGET} == "docs" ]]; then +$time cmake ../.. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${CMAKE_EXTRA_ARGS} +if [[ ${BUILD_TYPE} == "docs" ]]; then $time cmake --build . --target docs -- $BUILDARGS ## mimic the standard test output for docs build ## to make controlling processes like jenkins happy @@ -80,19 +86,11 @@ if [[ ${TARGET} == "docs" ]]; then exit else $time cmake --build . -- $BUILDARGS - if [[ ${BUILD_BOTH:-} == true ]]; then - if [[ ${TARGET} == *.unity ]]; then - cmake --build . --target rippled_classic -- $BUILDARGS - else - cmake --build . --target rippled_unity -- $BUILDARGS - fi - fi fi popd export APP_PATH="$PWD/build/${BUILD_DIR}/${APP}" echo "using APP_PATH: $APP_PATH" - # See what we've actually built ldd $APP_PATH @@ -129,7 +127,7 @@ if [[ ${APP} == "rippled" ]]; then export LCOV_FILES="*/src/ripple/*" # Nothing to explicitly exclude export LCOV_EXCLUDE_FILES="LCOV_NO_EXCLUDE" - if [[ $TARGET != "coverage" && ${PARALLEL_TESTS:-} == true ]]; then + if [[ ${coverage} == false && ${PARALLEL_TESTS:-} == true ]]; then APP_ARGS+=" --unittest-jobs ${JOBS}" fi else @@ -138,7 +136,7 @@ else : ${LCOV_EXCLUDE_FILES:="LCOV_NO_EXCLUDE"} fi -if [[ $TARGET == "coverage" ]]; then +if [[ $coverage == true ]]; then export PATH=$PATH:$LCOV_ROOT/usr/bin # Create baseline coverage data file @@ -146,16 +144,22 @@ if [[ $TARGET == "coverage" ]]; then fi if [[ ${SKIP_TESTS:-} == true ]]; then - echo "skipping tests for ${TARGET}" + echo "skipping tests." exit fi -if [[ $TARGET == debug* && -v GDB_ROOT && -x $GDB_ROOT/bin/gdb ]]; then +if [[ "${MAX_TIME:-}" == "" ]] ; then + tcmd="" +else + tcmd="timeout ${MAX_TIME}" +fi + +if [[ ${DEBUGGER:-true} == "true" && -v GDB_ROOT && -x $GDB_ROOT/bin/gdb ]]; then $GDB_ROOT/bin/gdb -v # Execute unit tests under gdb, printing a call stack # if we get a crash. export APP_ARGS - $GDB_ROOT/bin/gdb -return-child-result -quiet -batch \ + $tcmd $GDB_ROOT/bin/gdb -return-child-result -quiet -batch \ -ex "set env MALLOC_CHECK_=3" \ -ex "set print thread-events off" \ -ex run \ @@ -163,10 +167,10 @@ if [[ $TARGET == debug* && -v GDB_ROOT && -x $GDB_ROOT/bin/gdb ]]; then -ex "quit" \ --args $APP_PATH $APP_ARGS else - $APP_PATH $APP_ARGS + $tcmd $APP_PATH $APP_ARGS fi -if [[ $TARGET == "coverage" ]]; then +if [[ $coverage == true ]]; then # Create test coverage data file lcov --no-external -c -d . -o tests.info | grep -v "ignoring data for external file" diff --git a/docs/source.dox b/docs/source.dox index fa1b9eac1..474d437ff 100644 --- a/docs/source.dox +++ b/docs/source.dox @@ -137,8 +137,9 @@ INPUT = \ ../docs/HeapProfiling.md \ ../docs/Docker.md \ ../docs/consensus.md \ - ../Builds/XCode/README.md \ - ../Builds/VisualStudio2015/README.md \ + ../Builds/macos/README.md \ + ../Builds/linux/README.md \ + ../Builds/VisualStudio2017/README.md \ ../src/ripple/consensus/README.md \ ../src/ripple/app/consensus/README.md \ ../src/test/csf/README.md \ diff --git a/src/ed25519-donna/ed25519-donna-portable.h b/src/ed25519-donna/ed25519-donna-portable.h index 0a0f7fc3a..aad1441a9 100644 --- a/src/ed25519-donna/ed25519-donna-portable.h +++ b/src/ed25519-donna/ed25519-donna-portable.h @@ -20,6 +20,7 @@ #include #define DONNA_INLINE inline __attribute__((always_inline)) #define DONNA_NOINLINE __attribute__((noinline)) + #undef ALIGN #define ALIGN(x) __attribute__((aligned(x))) #define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b))) #define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b))) diff --git a/src/ripple/basics/impl/CheckLibraryVersionsImpl.h b/src/ripple/basics/impl/CheckLibraryVersionsImpl.h deleted file mode 100644 index 976f3ef8b..000000000 --- a/src/ripple/basics/impl/CheckLibraryVersionsImpl.h +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_BASICS_CHECKLIBRARYVERSIONSIMPL_H_INCLUDED -#define RIPPLE_BASICS_CHECKLIBRARYVERSIONSIMPL_H_INCLUDED - -#include - -namespace ripple { -namespace version { - -/** Both Boost and OpenSSL have integral version numbers. */ -using VersionNumber = unsigned long long; - -std::string -boostVersion(VersionNumber boostVersion); - -std::string -openSSLVersion(VersionNumber openSSLVersion); - -void checkVersion( - std::string name, - std::string required, - std::string actual); - -void checkBoost(std::string version); -void checkOpenSSL(std::string version); - -} // namespace version -} // namespace ripple - -#endif diff --git a/src/ripple/beast/core/BasicNativeHeaders.h b/src/ripple/beast/core/BasicNativeHeaders.h index 676ece863..cbb3089cb 100644 --- a/src/ripple/beast/core/BasicNativeHeaders.h +++ b/src/ripple/beast/core/BasicNativeHeaders.h @@ -231,4 +231,77 @@ #undef direct #undef check +// Order matters, since headers don't have their own #include lines. +// Add new includes to the bottom. + +#include +#include + +#include +#include + +#if ! BEAST_BSD + #include +#endif + +#if ! BEAST_ANDROID + #include +#endif + +#if BEAST_WINDOWS + #include + #include + #include + + #if ! BEAST_MINGW + #pragma warning ( push ) + #pragma warning ( disable: 4091 ) + #include + #pragma warning ( pop ) + + #if ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES + #pragma comment (lib, "DbgHelp.lib") + #endif + #endif + + #if BEAST_MINGW + #include + #endif + +#else + #if BEAST_LINUX || BEAST_ANDROID + #include + #include + #include + #include + #include + #endif + + #if BEAST_LINUX + #include + #endif + + #include + #include + #include + #include + #include + #include + #include + #include + + #if ! BEAST_ANDROID && ! BEAST_BSD + #include + #endif +#endif + +#if BEAST_MAC || BEAST_IOS + #include + #include +#endif + +#if BEAST_ANDROID + #include +#endif + #endif // BEAST_BASICNATIVEHEADERS_H_INCLUDED diff --git a/src/ripple/beast/core/CurrentThreadName.cpp b/src/ripple/beast/core/CurrentThreadName.cpp index cd3b495a8..21358d6f8 100644 --- a/src/ripple/beast/core/CurrentThreadName.cpp +++ b/src/ripple/beast/core/CurrentThreadName.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include namespace beast { namespace detail { diff --git a/src/ripple/beast/core/SemanticVersion.cpp b/src/ripple/beast/core/SemanticVersion.cpp index 4a0c9ea0d..6830b027c 100644 --- a/src/ripple/beast/core/SemanticVersion.cpp +++ b/src/ripple/beast/core/SemanticVersion.cpp @@ -22,6 +22,7 @@ #include #include +#include namespace beast { diff --git a/src/ripple/beast/core/core.unity.cpp b/src/ripple/beast/core/core.unity.cpp index ca7178c5f..b06129e1e 100644 --- a/src/ripple/beast/core/core.unity.cpp +++ b/src/ripple/beast/core/core.unity.cpp @@ -21,106 +21,10 @@ */ //============================================================================== -#if BEAST_INCLUDE_BEASTCONFIG -#endif - -//============================================================================== - #include - #include - -#if BEAST_MSVC -# pragma warning (disable: 4251) // (DLL build warning, must be disabled before pushing the warning state) -# pragma warning (push) -# pragma warning (disable: 4786) // (long class name warning) -# ifdef __INTEL_COMPILER -# pragma warning (disable: 1125) -# endif -#endif - -//------------------------------------------------------------------------------ - #include -// Order matters, since headers don't have their own #include lines. -// Add new includes to the bottom. - -#include - -#include - -#if BEAST_MSVC -#pragma warning (pop) -#endif - -#include -#include - -#if ! BEAST_BSD - #include -#endif - -#if ! BEAST_ANDROID - #include -#endif - -#if BEAST_WINDOWS - #include - #include - #include - - #if ! BEAST_MINGW - #pragma warning ( push ) - #pragma warning ( disable: 4091 ) - #include - #pragma warning ( pop ) - - #if ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES - #pragma comment (lib, "DbgHelp.lib") - #endif - #endif - - #if BEAST_MINGW - #include - #endif - -#else - #if BEAST_LINUX || BEAST_ANDROID - #include - #include - #include - #include - #include - #endif - - #if BEAST_LINUX - #include - #endif - - #include - #include - #include - #include - #include - #include - #include - #include - - #if ! BEAST_ANDROID && ! BEAST_BSD - #include - #endif -#endif - -#if BEAST_MAC || BEAST_IOS - #include - #include -#endif - -#if BEAST_ANDROID - #include -#endif - //------------------------------------------------------------------------------ // If the MSVC debug heap headers were included, disable diff --git a/src/ripple/beast/net/impl/IPAddressV4.cpp b/src/ripple/beast/net/impl/IPAddressV4.cpp index d437d7b6e..b683e3826 100644 --- a/src/ripple/beast/net/impl/IPAddressV4.cpp +++ b/src/ripple/beast/net/impl/IPAddressV4.cpp @@ -17,9 +17,6 @@ */ //============================================================================== -#if BEAST_INCLUDE_BEASTCONFIG -#endif - #include #include diff --git a/src/ripple/beast/net/impl/IPAddressV6.cpp b/src/ripple/beast/net/impl/IPAddressV6.cpp index 0e8d88714..503116b65 100644 --- a/src/ripple/beast/net/impl/IPAddressV6.cpp +++ b/src/ripple/beast/net/impl/IPAddressV6.cpp @@ -17,9 +17,6 @@ */ //============================================================================== -#if BEAST_INCLUDE_BEASTCONFIG -#endif - #include #include diff --git a/src/ripple/beast/net/impl/IPEndpoint.cpp b/src/ripple/beast/net/impl/IPEndpoint.cpp index eb0e2dbd9..95435e8b7 100644 --- a/src/ripple/beast/net/impl/IPEndpoint.cpp +++ b/src/ripple/beast/net/impl/IPEndpoint.cpp @@ -17,9 +17,6 @@ */ //============================================================================== -#if BEAST_INCLUDE_BEASTCONFIG -#endif - #include #include diff --git a/src/ripple/beast/unity/beast_utility_unity.cpp b/src/ripple/beast/unity/beast_utility_unity.cpp index 4e47a5099..4c24ae301 100644 --- a/src/ripple/beast/unity/beast_utility_unity.cpp +++ b/src/ripple/beast/unity/beast_utility_unity.cpp @@ -17,9 +17,6 @@ */ //============================================================================== -#if BEAST_INCLUDE_BEASTCONFIG -#endif - #include #include #include diff --git a/src/ripple/crypto/impl/GenerateDeterministicKey.cpp b/src/ripple/crypto/impl/GenerateDeterministicKey.cpp index 1f7d231ef..aa7f31ff0 100644 --- a/src/ripple/crypto/impl/GenerateDeterministicKey.cpp +++ b/src/ripple/crypto/impl/GenerateDeterministicKey.cpp @@ -49,7 +49,11 @@ struct secp256k1_data } }; -static secp256k1_data const secp256k1curve; +static secp256k1_data const& secp256k1curve() +{ + static secp256k1_data const curve {}; + return curve; +} } // namespace openssl @@ -96,7 +100,7 @@ static bignum generateRootDeterministicKey (uint128 const& seed) privKey.assign (root.data(), root.size()); beast::secure_erase(root.data(), root.size()); } - while (privKey.is_zero() || privKey >= secp256k1curve.order); + while (privKey.is_zero() || privKey >= secp256k1curve().order); beast::secure_erase(&seq, sizeof(seq)); return privKey; } @@ -110,7 +114,7 @@ Blob generateRootDeterministicPublicKey (uint128 const& seed) bignum privKey = generateRootDeterministicKey (seed); // compute the corresponding public key point - ec_point pubKey = multiply (secp256k1curve.group, privKey, ctx); + ec_point pubKey = multiply (secp256k1curve().group, privKey, ctx); privKey.clear(); // security erase @@ -129,7 +133,7 @@ uint256 generateRootDeterministicPrivateKey (uint128 const& seed) // <-- root public generator in EC format static ec_point generateRootPubKey (bignum&& pubGenerator) { - ec_point pubPoint = bn2point (secp256k1curve.group, pubGenerator.get()); + ec_point pubPoint = bn2point (secp256k1curve().group, pubGenerator.get()); return pubPoint; } @@ -169,13 +173,13 @@ Blob generatePublicDeterministicKey (Blob const& pubGen, int seq) bn_ctx ctx; // Calculate the private additional key. - bignum hash = makeHash (pubGen, seq, secp256k1curve.order); + bignum hash = makeHash (pubGen, seq, secp256k1curve().order); // Calculate the corresponding public key. - ec_point newPoint = multiply (secp256k1curve.group, hash, ctx); + ec_point newPoint = multiply (secp256k1curve().group, hash, ctx); // Add the master public key and set. - add_to (secp256k1curve.group, rootPubKey, newPoint, ctx); + add_to (secp256k1curve().group, rootPubKey, newPoint, ctx); return serialize_ec_point (newPoint); } @@ -190,10 +194,10 @@ uint256 generatePrivateDeterministicKey ( bn_ctx ctx; // calculate the private additional key - bignum privKey = makeHash (pubGen, seq, secp256k1curve.order); + bignum privKey = makeHash (pubGen, seq, secp256k1curve().order); // calculate the final private key - add_to (rootPrivKey, privKey, secp256k1curve.order, ctx); + add_to (rootPrivKey, privKey, secp256k1curve().order, ctx); rootPrivKey.clear(); // security erase diff --git a/src/ripple/protocol/impl/BuildInfo.cpp b/src/ripple/protocol/impl/BuildInfo.cpp index 8f5979c19..9e86a8370 100644 --- a/src/ripple/protocol/impl/BuildInfo.cpp +++ b/src/ripple/protocol/impl/BuildInfo.cpp @@ -26,14 +26,11 @@ namespace ripple { namespace BuildInfo { +//-------------------------------------------------------------------------- +// The build version number. You must edit this for each release +// and follow the format described at http://semver.org/ //------------------------------------------------------------------------------ -char const* const versionString = - - //-------------------------------------------------------------------------- - // The build version number. You must edit this for each release - // and follow the format described at http://semver.org/ - // - "1.1.0-b4" +char const* const versionString = "1.1.0-b4" #if defined(DEBUG) || defined(SANITIZER) "+" diff --git a/src/ripple/unity/beast.cpp b/src/ripple/unity/basics1.cpp similarity index 79% rename from src/ripple/unity/beast.cpp rename to src/ripple/unity/basics1.cpp index 6fd9a651c..3d85e2228 100644 --- a/src/ripple/unity/beast.cpp +++ b/src/ripple/unity/basics1.cpp @@ -17,6 +17,13 @@ */ //============================================================================== -// MUST come first! -#include +#include +#include +#include +#include +#include + +#if DOXYGEN +#include +#endif diff --git a/src/ripple/unity/basics.cpp b/src/ripple/unity/basics2.cpp similarity index 83% rename from src/ripple/unity/basics.cpp rename to src/ripple/unity/basics2.cpp index 92f16b1e5..2d1f4c380 100644 --- a/src/ripple/unity/basics.cpp +++ b/src/ripple/unity/basics2.cpp @@ -17,20 +17,12 @@ */ //============================================================================== - #include -#include -#include -#include #include #include #include #include -#include -#include #include #include -#if DOXYGEN -#include -#endif + diff --git a/src/ripple/unity/ed25519_donna.c b/src/ripple/unity/ed25519_donna.c deleted file mode 100644 index fc2e7a698..000000000 --- a/src/ripple/unity/ed25519_donna.c +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef _MSC_VER -#include -#undef ALIGN -#endif -#include diff --git a/src/ripple/unity/lz4.c b/src/ripple/unity/lz4.c deleted file mode 100644 index 68431daf9..000000000 --- a/src/ripple/unity/lz4.c +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2015 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#ifdef _MSC_VER -#include -#endif - diff --git a/src/ripple/unity/protobuf.cpp b/src/ripple/unity/protobuf.cpp index 060b7a551..f9268ddf6 100644 --- a/src/ripple/unity/protobuf.cpp +++ b/src/ripple/unity/protobuf.cpp @@ -1,16 +1,6 @@ // Unity build file for libprotobuf by Vinnie Falco // -#ifdef _MSC_VER - -#ifdef _MSC_VER // MSVC -# pragma warning (push) -# pragma warning (disable: 4018) // signed/unsigned mismatch -# pragma warning (disable: 4244) // conversion, possible loss of data -# pragma warning (disable: 4800) // forcing value to bool -# pragma warning (disable: 4996) // deprecated POSIX name -#endif - #include "google/protobuf/descriptor.cc" #include "google/protobuf/descriptor.pb.cc" #include "google/protobuf/descriptor_database.cc" @@ -50,8 +40,3 @@ #include "google/protobuf/stubs/atomicops_internals_x86_msvc.cc" #endif -#ifdef _MSC_VER // MSVC -# pragma warning (pop) -#endif - -#endif diff --git a/src/ripple/unity/ripple.proto.cpp b/src/ripple/unity/ripple.proto.cpp deleted file mode 100644 index 043309644..000000000 --- a/src/ripple/unity/ripple.proto.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include "ripple.pb.cc" diff --git a/src/ripple/unity/rocksdb.cpp b/src/ripple/unity/rocksdb.cpp index 1e60162b8..c20db57b7 100644 --- a/src/ripple/unity/rocksdb.cpp +++ b/src/ripple/unity/rocksdb.cpp @@ -22,26 +22,6 @@ #if RIPPLE_ROCKSDB_AVAILABLE -#if BEAST_WIN32 -# define ROCKSDB_PLATFORM_WINDOWS -#else -# define ROCKSDB_PLATFORM_POSIX -# if BEAST_MAC || BEAST_IOS -# define OS_MACOSX 1 -# elif BEAST_BSD -# define OS_FREEBSD -# else -# define OS_LINUX -# endif -#endif - -#if BEAST_GCC -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wreorder" -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#endif - // Compile RocksDB without debugging unless specifically requested #if !defined (NDEBUG) && !defined (RIPPLE_DEBUG_ROCKSDB) #define NDEBUG diff --git a/src/ripple/unity/rocksdb.h b/src/ripple/unity/rocksdb.h index 1002563ce..796b37f16 100644 --- a/src/ripple/unity/rocksdb.h +++ b/src/ripple/unity/rocksdb.h @@ -20,44 +20,7 @@ #ifndef RIPPLE_UNITY_ROCKSDB_H_INCLUDED #define RIPPLE_UNITY_ROCKSDB_H_INCLUDED -#include - -#ifdef __clang_major__ -#if __clang_major__ >= 7 -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Winconsistent-missing-override" -# pragma clang diagnostic ignored "-Wuninitialized" -#endif -#endif - -#if BEAST_WIN32 -# define ROCKSDB_PLATFORM_WINDOWS -#else -# define ROCKSDB_PLATFORM_POSIX -# define ROCKSDB_LIB_IO_POSIX -# if BEAST_MAC || BEAST_IOS -# define OS_MACOSX 1 -# elif BEAST_BSD -# define OS_FREEBSD -# else -# define OS_LINUX -# endif -#endif - -#ifndef RIPPLE_ROCKSDB_AVAILABLE -# if BEAST_WIN32 -# define RIPPLE_ROCKSDB_AVAILABLE 0 -# else -# if __cplusplus >= 201103L -# define RIPPLE_ROCKSDB_AVAILABLE 1 -# else -# define RIPPLE_ROCKSDB_AVAILABLE 0 -# endif -# endif -#endif - #if RIPPLE_ROCKSDB_AVAILABLE -#define SNAPPY //#include #include #include diff --git a/src/ripple/unity/secp256k1.cpp b/src/ripple/unity/secp256k1.cpp deleted file mode 100644 index daf207e88..000000000 --- a/src/ripple/unity/secp256k1.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - - -#define USE_NUM_NONE -#define USE_FIELD_10X26 -#define USE_FIELD_INV_BUILTIN -#define USE_SCALAR_8X32 -#define USE_SCALAR_INV_BUILTIN - -#if defined(_MSC_VER) && _MSC_VER >= 1900 -#pragma warning ( push ) -#pragma warning ( disable: 4319 ) -#endif -#include -#if defined(_MSC_VER) && _MSC_VER >= 1900 -#pragma warning ( pop ) -#endif diff --git a/src/ripple/unity/snappy.cpp b/src/ripple/unity/snappy.cpp deleted file mode 100644 index 0bc51aacc..000000000 --- a/src/ripple/unity/snappy.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include - -#ifdef _MSC_VER -#include -namespace snappy { -using ssize_t = std::ptrdiff_t; -} -#endif - -#if BEAST_CLANG -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#pragma clang diagnostic ignored "-Wdeprecated" -#endif - -#include -#include -#include - -#if BEAST_CLANG -#pragma clang diagnostic pop -#endif diff --git a/src/sqlite/sqlite_unity.c b/src/sqlite/sqlite_unity.c deleted file mode 100644 index bfa5e1190..000000000 --- a/src/sqlite/sqlite_unity.c +++ /dev/null @@ -1,60 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012-2015 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -// Prevents sqlite.h from being included, since it screws up the .c -#define RIPPLE_SQLITE_CPP_INCLUDED - -#include - -#ifdef _MSC_VER // MSVC -#pragma warning (push) -#pragma warning (disable: 4100) /* unreferenced formal parameter */ -#pragma warning (disable: 4127) /* conditional expression is constant */ -#pragma warning (disable: 4232) /* nonstandard extension used: dllimport address */ -#pragma warning (disable: 4244) /* conversion from 'int': possible loss of data */ -#pragma warning (disable: 4701) /* potentially uninitialized variable */ -#pragma warning (disable: 4706) /* assignment within conditional expression */ -#pragma warning (disable: 4996) /* 'GetVersionExA' was declared deprecated */ -#endif - -/* When compiled with SQLITE_THREADSAFE=1, SQLite operates in serialized mode. - In this mode, SQLite can be safely used by multiple threads with no restriction. - - VFALCO NOTE This implies a global mutex! -*/ -#define SQLITE_THREADSAFE 1 - -/* When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a - multithreaded program so long as no two threads attempt to use the - same database connection at the same time. - - VFALCO NOTE This is the preferred threading model. -*/ -//#define SQLITE_THREADSAFE 2 - -#if defined RIPPLE_SQLITE_USE_NDEBUG && !defined (NDEBUG) -#define NDEBUG -#endif - -#include - -#ifdef _MSC_VER -#pragma warning (pop) -#endif - diff --git a/src/test/beast/IPEndpoint_test.cpp b/src/test/beast/IPEndpoint_test.cpp index fe7dfa53d..29fe2e241 100644 --- a/src/test/beast/IPEndpoint_test.cpp +++ b/src/test/beast/IPEndpoint_test.cpp @@ -19,9 +19,6 @@ // MODULES: ../impl/IPEndpoint.cpp ../impl/IPAddressV4.cpp ../impl/IPAddressV6.cpp -#if BEAST_INCLUDE_BEASTCONFIG -#endif - #include #include #include