Skip to content

Commit

Permalink
Merge pull request #2093 from bitshares/release
Browse files Browse the repository at this point in the history
Merge release branch to master branch for 4.0 release
  • Loading branch information
abitmore committed Jun 30, 2020
2 parents 8b7542e + d8981f2 commit c9e2bf4
Show file tree
Hide file tree
Showing 254 changed files with 36,605 additions and 6,882 deletions.
42 changes: 42 additions & 0 deletions .mailmap
@@ -0,0 +1,42 @@
Alfredo Garcia <oxarbitrage@gmail.com> <oxarbitrage@gmail.com>
Alfredo Garcia <oxarbitrage@gmail.com> <root@NC-PH-1346-07.web-hosting.com>
Christopher Sanborn <23085117+christophersanborn@users.noreply.github.com>
Chronos <chronos.crypto@gmail.com>
Daniel Larimer <bytemaster@users.noreply.github.com> <dan.larimer@block.one>
Daniel Larimer <bytemaster@users.noreply.github.com> <dan@bitshares.org>
Daniel Larimer <bytemaster@users.noreply.github.com> <dan@invictus-innovations.com>
Daniel Larimer <bytemaster@users.noreply.github.com> <dlarimer@invictus-innovations.com>
Eric Frias <efrias@syncad.com>
Fabian Schuh <Fabian@chainsquad.com> <mail@xeroc.org>
Fabian Schuh <Fabian@chainsquad.com> <xeroc@chainsquad.com>
John M. Jones <jmjatlanta@gmail.com>
Ken Code <ken@BitShares-Munich.de>
Matias Romeo <matias.romeo@gmail.com>
Nathan Hourt <themodprobe@protonmail.com> <nat.hourt@gmail.com>
Nathan Hourt <themodprobe@protonmail.com> <nathan@followmyvote.com>
OpenLedger <service.github@openledger.info> <service.github@openledger.info>
OpenLedger <service.github@openledger.info> <42674402+OpenLedgerApp@users.noreply.github.com>
Peter Conrad <conrad@quisquis.de> <cyrano@quisquis.de>
Peter Conrad <conrad@quisquis.de> <github.com@quisquis.de>
Qi Xing <cwyyprog@163.com> <cwyyprog@163.com>
Roelandp <dnaleor@gmail.com>
Ryan R. Fox <ryan@ryanrfox.com> <ryan@ryanrfox.com>
Ryan R. Fox <ryan@ryanrfox.com> <ryanRfox@users.noreply.github.com>
Sigve Kvalsvik <bitsharesblocks@gmail.com> <sigvekvalsvik@gmail.com>
Valentine Zavgorodnev <i@valzav.com>
Valera Cogut <info@valeracogut.com> <valerakogut@gmail.com>
Vikram Rajkumar <vikramrajkumar@users.noreply.github.com> <vikram@bitshares.org>
Vikram Rajkumar <vikramrajkumar@users.noreply.github.com> <vikram@soledger.com>
William <tmfc@homtail.com> <jinwei@gmail.com>
William <tmfc@homtail.com> <tmfc@homtail.com>
Xiaodong Li <mantianyu@gmail.com> <cifer-lee@users.noreply.github.com>
Xiaodong Li <mantianyu@gmail.com> <mantianyu@gmail.com>
Xiaodong Li <mantianyu@gmail.com> <maintianyu@gmail.com>
Xiaodong Li <mantianyu@gmail.com> <lixiaodongcifer@didichuxing.com>
abitmore <abitmore@users.noreply.github.com>
albert <393259066@qq.com> <393259066@qq.com>
albert <393259066@qq.com> <zhuliting@gxb.io>
bitcube <root@seed.cubeconnex.com>
btcinshares <btcinshares@protonmail.com> <33876675+btcinshares@users.noreply.github.com>
crazybits <crazybit.github@gmail.com> <crazybit.github@gmail.com>
crazybits <crazybit.github@gmail.com> <crazybits@users.noreply.github.com>
8 changes: 7 additions & 1 deletion .travis.yml
Expand Up @@ -30,6 +30,12 @@ env:
jobs:
include:
- stage: build for cache
script: ./programs/build_helpers/build_protocol
script: ./programs/build_helpers/build_for_cache
- stage: build and test
script: ./programs/build_helpers/build_and_test
- stage: scan with sonar, step 1
script: ./programs/build_helpers/scan_with_sonar_step_1
- stage: scan with sonar, step 2
script: ./programs/build_helpers/scan_with_sonar_step_2
- stage: scan with sonar, step 3
script: ./programs/build_helpers/scan_with_sonar_step_3
141 changes: 90 additions & 51 deletions CMakeLists.txt
Expand Up @@ -28,6 +28,17 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "Clang version must be at least 3.3!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "19.0")
message(FATAL_ERROR "MSVC version must be at least 19.0 (Visual Studio 2015 Update 1)!")
endif()

