Skip to content

Commit

Permalink
Detach crypto++ from threshsign. (#1786)
Browse files Browse the repository at this point in the history
Link it only where required.
  • Loading branch information
toly-kournik authored Aug 8, 2021
1 parent 2a543cd commit 48257cf
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 25 deletions.
2 changes: 0 additions & 2 deletions bftclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ add_library(bftclient_new STATIC
${bftengine_SOURCE_DIR}/src/bftengine/Crypto.cpp
)

find_package(cryptopp REQUIRED)
target_include_directories(corebft PUBLIC ${CRYPTOPP_INCLUDE_DIRS})
target_include_directories(bftclient_new PUBLIC include)
target_include_directories(bftclient_new PUBLIC src)
target_include_directories(bftclient_new PUBLIC ${bftengine_SOURCE_DIR}/src)
Expand Down
4 changes: 0 additions & 4 deletions bftclient/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
find_package(GTest REQUIRED)
find_package(cryptopp REQUIRED)

add_executable(bft_client_test bft_client_test.cpp)
add_test(bft_client_test bft_client_test)
Expand All @@ -9,19 +8,16 @@ target_link_libraries(bft_client_test PRIVATE
GTest::GTest
bftclient_new
threshsign
cryptopp
secretsmanager
)

add_executable(bft_client_api_tests bft_client_api_tests.cpp)
add_test(bft_client_api_tests bft_client_api_tests)
target_include_directories(bft_client_api_tests PRIVATE ../src)
target_include_directories(corebft PUBLIC ${CRYPTOPP_INCLUDE_DIRS})
target_link_libraries(bft_client_api_tests PRIVATE
GTest::Main
GTest::GTest
bftclient_new
threshsign
cryptopp
secretsmanager
)
7 changes: 1 addition & 6 deletions bftengine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,16 @@ add_library(bftclient_shared SHARED src/bftengine/SimpleClientImp)
add_library(bftheaders INTERFACE)
target_include_directories(bftheaders INTERFACE include)

find_package(cryptopp REQUIRED)

get_property(perf_include GLOBAL PROPERTY PERF_MANAGER_INCLUDE_DIR)
get_property(kvbc_include GLOBAL PROPERTY KVBC_INCLUDE_DIR)

target_compile_options(corebft PUBLIC "-Wno-extra-semi" "-Wno-undefined-var-template") # TODO tmp cryptopp
target_include_directories(corebft PUBLIC include/)
target_include_directories(corebft PUBLIC include/bftengine)
target_include_directories(corebft PUBLIC include/bcstatetransfer)
target_include_directories(corebft PUBLIC include/simplestatetransfer)
target_include_directories(corebft PUBLIC include/metadatastorage)
target_include_directories(corebft PRIVATE src/bftengine)
target_include_directories(corebft PRIVATE src/preprocessor)
target_include_directories(corebft PUBLIC ${CRYPTOPP_INCLUDE_DIRS})
target_include_directories(corebft PUBLIC ${perf_include}/performance/include)
target_include_directories(corebft PUBLIC tests/mocks)
target_link_libraries(corebft PUBLIC
Expand Down Expand Up @@ -130,11 +126,10 @@ target_link_libraries(bftclient PUBLIC bftcommunication diagnostics)
target_include_directories(bftclient_shared PUBLIC include/bftengine)
target_include_directories(bftclient_shared PUBLIC src/bftengine)
target_include_directories(bftclient_shared PUBLIC src/preprocessor)
target_include_directories(bftclient_shared PUBLIC ${CRYPTOPP_INCLUDE_DIRS})
target_include_directories(bftclient_shared PUBLIC ${perf_include})
target_include_directories(bftclient_shared PUBLIC ${kvbc_include})

target_link_libraries(bftclient_shared PUBLIC bftcommunication_shared ${CRYPTOPP_SHARED_LIBRARY} diagnostics)
target_link_libraries(bftclient_shared PUBLIC bftcommunication_shared diagnostics)
install (TARGETS bftclient_shared DESTINATION lib${LIB_SUFFIX})

install(DIRECTORY include/bftengine DESTINATION include)
Expand Down
2 changes: 0 additions & 2 deletions bftengine/src/preprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
find_package(OpenSSL REQUIRED)
find_package(cryptopp REQUIRED)

if (BUILD_TESTING)
add_subdirectory(tests)
Expand All @@ -22,7 +21,6 @@ set(preprocessor_source_files

add_library(preprocessor STATIC ${preprocessor_source_files})

target_include_directories(preprocessor PUBLIC ${CRYPTOPP_INCLUDE_DIRS})
target_include_directories(preprocessor PUBLIC ${OPENSSL_INCLUDE_DIR})
target_include_directories(preprocessor PUBLIC ${bftengine_SOURCE_DIR}/include)
target_include_directories(preprocessor PUBLIC ${bftengine_SOURCE_DIR}/include/bftengine)
Expand Down
3 changes: 0 additions & 3 deletions bftengine/tests/messages/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ target_compile_options(ReqMissingDataMsg_test PUBLIC "-Wno-sign-compare")
add_executable(ViewChangeMsg_test ViewChangeMsg_test.cpp helper.cpp)
add_test(ViewChangeMsg_test ViewChangeMsg_test)
find_package(GTest REQUIRED)
find_package(cryptopp REQUIRED)
target_include_directories(ViewChangeMsg_test
PRIVATE
${bftengine_SOURCE_DIR}/src/bftengine)
Expand Down Expand Up @@ -123,7 +122,6 @@ target_compile_options(NewViewMsg_test PUBLIC "-Wno-sign-compare")
add_executable(ReplicaAsksToLeaveViewMsg_test ReplicaAsksToLeaveViewMsg_test.cpp helper.cpp)
add_test(ReplicaAsksToLeaveViewMsg_test ReplicaAsksToLeaveViewMsg_test)
find_package(GTest REQUIRED)
find_package(cryptopp REQUIRED)
target_include_directories(ReplicaAsksToLeaveViewMsg_test
PRIVATE
${bftengine_SOURCE_DIR}/src/bftengine)
Expand All @@ -134,7 +132,6 @@ target_compile_options(ReplicaAsksToLeaveViewMsg_test PUBLIC "-Wno-sign-compare"
add_executable(ReplicaRestartReadyMsg_test ReplicaRestartReadyMsg_test.cpp helper.cpp)
add_test(ReplicaRestartReadyMsg_test ReplicaRestartReadyMsg_test)
find_package(GTest REQUIRED)
find_package(cryptopp REQUIRED)
target_include_directories(ReplicaRestartReadyMsg_test
PRIVATE
${bftengine_SOURCE_DIR}/src/bftengine)
Expand Down
1 change: 0 additions & 1 deletion bftengine/tests/testViewChange/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ add_executable(views_manager_test test_views_manager.cpp ${bftengine_SOURCE_DIR}

add_test(views_manager_test views_manager_test)
target_link_libraries(views_manager_test GTest::Main corebft)
find_package(cryptopp REQUIRED)

# Not using target_link_libraries, because the header is in the src directory.
target_include_directories(views_manager_test PRIVATE
Expand Down
1 change: 0 additions & 1 deletion client/reconfiguration/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ target_link_libraries(poll_based_state_client_test PRIVATE
bftclient_new
cmf_messages
threshsign
cryptopp
secretsmanager
)
1 change: 0 additions & 1 deletion client/thin-replica-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ target_include_directories(thin_replica_client_lib PRIVATE
target_link_libraries(thin_replica_client_lib
opentracing
util
cryptopp
thin-replica-proto
)

Expand Down
1 change: 1 addition & 0 deletions cmake-build-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ cmake \
-DUSE_OPENTRACING=ON \
-DUSE_S3_OBJECT_STORE=ON \
-DUSE_GRPC=ON \
-DUSE_LOG4CPP=ON \
..
2 changes: 0 additions & 2 deletions threshsign/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ if(NOT BUILD_THIRDPARTY)
find_library(RELIC_STATIC_LIBRARY NAMES "librelic_s.a")
endif()
find_library(GMP_STATIC_LIBRARY NAMES "libgmp.a")
find_library(CRYPTOPP_STATIC_LIBRARY NAMES "libcryptopp.a")

# Compiler flags
string(APPEND CXX_FLAGS " -Wall")
Expand Down Expand Up @@ -51,7 +50,6 @@ function(link_with_relic_library targetName)
PRIVATE
${RELIC_STATIC_LIBRARY}
${GMP_STATIC_LIBRARY}
${CRYPTOPP_STATIC_LIBRARY}
)
endfunction()

Expand Down
5 changes: 2 additions & 3 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ target_include_directories(GenerateConcordKeys
${threshsign_SOURCE_DIR}/include
${bftengine_SOURCE_DIR}/src
${bftengine_SOURCE_DIR}/include
${CRYPTOPP_INCLUDE_DIRS})
${CRYPTOPP_INCLUDE_DIRS})

target_link_libraries(GenerateConcordKeys
PUBLIC
threshsign
${CRYPTOPP_LIBRARIES}
util)

link_with_relic_library(GenerateConcordKeys)
Expand All @@ -27,8 +28,6 @@ set_target_properties(GenerateConcordKeys
RUNTIME_OUTPUT_DIRECTORY
.)

target_compile_options(GenerateConcordKeys PUBLIC "-Wno-extra-semi" "-Wno-undefined-var-template") # TODO tmp cryptopp

if (BUILD_TESTING)
add_executable(TestGeneratedKeys
TestGeneratedKeys.cpp
Expand Down

0 comments on commit 48257cf

Please sign in to comment.