Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/hyperledger/iroha into f…
Browse files Browse the repository at this point in the history
…eature/new_peer_query
  • Loading branch information
x3medima17 committed Feb 25, 2018
2 parents f9d1fc9 + 93e0435 commit bf4a2ac
Show file tree
Hide file tree
Showing 46 changed files with 980 additions and 243 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- run:
name: make
command: |
cmake --build $IROHA_BUILD -- -j3
cmake --build $IROHA_BUILD -- -j2
- run: ccache --show-stats
- run:
name: unit tests, generate xunit-*.xml
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- run:
name: make and package
command: |
cmake --build $IROHA_BUILD --target package -- -j4
cmake --build $IROHA_BUILD --target package -- -j$(nproc --all)
- run: ccache --show-stats
- save_cache:
key: build-linux-release-{{ arch }}-{{ .Branch }}-{{ epoch }}
Expand Down
23 changes: 19 additions & 4 deletions cmake/Modules/Findbenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,32 @@ find_package_handle_standard_args(benchmark DEFAULT_MSG
benchmark_LIBRARY
)

iroha_get_lib_name(BENCHLIB benchmark STATIC)

if (NOT benchmark_FOUND)
externalproject_add(google_benchmark
GIT_REPOSITORY https://github.com/google/benchmark
GIT_TAG v1.2.0
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
CMAKE_ARGS
-G${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}${XCODE_EXT}/${BENCHLIB}
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(google_benchmark source_dir binary_dir)
set(benchmark_INCLUDE_DIR ${source_dir}/include)
set(benchmark_LIBRARY ${binary_dir}/src/libbenchmark.a)

set(benchmark_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${BENCHLIB})

file(MAKE_DIRECTORY ${benchmark_INCLUDE_DIR})

add_dependencies(benchmark google_benchmark)
Expand Down
26 changes: 19 additions & 7 deletions cmake/Modules/Finded25519.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,37 @@ set(URL https://github.com/hyperledger/iroha-ed25519)
set(VERSION e7188b8393dbe5ac54378610d53630bd4a180038)
set_target_description(ed25519 "Digital signature algorithm" ${URL} ${VERSION})

iroha_get_lib_name(EDLIB ed25519 STATIC)

if (NOT ed25519_FOUND)
externalproject_add(hyperledger_ed25519
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS -DTESTING=OFF -DBUILD=STATIC
CMAKE_ARGS
-DEDIMPL=ref10
-DHASH=sha3_brainhub
-DRANDOM=dev_urandom

-DTESTING=OFF
-DBUILD_TESTING=OFF
-DBUILD=STATIC

-G${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
BUILD_BYPRODUCTS
${EP_PREFIX}/src/hyperledger_ed25519-build${XCODE_EXT}/${EDLIB}
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(hyperledger_ed25519 binary_dir)
externalproject_get_property(hyperledger_ed25519 source_dir)
set(ed25519_INCLUDE_DIR ${source_dir}/include)
set(ed25519_LIBRARY ${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}ed25519${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ed25519_LIBRARY ${binary_dir}${XCODE_EXT}/${EDLIB})
file(MAKE_DIRECTORY ${ed25519_INCLUDE_DIR})
link_directories(${binary_dir})

add_dependencies(ed25519 hyperledger_ed25519)
endif ()
Expand All @@ -38,7 +54,3 @@ set_target_properties(ed25519 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ed25519_INCLUDE_DIR}
IMPORTED_LOCATION ${ed25519_LIBRARY}
)

if(ENABLE_LIBS_PACKAGING)
add_install_step_for_lib(${ed25519_LIBRARY})
endif()
27 changes: 20 additions & 7 deletions cmake/Modules/Findgflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,32 @@ set(URL https://github.com/gflags/gflags.git)
set(VERSION f8a0efe03aa69b3336d8e228b37d4ccb17324b88)
set_target_description(gflags "Flag parsing engine" ${URL} ${VERSION})

iroha_get_lib_name(GFLAGSLIB gflags STATIC)

if (NOT gflags_FOUND)
externalproject_add(gflags_gflags
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
BUILD_BYPRODUCTS ${EP_PREFIX}/src/gflags_gflags-build/lib/libgflags.a
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS
-G${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GFLAGSLIB}
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(gflags_gflags binary_dir)
set(gflags_INCLUDE_DIR ${binary_dir}/include)
set(gflags_LIBRARY ${binary_dir}/lib/libgflags.a)

set(gflags_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GFLAGSLIB})

file(MAKE_DIRECTORY ${gflags_INCLUDE_DIR})

add_dependencies(gflags gflags_gflags)
Expand Down
61 changes: 34 additions & 27 deletions cmake/Modules/Findgrpc.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
add_library(grpc UNKNOWN IMPORTED)
add_library(grpc++ UNKNOWN IMPORTED)
add_library(grpc++_reflection UNKNOWN IMPORTED)
add_library(gpr UNKNOWN IMPORTED)
add_executable(grpc_cpp_plugin IMPORTED)

Expand All @@ -13,9 +12,6 @@ mark_as_advanced(grpc_LIBRARY)
find_library(grpc_grpc++_LIBRARY grpc++)
mark_as_advanced(grpc_grpc++_LIBRARY)

find_library(grpc_grpc++_reflection_LIBRARY grpc++_reflection)
mark_as_advanced(grpc_grpc++_reflection_LIBRARY)

find_library(gpr_LIBRARY gpr)
mark_as_advanced(gpr_LIBRARY)

Expand All @@ -26,42 +22,59 @@ find_package_handle_standard_args(grpc DEFAULT_MSG
grpc_LIBRARY
grpc_INCLUDE_DIR
gpr_LIBRARY
grpc_grpc++_reflection_LIBRARY
grpc_CPP_PLUGIN
)

set(URL https://github.com/grpc/grpc)
set(VERSION bfcbad3b86c7912968dc8e64f2121c920dad4dfb)
set_target_description(grpc "Remote Procedure Call library" ${URL} ${VERSION})

iroha_get_lib_name(GPRLIB gpr SHARED)
iroha_get_lib_name(GRPCLIB grpc SHARED)
iroha_get_lib_name(GRPCPPLIB grpc++ SHARED)

if (NOT grpc_FOUND)
find_package(Git REQUIRED)
externalproject_add(grpc_grpc
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG -DProtobuf_DIR=${EP_PREFIX}/src/google_protobuf-build/lib/cmake/protobuf -DgRPC_ZLIB_PROVIDER=package -DBUILD_SHARED_LIBS=ON
PATCH_COMMAND ${GIT_EXECUTABLE} apply ${PROJECT_SOURCE_DIR}/patch/fix-protobuf-package-include.patch || true
BUILD_BYPRODUCTS ${EP_PREFIX}/src/grpc_grpc-build/grpc_cpp_plugin
${EP_PREFIX}/src/grpc_grpc-build/${CMAKE_SHARED_LIBRARY_PREFIX}grpc${CMAKE_SHARED_LIBRARY_SUFFIX}
${EP_PREFIX}/src/grpc_grpc-build/${CMAKE_SHARED_LIBRARY_PREFIX}grpc++${CMAKE_SHARED_LIBRARY_SUFFIX}
${EP_PREFIX}/src/grpc_grpc-build/${CMAKE_SHARED_LIBRARY_PREFIX}grpc++_reflection${CMAKE_SHARED_LIBRARY_SUFFIX}
CMAKE_ARGS
-DgRPC_PROTOBUF_PROVIDER=package
-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG
-DProtobuf_DIR=${EP_PREFIX}/src/google_protobuf-build/lib/cmake/protobuf
-DgRPC_ZLIB_PROVIDER=package
-DBUILD_SHARED_LIBS=ON
-G${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
PATCH_COMMAND
${GIT_EXECUTABLE} apply ${PROJECT_SOURCE_DIR}/patch/fix-protobuf-package-include.patch || true
BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}${XCODE_EXT}/grpc_cpp_plugin
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GPRLIB}
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GRPCLIB}
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GRPCPPLIB}
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(grpc_grpc source_dir binary_dir)
set(grpc_INCLUDE_DIR ${source_dir}/include)
set(grpc_LIBRARY ${binary_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}grpc${CMAKE_SHARED_LIBRARY_SUFFIX})
set(grpc_grpc++_LIBRARY ${binary_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}grpc++${CMAKE_SHARED_LIBRARY_SUFFIX})
set(grpc_grpc++_reflection_LIBRARY ${binary_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}grpc++_reflection${CMAKE_SHARED_LIBRARY_SUFFIX})
set(grpc_CPP_PLUGIN ${binary_dir}/grpc_cpp_plugin)
set(grpc_INCLUDE_DIR ${source_dir}/include)
set(gpr_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GPRLIB})
set(grpc_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GRPCLIB})
set(grpc_grpc++_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GRPCPPLIB})
set(grpc_CPP_PLUGIN ${CMAKE_BINARY_DIR}${XCODE_EXT}/grpc_cpp_plugin)

file(MAKE_DIRECTORY ${grpc_INCLUDE_DIR})
link_directories(${binary_dir})

add_dependencies(grpc_grpc protobuf)
add_dependencies(grpc grpc_grpc)
add_dependencies(grpc++ grpc_grpc)
add_dependencies(grpc++_reflection grpc_grpc)
add_dependencies(grpc_cpp_plugin grpc_grpc protoc)
endif ()

Expand All @@ -77,12 +90,6 @@ set_target_properties(grpc++ PROPERTIES
IMPORTED_LOCATION ${grpc_grpc++_LIBRARY}
)

set_target_properties(grpc++_reflection PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${grpc_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES grpc++
IMPORTED_LOCATION ${grpc_grpc++_reflection_LIBRARY}
)

set_target_properties(grpc_cpp_plugin PROPERTIES
IMPORTED_LOCATION ${grpc_CPP_PLUGIN}
)
Expand All @@ -92,7 +99,7 @@ set_target_properties(gpr PROPERTIES
)

if(ENABLE_LIBS_PACKAGING)
add_install_step_for_lib(${gpr_LIBRARY})
add_install_step_for_lib(${grpc_LIBRARY})
add_install_step_for_lib(${grpc_grpc++_LIBRARY})
add_install_step_for_lib(${gpr_LIBRARY})
endif()
41 changes: 27 additions & 14 deletions cmake/Modules/Findgtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,44 @@ set(VERSION ec44c6c1675c25b9827aacd08c02433cccde7780)
set_target_description(gtest "Unit testing library" ${URL} ${VERSION})
set_target_description(gmock "Mocking library" ${URL} ${VERSION})

iroha_get_lib_name(GTESTMAINLIB gtest_main STATIC)
iroha_get_lib_name(GTESTLIB gtest STATIC)
iroha_get_lib_name(GMOCKMAINLIB gmock_main STATIC)
iroha_get_lib_name(GMOCKLIB gmock STATIC)

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
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
${EP_PREFIX}/src/google_test-build/googlemock/libgmock.a
CMAKE_ARGS
-Dgtest_force_shared_crt=ON
-Dgtest_disable_pthreads=OFF
-G${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}
BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GTESTMAINLIB}
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GTESTLIB}
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GMOCKMAINLIB}
${CMAKE_BINARY_DIR}${XCODE_EXT}/${GMOCKLIB}
INSTALL_COMMAND "" # remove install step
UPDATE_COMMAND "" # remove update step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
TEST_COMMAND "" # remove test step
)
ExternalProject_Get_Property(google_test source_dir binary_dir)
set(gtest_INCLUDE_DIR ${source_dir}/googletest/include)
set(gmock_INCLUDE_DIR ${source_dir}/googlemock/include)

