Skip to content

Commit

Permalink
Release EVT 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
harrywong committed Dec 6, 2018
2 parents 7b0124b + 1b8b406 commit 76de496
Show file tree
Hide file tree
Showing 135 changed files with 18,110 additions and 7,752 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ tn_data_*

.vscode/
.idea/
cmake-build-debug/
cmake-build-release/
cmake-build-*/
diff/

bind/pyevt/build
Expand Down
255 changes: 126 additions & 129 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
cmake_minimum_required( VERSION 3.5 )
cmake_minimum_required(VERSION 3.5)

# Defines everiToken library target.
project( EVT )
project(EVT)

option(ENABLE_MONGODB_SUPPORT "Build with mongodb support, this enables both mongo_db_plugin and history_plugin" OFF)
option(ENABLE_POSTGRES_SUPPORT "Build with postgres support, this enables postgres_plugin" OFF)
option(ENABLE_BREAKPAD_SUPPORT "Build with breakpad support, this enables minidump when crash" OFF)
option(ENABLE_BIND_LIBRARIES "Build bind libraries" OFF)
option(ENABLE_BENCHMARKS "Build benchmarks" OFF)
option(ENABLE_COVERAGE_TESTING "Build EVT for code coverage analysis" OFF)
option(ENABLE_TESTING "Enable testing targets" ON)
option(ENABLE_COLOR_OUTPUT "Enable diagnostics color output from compiler" ON)
option(ENABLE_MAINNET_BUILD "Build EVT for Mainnet" OFF)
option(ENABLE_BUILD_LTO "Enable LTO when build" OFF)
option(ENABLE_FULL_STATIC_BUILD "Enable full static build" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

include( GNUInstallDirs )
include( VersionMacros )
include( SetupTargetMacros )
include( InstallDirectoryPermissions )
include(GNUInstallDirs)
include(VersionMacros)
include(SetupTargetMacros)
include(InstallDirectoryPermissions)

set( BLOCKCHAIN_NAME "EVT" )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON)
set(BLOCKCHAIN_NAME "EVT")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS ON)
set(CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 2)
set(VERSION_MINOR 2)
set(VERSION_PATCH 0)

set( CLI_CLIENT_EXECUTABLE_NAME evtc )
set( GUI_CLIENT_EXECUTABLE_NAME evt )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "0E523427-37A8-4368-8D5E-AC17FC845110" )
set( CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true )
set(CLI_CLIENT_EXECUTABLE_NAME evtc)
set(GUI_CLIENT_EXECUTABLE_NAME evt)
set(CUSTOM_URL_SCHEME "gcs")
set(INSTALLER_APP_ID "0E523427-37A8-4368-8D5E-AC17FC845110")
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)

# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Expand All @@ -46,62 +50,83 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif()
endif()

if(WIN32)
message(FATAL_ERROR "EVT IS NOT SUPPORT BUILDING ON WIN32")
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")

#set (USE_PCH 1)
set(CXX_FLAGS
-Wall
-Wextra
-Werror
-Wno-unused-parameter
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")

set(CXX_FLAGS_RELEASE
-O3
-DNDEBUG
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS_RELEASE "${CXX_FLAGS_RELEASE}")

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif()

if (USE_PCH)
include (cotire)
endif(USE_PCH)
if(USE_PCH)
include(cotire)
endif()

# add defaults for openssl
if ("${OPENSSL_ROOT_DIR}" STREQUAL "")
if (NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR})
set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
elseif (APPLE)
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
set(OPENSSL_INCLUDE_DIR "/usr/local/opt/openssl/include")
elseif(UNIX AND NOT APPLE)
set(OPENSSL_ROOT_DIR "/usr/include/openssl")
set(OPENSSL_INCLUDE_DIR "/usr/include/openssl/include")
else()
message(FATAL_ERROR "openssl not found and don't know where to look, please specify OPENSSL_ROOT_DIR")
endif()
endif()

if ("${OPENSSL_LIBRARIES}" STREQUAL "")
if (NOT "$ENV{OPENSSL_LIBRARIES}" STREQUAL "")
set(OPENSSL_LIBRARIES $ENV{OPENSSL_LIBRARIES})
elseif (APPLE)
set(OPENSSL_LIBRARIES "/usr/local/opt/openssl/lib")
elseif(UNIX AND NOT APPLE)
set(OPENSSL_LIBRARIES "/usr/include/openssl")
else()
message(FATAL_ERROR "openssl libs not found and don't know where to look, please specify OPENSSL_LIBRARIES")
endif()
if("${OPENSSL_ROOT_DIR}" STREQUAL "")
if(NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR})
set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
elseif (APPLE)
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
set(OPENSSL_INCLUDE_DIR "/usr/local/opt/openssl/include")
elseif(UNIX AND NOT APPLE)
set(OPENSSL_ROOT_DIR "/usr/include/openssl")
set(OPENSSL_INCLUDE_DIR "/usr/include/openssl/include")
else()
message(FATAL_ERROR "openssl not found and don't know where to look, please specify OPENSSL_ROOT_DIR")
endif()
endif()

if("${OPENSSL_LIBRARIES}" STREQUAL "")
if(NOT "$ENV{OPENSSL_LIBRARIES}" STREQUAL "")
set(OPENSSL_LIBRARIES $ENV{OPENSSL_LIBRARIES})
elseif (APPLE)
set(OPENSSL_LIBRARIES "/usr/local/opt/openssl/lib")
elseif(UNIX AND NOT APPLE)
set(OPENSSL_LIBRARIES "/usr/include/openssl")
else()
message(FATAL_ERROR "openssl libs not found and don't know where to look, please specify OPENSSL_LIBRARIES")
endif()
endif()