# allow MSVC VS2015 with Update 1, other 2015 versions are not supported
if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_EQUAL "19.0")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "19.0.23506.0")
message(FATAL_ERROR "Your version ${CMAKE_CXX_COMPILER_VERSION} of MSVC is not supported, use version 19.0.23506.0 (Visual Studio 2015 Update 1)!")
endif()
endif()
endif()

list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
Expand All @@ -38,53 +49,71 @@ include(Utils)
# function to help with cUrl
macro(FIND_CURL)
if (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
find_package(OpenSSL REQUIRED)
set (OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
find_package(CURL REQUIRED)
list(APPEND CURL_LIBRARIES ssl crypto)
list(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES} ${BOOST_THREAD_LIBRARY} ${CMAKE_DL_LIBS})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
find_package(CURL REQUIRED)
endif (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)

if( WIN32 )
if ( MSVC )
list( APPEND CURL_LIBRARIES Wldap32 )
endif( MSVC )

if( MINGW )
# MinGW requires a specific order of included libraries ( CURL before ZLib )
find_package( ZLIB REQUIRED )
list( APPEND CURL_LIBRARIES ${ZLIB_LIBRARY} pthread )
endif( MINGW )

list( APPEND CURL_LIBRARIES ${PLATFORM_SPECIFIC_LIBS} )
endif( WIN32 )
endmacro()

# Save the old value of CMAKE_REQUIRED_FLAGS
set( TEMP_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} )