set(gtest_MAIN_LIBRARY ${binary_dir}/googlemock/gtest/libgtest_main.a)
set(gtest_LIBRARY ${binary_dir}/googlemock/gtest/libgtest.a)
set(gtest_MAIN_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GTESTMAINLIB})
set(gtest_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GTESTLIB})

set(gmock_MAIN_LIBRARY ${binary_dir}/googlemock/libgmock_main.a)
set(gmock_LIBRARY ${binary_dir}/googlemock/libgmock.a)
set(gmock_MAIN_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GMOCKMAINLIB})
set(gmock_LIBRARY ${CMAKE_BINARY_DIR}${XCODE_EXT}/${GMOCKLIB})

file(MAKE_DIRECTORY ${gtest_INCLUDE_DIR})
file(MAKE_DIRECTORY ${gmock_INCLUDE_DIR})
Expand Down
14 changes: 7 additions & 7 deletions cmake/Modules/Findoptional.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ set_target_description(optional "Data structure for optional types" ${URL} ${VER

if (NOT optional_FOUND)
externalproject_add(martinmoene_optional
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
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
BUILD_COMMAND "" # remove build step
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(martinmoene_optional source_dir)
set(optional_INCLUDE_DIR ${source_dir}/include)
file(MAKE_DIRECTORY ${optional_INCLUDE_DIR})
file(MAKE_DIRECTORY ${optional_INCLUDE_DIR})

add_dependencies(optional martinmoene_optional)
endif ()
Expand Down
26 changes: 17 additions & 9 deletions cmake/Modules/Findpq.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,33 @@ set(URL https://git.postgresql.org/git/postgresql.git)
set(VERSION 029386ccbddd0a33d481b94e511f5219b03e6636)
set_target_description(pq "C postgres client library" ${URL} ${VERSION})

iroha_get_lib_name(PQLIB pq STATIC)

if (NOT pq_FOUND)
set(pqlib_path ${EP_PREFIX}/src/postgres_postgres/src/interfaces/libpq/${PQLIB})
set(pqconfig_path ${EP_PREFIX}/src/postgres_postgres/src/bin/pq_config/pq_config)

externalproject_add(postgres_postgres
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CONFIGURE_COMMAND ./configure --without-readline
CONFIGURE_COMMAND
./configure --without-readline
BUILD_IN_SOURCE 1
BUILD_COMMAND $(MAKE) -C ./src/bin/pg_config && $(MAKE) -C ./src/interfaces/libpq
BUILD_BYPRODUCTS ${EP_PREFIX}/src/postgres_postgres/src/interfaces/libpq/libpq.a
BUILD_COMMAND
$(MAKE) -C ./src/bin/pg_config && $(MAKE) -C ./src/interfaces/libpq
BUILD_BYPRODUCTS
${pqlib_path}
${pqconfig_path}
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(postgres_postgres source_dir)
set(postgres_INCLUDE_DIR ${source_dir}/src/include)
set(pq_INCLUDE_DIR ${source_dir}/src/interfaces/libpq)
set(pq_LIBRARY ${source_dir}/src/interfaces/libpq/libpq.a)
set(pg_config_EXECUTABLE ${source_dir}/src/bin/pg_config/pg_config)
file(MAKE_DIRECTORY ${pq_INCLUDE_DIR} ${postgres_INCLUDE_DIR})
set(pq_INCLUDE_DIR ${source_dir}/src/interfaces/libpq)
set(pq_LIBRARY ${pqlib_path})
set(pg_config_EXECUTABLE ${pqconfig_path})
file(MAKE_DIRECTORY ${pq_INCLUDE_DIR} ${postgres_INCLUDE_DIR})

add_dependencies(pg_config postgres_postgres)
add_dependencies(pq postgres_postgres pg_config)
Expand Down
Loading

0 comments on commit bf4a2ac

Please sign in to comment.