if(UNIX)
if(APPLE)
set(whole_archive_flag "-force_load")
set(no_whole_archive_flag "")
else()
if(APPLE)
set(whole_archive_flag "-force_load")
set(no_whole_archive_flag "")
else()
set(whole_archive_flag "--whole-archive")
set(no_whole_archive_flag "--no-whole-archive")
endif()
else()
set(whole_archive_flag "--whole-archive")
set(no_whole_archive_flag "--no-whole-archive")
endif()
endif()

if(ENABLE_FULL_STATIC_BUILD)
set(Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF")
else()
set(whole_archive_flag "--whole-archive")
set(no_whole_archive_flag "--no-whole-archive")
set(Boost_USE_STATIC_LIBS OFF CACHE STRING "ON or OFF")
endif()

SET( Boost_USE_STATIC_LIBS OFF CACHE STRING "ON or OFF" )
IF( WIN32 )
SET(BOOST_ROOT $ENV{BOOST_ROOT})
set(Boost_USE_MULTITHREADED ON)
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
ENDIF(WIN32)
FIND_PACKAGE(Boost 1.64 REQUIRED COMPONENTS
thread
date_time
Expand All @@ -116,87 +141,59 @@ FIND_PACKAGE(Boost 1.64 REQUIRED COMPONENTS
locale
iostreams)

if( WIN32 )

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

set( ZLIB_LIBRARIES "" )
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )

set(CRYPTO_LIB)

#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")

# Probably cmake has a bug and vcxproj generated for executable in Debug conf. has disabled debug info
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG")

# 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 EVT on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring EVT on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -no-pie" )
if ( FULL_STATIC_BUILD )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif ( FULL_STATIC_BUILD )

if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
if( CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0.0 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization" )
endif()
endif()
endif( APPLE )

if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-memcmp" )
if(APPLE)
# Apple Specific Options Here
message( STATUS "Configuring EVT on OS X" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations")
else()
# Linux Specific Options Here
message(STATUS "Configuring EVT on Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -no-pie")
if(ENABLE_FULL_STATIC_BUILD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif()

if(ENABLE_COLOR_OUTPUT)
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics" )
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always" )
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization")
endif()
endif()
endif()

# based on http://www.delorie.com/gnu/docs/gdb/gdb_70.html
# uncomment this line to tell GDB about macros (slows compile times)
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-2 -g3" )
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-memcmp")
endif()

if(ENABLE_COLOR_OUTPUT)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
endif()
endif()

endif( WIN32 )
# based on http://www.delorie.com/gnu/docs/gdb/gdb_70.html
# uncomment this line to tell GDB about macros (slows compile times)
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-2 -g3" )

if(ENABLE_COVERAGE_TESTING)
SET(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
find_program( LCOV_PATH lcov )
find_program( GENHTML_PATH NAMES genhtml)
SET(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
find_program( LCOV_PATH lcov )
find_program( GENHTML_PATH NAMES genhtml)
endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR ENABLE_BREAKPAD_SUPPORT)
message(STATUS "Build EVT with symbols")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()

if(ENABLE_BUILD_LTO)
message(STATUS "Build EVT with link-time optimization")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-linker-plugin -flto -fno-fat-lto-objects")
endif()

include_directories(libraries/rocksdb/include)
Expand All @@ -211,9 +208,9 @@ if(ENABLE_TESTING)
enable_testing()
endif()

add_subdirectory( libraries )
add_subdirectory( plugins )
add_subdirectory( programs )
add_subdirectory(libraries)
add_subdirectory(plugins)
add_subdirectory(programs)

if(ENABLE_BIND_LIBRARIES)
add_subdirectory(bind)
Expand Down
12 changes: 9 additions & 3 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN git clone -b $branch https://github.com/everitoken/evt.git --recursive \
&& cd evt && echo "$branch:$(git rev-parse HEAD)" > /etc/evt-version \
&& cmake -H. -B"/tmp/build" -G"Ninja" -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local -DENABLE_MONGODB_SUPPORT=ON \
-DENABLE_BREAKPAD_SUPPORT=ON -DEVT_ROOT_KEY=$rootkey
-DENABLE_POSTGRES_SUPPORT=ON -DENABLE_BREAKPAD_SUPPORT=ON -DENABLE_BUILD_LTO=ON \
-DEVT_ROOT_KEY=$rootkey
RUN ninja -C /tmp/build -j $bjobs evtd evtwd evtc && ninja -C /tmp/build install

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
Expand Down Expand Up @@ -37,13 +38,18 @@ COPY --from=builder /tmp/build/bin /opt/evt/bin
COPY --from=builder /etc/evt-version /etc

COPY config.ini /
COPY evtd.sh /opt/evt/bin/evtd.sh
RUN chmod +x /opt/evt/bin/evtd.sh
COPY evtd.sh /opt/evt/bin/evtd.sh
COPY evtwd.sh /opt/evt/bin/evtwd.sh
RUN chmod +x /opt/evt/bin/evtd.sh
RUN chmod +x /opt/evt/bin/evtwd.sh

ENV EVT_ROOT=/opt/evt
ENV LD_LIBRARY_PATH /usr/local/lib

RUN mkdir /opt/evt/data
VOLUME /opt/evt/data

RUN mkdir /opt/evt/snapshots
VOLUME /opt/evt/snapshots

ENV PATH /opt/evt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Loading

0 comments on commit 76de496

Please sign in to comment.