# Fortify source
if (CMAKE_COMPILER_IS_GNUCXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message ("-- Setting optimizations for clang++")
message (STATUS "Setting optimizations for clang++")
set(CMAKE_CXX_FLAGS_RELEASE "-D_FORTIFY_SOURCE=2 -O3 -DNDEBUG=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-D_FORTIFY_SOURCE=2 -O3 -DNDEBUG=1 -g")

# check and add data execution prevention
message ("-- Enabling data execution prevention")
message (STATUS "Enabling data execution prevention")
add_linker_flag("-fsanitize=safe-stack")

# check and add Stack-based buffer overrun detection
set(CMAKE_REQUIRED_FLAGS "-fstack-protector")
check_c_compiler_flag("" HAVE_STACKPROTECTOR)
if(HAVE_STACKPROTECTOR)
message ("-- Enabling stack-based buffer overrun detection")
message (STATUS "Enabling stack-based buffer overrun detection")
add_flag_append(CMAKE_C_FLAGS "-fstack-protector")
add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector")
endif()
else ()
message ("-- Setting optimizations for g++")
message (STATUS "Setting optimizations for g++")
set(CMAKE_CXX_FLAGS_RELEASE "-D_FORTIFY_SOURCE=2 -O3 -DNDEBUG=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-D_FORTIFY_SOURCE=2 -O3 -DNDEBUG=1 -g")

# check and add data execution prevention
set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack")
check_c_compiler_flag("" HAVE_NOEXECSTACK)
if(HAVE_NOEXECSTACK)
message ("-- Enabling data execution prevention")
message (STATUS "Enabling data execution prevention")
add_linker_flag("-znoexecstack")
endif()

# check and add Stack-based buffer overrun detection
set(CMAKE_REQUIRED_FLAGS "-fstack-protector-strong")
check_c_compiler_flag("" HAVE_STACKPROTECTOR)
if(HAVE_STACKPROTECTOR)
message ("-- Enabling stack-based buffer overrun detection")
message (STATUS "Enabling stack-based buffer overrun detection")
add_flag_append(CMAKE_C_FLAGS "-fstack-protector-strong")
add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-strong")
endif()
Expand All @@ -96,22 +125,26 @@ endif ()
set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
check_c_compiler_flag("" HAVE_RELROFULL)
if(HAVE_RELROFULL)
message ("-- Enabling full data relocation and protection")
message (STATUS "Enabling full data relocation and protection")
add_linker_flag("-zrelro")
add_linker_flag("-znow")
else()
#if full relro is not available, try partial relro
set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro")
check_c_compiler_flag("" HAVE_RELROPARTIAL)
if(HAVE_RELROPARTIAL)
message ("-- Enabling partial data relocation and protection")
message (STATUS "Enabling partial data relocation and protection")
add_linker_flag("-zrelro")
endif()
endif()

set(CMAKE_REQUIRED_FLAGS ${TEMP_REQUIRED_FLAGS} )

# position independent executetable (PIE)
# position independent code (PIC)
add_definitions (-fPIC)
if (NOT MSVC)
add_definitions (-fPIC)
endif(NOT MSVC)

set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
set( GRAPHENE_EGENESIS_JSON "${CMAKE_CURRENT_SOURCE_DIR}/libraries/egenesis/genesis.json"
Expand All @@ -123,9 +156,9 @@ endif(USE_PCH)

option(USE_PROFILER "Build with GPROF support(Linux)." OFF)

IF( NOT WIN32 )
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules" )
ENDIF( NOT WIN32 )
# Use Boost config file from fc
set(Boost_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules/Boost")

list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/GitVersionGen" )
include( GetGitRevisionDescription )
get_git_head_revision( GIT_REFSPEC GIT_SHA2 )
Expand All @@ -139,14 +172,20 @@ LIST(APPEND BOOST_COMPONENTS thread
program_options
chrono
unit_test_framework
context)
context
coroutine
regex)
# boost::endian is also required, but FindBoost can't handle header-only libs
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )

IF( WIN32 )
SET(BOOST_ROOT $ENV{BOOST_ROOT})
IF(WIN32)
if($ENV{BOOST_ROOT})
SET(BOOST_ROOT $ENV{BOOST_ROOT})
endif($ENV{BOOST_ROOT})
set(Boost_USE_MULTITHREADED ON)
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
add_definitions("-DCURL_STATICLIB")
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 crypt32 mswsock userenv )
ELSE( WIN32 )
IF( APPLE )
set( CMAKE_THREAD_LIBS_INIT "-lpthread" )
Expand All @@ -157,28 +196,36 @@ ELSE( WIN32 )
ENDIF( APPLE )
ENDIF(WIN32)

FIND_PACKAGE(Boost 1.57 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
# For Boost 1.53 on windows, coroutine was not in BOOST_LIBRARYDIR and do not need it to build, but if boost versin >= 1.54, find coroutine otherwise will cause link errors
IF(NOT "${Boost_VERSION}" MATCHES "1.53(.*)")
SET(BOOST_LIBRARIES_TEMP ${Boost_LIBRARIES})
FIND_PACKAGE(Boost 1.54 REQUIRED COMPONENTS coroutine)
LIST(APPEND BOOST_COMPONENTS coroutine)
SET(Boost_LIBRARIES ${BOOST_LIBRARIES_TEMP} ${Boost_LIBRARIES})
ENDIF()
FIND_PACKAGE(Boost CONFIG REQUIRED COMPONENTS ${BOOST_COMPONENTS})

# enforce more strict compiler warnings and errors
add_compiler_flag_if_available("-Wall")
add_compiler_flag_if_available("-Wclobbered")
add_compiler_flag_if_available("-Wempty-body")
add_compiler_flag_if_available("-Wformat-security")
add_compiler_flag_if_available("-Wignored-qualifiers")
add_compiler_flag_if_available("-Wimplicit-fallthrough=5")
add_compiler_flag_if_available("-Wmissing-field-initializers")
add_compiler_flag_if_available("-Wpointer-arith")
add_compiler_flag_if_available("-Wshift-negative-value")
add_compiler_flag_if_available("-Wtype-limits")
add_compiler_flag_if_available("-Wunused-but-set-parameter")

if( WIN32 )

message( STATUS "Configuring BitShares on WIN32")
set( DB_VERSION 60 )
set( BDB_STATIC_LIBS 1 )

set( ZLIB_LIBRARIES "" )
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )
if ( MINGW )
message( STATUS "Windows build using MinGW" )
set( FULL_STATIC_BUILD TRUE )
else( MINGW )
set( ZLIB_LIBRARIES "" )
endif( MINGW )

