Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2191 from hyperledger/develop
Browse files Browse the repository at this point in the history
Hyperledger Iroha v1.0 Release Candidate 5
  • Loading branch information
neewy authored Mar 21, 2019
2 parents 28b3b39 + f8efa83 commit ed579f8
Show file tree
Hide file tree
Showing 330 changed files with 6,097 additions and 2,695 deletions.
51 changes: 39 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,43 @@ if(COVERAGE)
include(cmake/analysis.cmake)
endif()

include(cmake/functions.cmake)

if(SANITIZE_THREAD)
append_build_flags(-fsanitize=thread)
endif()
if(SANITIZE_ADDRESS)
append_build_flags(-fsanitize=address -fno-omit-frame-pointer)
endif()
if(SANITIZE_MEMORY)
append_build_flags(-fsanitize=memory -fsanitize-memory-track-origins)
endif()
if(SANITIZE_UNDEFINED)
append_build_flags(-fsanitize=undefined)
endif()
set(DEPS_CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})

SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

option(BENCHMARKING "Build benchmarks" OFF)
option(TESTING "Build tests" ON )
option(USE_BTF "Build Binary Testing Framework" OFF)
option(COVERAGE "Enable coverage" OFF)
option(FUZZING "Build fuzzing binaries" OFF)
option(PACKAGE_ZIP "Create ZIP package" OFF)
option(PACKAGE_TGZ "Create TGZ package" OFF)
option(PACKAGE_RPM "Create RPM package" OFF)
option(PACKAGE_DEB "Create DEB package" OFF)
option(ENABLE_LIBS_PACKAGING "Enable libs packaging" ON)
option(USE_LIBIROHA "Use external model library" OFF)
option(BENCHMARKING "Build benchmarks" OFF)
option(TESTING "Build tests" ON )
option(USE_BTF "Build Binary Testing Framework" OFF)
option(COVERAGE "Enable coverage" OFF)
option(FUZZING "Build fuzzing binaries" OFF)
option(PACKAGE_ZIP "Create ZIP package" OFF)
option(PACKAGE_TGZ "Create TGZ package" OFF)
option(PACKAGE_RPM "Create RPM package" OFF)
option(PACKAGE_DEB "Create DEB package" OFF)
option(ENABLE_LIBS_PACKAGING "Enable libs packaging" ON)
option(USE_LIBIROHA "Use external model library" OFF)
option(SANITIZE_THREAD "Build with thread sanitizer" OFF)
option(SANITIZE_ADDRESS "Build with address sanitizer" OFF)
option(SANITIZE_MEMORY "Build with memory sanitizer" OFF)
option(SANITIZE_UNDEFINED "Build with undefined behaviour sanitizer" OFF)