set(CRYPTO_LIB)
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )

if( MSVC )
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DWIN32_LEAN_AND_MEAN)
#looks like this flag can have different default on some machines.
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
Expand All @@ -187,44 +234,32 @@ if( WIN32 )
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG")
endif ( MSVC )

# On windows tcl should be installed to the directory pointed by setenv.bat script
SET(TCL_INCLUDE_PATH $ENV{TCL_ROOT}/include)
MESSAGE(STATUS "tcl INCLUDE PATH: ${TCL_INCLUDE_PATH}")

FIND_PACKAGE(TCL)
MESSAGE(STATUS "tcl_library: ${TCL_LIBRARY}")

SET(TCL_LIBS "optimized;${TCL_LIBRARY};debug;")
get_filename_component(TCL_LIB_PATH "${TCL_LIBRARY}" PATH)
get_filename_component(TCL_LIB_NAME "${TCL_LIBRARY}" NAME_WE)
get_filename_component(TCL_LIB_EXT "${TCL_LIBRARY}" EXT)

SET(TCL_LIBS "${TCL_LIBS}${TCL_LIB_PATH}/${TCL_LIB_NAME}g${TCL_LIB_EXT}")
SET(TCL_LIBRARY ${TCL_LIBS})

else( WIN32 ) # Apple AND Linux

if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring BitShares on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++ -Wall" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring BitShares on Linux" )
if ( "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD" )
# OpenBSD Specific Options
message( STATUS "Configuring BitShares on OpenBSD" )
else()
# Linux Specific Options Here
message( STATUS "Configuring BitShares on Linux" )
set( rt_library rt )
endif()
# Common Linux & OpenBSD Options
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
if(USE_PROFILER)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" )
endif( USE_PROFILER )
set( rt_library rt )
set( pthread_library pthread)
if ( NOT DEFINED crypto_library )
# I'm not sure why this is here, I guess someone has openssl and can't detect it with find_package()?
# if you have a normal install, you can define crypto_library to the empty string to avoid a build error
set( crypto_library crypto)
endif ()
if ( FULL_STATIC_BUILD )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif ( FULL_STATIC_BUILD )
endif( APPLE )

if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
Expand All @@ -247,6 +282,10 @@ else( WIN32 ) # Apple AND Linux

endif( WIN32 )

if ( NOT MSVC AND FULL_STATIC_BUILD )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libstdc++ -static-libgcc" )
endif ( NOT MSVC AND FULL_STATIC_BUILD )

set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build BitShares for code coverage analysis")

if(ENABLE_COVERAGE_TESTING)
Expand Down
12 changes: 12 additions & 0 deletions CMakeModules/Utils.cmake
Expand Up @@ -11,3 +11,15 @@ macro(add_linker_flag _FLAG)
add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-Wl,${_FLAG}")
endmacro(add_linker_flag _FLAG)

include(CheckCXXCompilerFlag)

macro(add_compiler_flag_if_available _FLAG)
string(TOUPPER "${_FLAG}" _TEMPVAR1)
string(REPLACE "-" "_" _TEMPVAR2 "${_TEMPVAR1}")
string(CONCAT _TEMPVAR3 "HAVE" "${_TEMPVAR2}")
set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
check_cxx_compiler_flag("${_FLAG}" ${_TEMPVAR3})
if(${_TEMPVAR3})
add_flag_append(CMAKE_CXX_FLAGS ${_FLAG})
endif()
endmacro(add_compiler_flag_if_available _VAR_NAME _FLAG)

0 comments on commit c9e2bf4

Please sign in to comment.