if (NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -112,6 +136,10 @@ message(STATUS "-DPACKAGE_TGZ=${PACKAGE_TGZ}")
message(STATUS "-DPACKAGE_RPM=${PACKAGE_RPM}")
message(STATUS "-DPACKAGE_DEB=${PACKAGE_DEB}")
message(STATUS "-DENABLE_LIBS_PACKAGING=${ENABLE_LIBS_PACKAGING}")
message(STATUS "-DSANITIZE_THREAD=${SANITIZE_THREAD}")
message(STATUS "-DSANITIZE_ADDRESS=${SANITIZE_ADDRESS}")
message(STATUS "-DSANITIZE_MEMORY=${SANITIZE_MEMORY}")
message(STATUS "-DSANITIZE_UNDEFINED=${SANITIZE_UNDEFINED}")

set(IROHA_SCHEMA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/schema")
set(SM_SCHEMA_DIR "${PROJECT_SOURCE_DIR}/shared_model/schema")
Expand All @@ -134,7 +162,6 @@ SET(IROHA_ROOT_PROJECT ON)
add_definitions(-DBOOST_NO_RTTI)

include(FeatureSummary)
include(cmake/functions.cmake)
include(cmake/dependencies.cmake)
include(cmake/clang-cxx-dev-tools.cmake)

Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Contributing guidelines

:star::tada: First off, thanks for taking the time to contribute! :tada::star:
First off, thanks for taking the time to contribute!

The following is a short set of guidelines for contributing to Iroha.

Expand Down
9 changes: 7 additions & 2 deletions cmake/Modules/Finded25519.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ find_package_handle_standard_args(ed25519 DEFAULT_MSG
)

set(URL https://github.com/hyperledger/iroha-ed25519)
set(VERSION f42953c631fae93011612f6b1ee33f1f88c3f8af)
set(VERSION b61a1e77af5dc458ed6a5aee395d5b22775a4917) # v. 2.0.1
set_target_description(ed25519 "Digital signature algorithm" ${URL} ${VERSION})

if (NOT ed25519_FOUND)
externalproject_add(hyperledger_ed25519
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS -DTESTING=OFF -DBUILD=STATIC
CMAKE_ARGS
-DTESTING=OFF
-DBUILD=STATIC
-DHASH=sha3_brainhub
-DEDIMPL=ref10
${DEPS_CMAKE_ARGS}
PATCH_COMMAND ${PATCH_RANDOM}
BUILD_BYPRODUCTS ${EP_PREFIX}/src/hyperledger_ed25519-build/${CMAKE_STATIC_LIBRARY_PREFIX}ed25519${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_COMMAND "" # remove install step
Expand Down
62 changes: 62 additions & 0 deletions cmake/Modules/Findfmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
add_library(fmt INTERFACE IMPORTED)

find_path(fmt_INCLUDE_DIR fmt/format.h
PATHS ${EP_PREFIX}/src/fmtlib_fmt/include)
mark_as_advanced(fmt_INCLUDE_DIR)

# read the fmt version stored in fmt/core.h
unset(fmt_VERSION)
set(fmt_version_file_path ${fmt_INCLUDE_DIR}/fmt/core.h)
if (EXISTS ${fmt_version_file_path})
file(READ ${fmt_version_file_path} fmt_version_file)
if (fmt_version_file MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
# Use math to skip leading zeros if any.
math(EXPR ver_major ${CMAKE_MATCH_1})
math(EXPR ver_minor ${CMAKE_MATCH_2})
math(EXPR ver_patch ${CMAKE_MATCH_3})
set(fmt_VERSION "${ver_major}.${ver_minor}.${ver_patch}")
endif ()
endif ()

if (NOT DEFINED fmt_VERSION OR fmt_VERSION VERSION_LESS fmt_FIND_VERSION)
message(STATUS "Package 'fmt' of version ${fmt_FIND_VERSION} not found. "
"Will download it from git repo.")

set(GIT_URL https://github.com/fmtlib/fmt.git)
set(fmt_VERSION ${fmt_FIND_VERSION})
set(GIT_TAG "refs/tags/${fmt_VERSION}")
set_package_properties(fmt
PROPERTIES
URL ${GIT_URL}
DESCRIPTION "String formatting library"
)

externalproject_add(fmtlib_fmt
GIT_REPOSITORY ${GIT_URL}
GIT_TAG ${GIT_TAG}
GIT_SHALLOW 1
CONFIGURE_COMMAND "" # remove configure step
BUILD_COMMAND "" # remove build step
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
)
externalproject_get_property(fmtlib_fmt source_dir)
set(fmt_INCLUDE_DIR ${source_dir}/include)
file(MAKE_DIRECTORY ${fmt_INCLUDE_DIR})

add_dependencies(fmt fmtlib_fmt)
endif()

set_target_properties(fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${fmt_INCLUDE_DIR}
)

target_compile_definitions(fmt INTERFACE FMT_HEADER_ONLY)

find_package_handle_standard_args(fmt
REQUIRED_VARS
fmt_INCLUDE_DIR
VERSION_VAR
fmt_VERSION
)

2 changes: 2 additions & 0 deletions cmake/Modules/Findgflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ if (NOT gflags_FOUND)
externalproject_add(gflags_gflags
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS
${DEPS_CMAKE_ARGS}
BUILD_BYPRODUCTS ${EP_PREFIX}/src/gflags_gflags-build/lib/libgflags.a
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
Expand Down
1 change: 1 addition & 0 deletions cmake/Modules/Findgrpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (NOT grpc_FOUND)
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS
${DEPS_CMAKE_ARGS}
-DgRPC_PROTOBUF_PROVIDER=package
${PROTO_DEP}
-DgRPC_ZLIB_PROVIDER=package
Expand Down
8 changes: 4 additions & 4 deletions cmake/Modules/Findgtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ if (NOT gtest_FOUND)
ExternalProject_Add(google_test
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-Dgtest_force_shared_crt=ON
-Dgtest_disable_pthreads=OFF
CMAKE_ARGS
${DEPS_CMAKE_ARGS}
-Dgtest_force_shared_crt=ON
-Dgtest_disable_pthreads=OFF
BUILD_BYPRODUCTS ${EP_PREFIX}/src/google_test-build/googlemock/gtest/libgtest_main.a
${EP_PREFIX}/src/google_test-build/googlemock/gtest/libgtest.a
${EP_PREFIX}/src/google_test-build/googlemock/libgmock_main.a
Expand Down
8 changes: 6 additions & 2 deletions cmake/Modules/Findpq.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ if (NOT pq_FOUND)
externalproject_add(postgres_postgres
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CONFIGURE_COMMAND ./configure --without-readline
CONFIGURE_COMMAND
./configure --without-readline
CC=${CMAKE_C_COMPILER}

BUILD_IN_SOURCE 1
BUILD_COMMAND ${MAKE} -C ./src/bin/pg_config && ${MAKE} -C ./src/interfaces/libpq
BUILD_COMMAND ${MAKE} COPT=${CMAKE_C_FLAGS} -C ./src/bin/pg_config &&
${MAKE} COPT=${CMAKE_C_FLAGS} -C ./src/interfaces/libpq
BUILD_BYPRODUCTS ${EP_PREFIX}/src/postgres_postgres/src/interfaces/libpq/libpq.a
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
Expand Down
7 changes: 6 additions & 1 deletion cmake/Modules/Findprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ if (NOT protobuf_FOUND)
externalproject_add(google_protobuf
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -H${EP_PREFIX}/src/google_protobuf/cmake -B${EP_PREFIX}/src/google_protobuf-build -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G${CMAKE_GENERATOR}
-H${EP_PREFIX}/src/google_protobuf/cmake -B${EP_PREFIX}/src/google_protobuf-build
${DEPS_CMAKE_ARGS}
-Dprotobuf_BUILD_TESTS=OFF
-Dprotobuf_BUILD_SHARED_LIBS=ON
BUILD_BYPRODUCTS ${EP_PREFIX}/src/google_protobuf-build/protoc
${EP_PREFIX}/src/google_protobuf-build/${CMAKE_SHARED_LIBRARY_PREFIX}protobuf${CMAKE_SHARED_LIBRARY_SUFFIX}
INSTALL_COMMAND ""
Expand Down
6 changes: 5 additions & 1 deletion cmake/Modules/Findsoci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ set(VERSION 111b50af8c3876ea392367640b4bd83b4f903ab8) # 3.2.3
set_target_description(soci "The C++ Database Access Library" ${URL} ${VERSION})

if (NOT soci_FOUND)
SET(CMAKE_CXX_SOCI_FLAGS "${CMAKE_CXX_FLAGS} -I${postgres_INCLUDE_DIR}")
externalproject_add(soci_soci
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
Expand All @@ -47,7 +48,10 @@ if (NOT soci_FOUND)
-DCMAKE_INCLUDE_PATH=${pq_INCLUDE_DIR}
-DCMAKE_LIBRARY_PATH=${pq_INCLUDE_DIR}
-DCMAKE_PROGRAM_PATH=${pg_config_EXECUTABLE_DIR}
-DCMAKE_CXX_FLAGS=-I${postgres_INCLUDE_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_SOCI_FLAGS}
-DCMAKE_INSTALL_PREFIX=${EP_PREFIX}
-DWITH_BOOST=ON
-DWITH_DB2=OFF
Expand Down
52 changes: 38 additions & 14 deletions cmake/Modules/Findspdlog.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
add_library(spdlog INTERFACE IMPORTED)

find_path(spdlog_INCLUDE_DIR spdlog/spdlog.h)
find_path(spdlog_INCLUDE_DIR spdlog/spdlog.h
PATHS ${EP_PREFIX}/src/gabime_spdlog/include
)
mark_as_advanced(spdlog_INCLUDE_DIR)

find_package_handle_standard_args(spdlog DEFAULT_MSG
spdlog_INCLUDE_DIR
)


set(URL https://github.com/gabime/spdlog.git)
set(VERSION ccd675a286f457068ee8c823f8207f13c2325b26)
set_target_description(spdlog "Logging library" ${URL} ${VERSION})

unset(spdlog_VERSION)
set(spdlog_version_file_path ${spdlog_INCLUDE_DIR}/spdlog/version.h)
if (EXISTS ${spdlog_version_file_path})
file(READ ${spdlog_version_file_path} spdlog_version_file)
string(REGEX MATCH "SPDLOG_VER_MAJOR ([0-9]*)" _ ${spdlog_version_file})
set(ver_major ${CMAKE_MATCH_1})
string(REGEX MATCH "SPDLOG_VER_MINOR ([0-9]*)" _ ${spdlog_version_file})
set(ver_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "SPDLOG_VER_PATCH ([0-9]*)" _ ${spdlog_version_file})
set(ver_patch ${CMAKE_MATCH_1})
set(spdlog_VERSION "${ver_major}.${ver_minor}.${ver_patch}")
endif()

if (NOT DEFINED spdlog_VERSION OR spdlog_VERSION VERSION_LESS spdlog_FIND_VERSION)
message(STATUS "Package 'spdlog' of version ${spdlog_FIND_VERSION} not found. "
"Will download it from git repo.")

set(GIT_URL https://github.com/gabime/spdlog.git)
set(spdlog_VERSION ${spdlog_FIND_VERSION})
set(GIT_TAG "v${spdlog_VERSION}")
set_package_properties(spdlog
PROPERTIES
URL ${GIT_URL}
DESCRIPTION "Logging library"
)

if (NOT SPDLOG_FOUND)
externalproject_add(gabime_spdlog
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
GIT_REPOSITORY ${GIT_URL}
GIT_TAG ${GIT_TAG}
GIT_SHALLOW 1
CONFIGURE_COMMAND "" # remove configure step
BUILD_COMMAND "" # remove build step
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(gabime_spdlog source_dir)
set(spdlog_INCLUDE_DIR ${source_dir}/include)
Expand All @@ -33,3 +50,10 @@ endif ()
set_target_properties(spdlog PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${spdlog_INCLUDE_DIR}
)

find_package_handle_standard_args(spdlog
REQUIRED_VARS
spdlog_INCLUDE_DIR
VERSION_VAR
spdlog_VERSION
)
3 changes: 2 additions & 1 deletion cmake/Modules/Findtbb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ if (NOT tbb_FOUND)
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
BUILD_IN_SOURCE 1
BUILD_COMMAND ${MAKE} tbb_build_prefix=build
BUILD_COMMAND ${MAKE}
tbb_build_prefix=build
BUILD_BYPRODUCTS ${EP_PREFIX}/src/01org_tbb/build/build_debug/${CMAKE_SHARED_LIBRARY_PREFIX}tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX}
${EP_PREFIX}/src/01org_tbb/build/build_release/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
CONFIGURE_COMMAND "" # remove configure step
Expand Down
7 changes: 6 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ endif ()
#############################
# speedlog #
#############################
find_package(spdlog)
find_package(spdlog 1.3.1 REQUIRED)

################################
# protobuf #
Expand Down Expand Up @@ -202,6 +202,11 @@ endif()
###################################
find_package(ed25519)

###################################
# fmt #
###################################
find_package(fmt 5.3.0 REQUIRED)

if (USE_LIBIROHA)
find_package(libiroha)
endif()
10 changes: 8 additions & 2 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ endmacro()
macro(add_install_step_for_bin target)
install(TARGETS ${target}
RUNTIME DESTINATION bin
CONFIGURATIONS Release
CONFIGURATIONS ${CMAKE_BUILD_TYPE}
COMPONENT binaries)
endmacro()

Expand All @@ -137,7 +137,7 @@ macro(add_install_step_for_lib libpath)

install(FILES ${lib_major_minor_patch}
DESTINATION lib
CONFIGURATIONS Release
CONFIGURATIONS ${CMAKE_BUILD_TYPE}
COMPONENT libraries)
endmacro()

Expand All @@ -155,3 +155,9 @@ macro(get_git_revision commit)
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
endmacro()

macro(append_build_flags)
string(REPLACE ";" " " SPACE_ARGS "${ARGN}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SPACE_ARGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SPACE_ARGS}")
endmacro()
7 changes: 5 additions & 2 deletions cmake/release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ endif()
SET(CPACK_PACKAGE_VERSION ${IROHA_VERSION})
message(STATUS "[IROHA_VERSION] '${IROHA_VERSION}'")


SET(CPACK_STRIP_FILES TRUE)
if (CMAKE_BUILD_TYPE MATCHES Release)
SET(CPACK_STRIP_FILES TRUE)
else()
SET(CPACK_STRIP_FILES FALSE)
endif()

set(CPACK_COMPONENTS_ALL binaries libraries)

Expand Down
2 changes: 1 addition & 1 deletion deploy/ansible/playbooks/iroha-docker/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
- { role: docker, tags: docker }
# - { role: iroha-docker, tags: iroha-docker }
vars:
hostnames: []
hostnames: []
Loading

0 comments on commit ed579f8

Please sign in to comment.