Skip to content

Commit

Permalink
Add more unity build include pbft rpbft and initialize (FISCO-BCOS#4568)
Browse files Browse the repository at this point in the history
  • Loading branch information
morebtcg authored Aug 7, 2024
1 parent 0aa7a0a commit ee7935d
Show file tree
Hide file tree
Showing 28 changed files with 33 additions and 67 deletions.
4 changes: 1 addition & 3 deletions bcos-boostssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ target_include_directories(bcos-boostssl PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/bcos-boostssl>)
target_link_libraries(bcos-boostssl PUBLIC bcos-framework bcos-utilities OpenSSL::SSL)
set_target_properties(bcos-boostssl PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(bcos-boostssl PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-codec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ target_include_directories(${CODEC_TARGET} PUBLIC
$<INSTALL_INTERFACE:include/bcos-codec>
)
target_link_libraries(${CODEC_TARGET} PUBLIC bcos-crypto Microsoft.GSL::GSL)
set_target_properties(${CODEC_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${CODEC_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ find_package(HSM-CRYPTO REQUIRED)

add_library(bcos-crypto STATIC ${ALL_SRCS})
target_link_libraries(bcos-crypto PUBLIC ${LIB_LIST})
set_target_properties(bcos-crypto PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(bcos-crypto PROPERTIES UNITY_BUILD "ON")

if(NOT WIN32)
target_compile_options(bcos-crypto PUBLIC "-Wno-ignored-attributes")
Expand Down
5 changes: 1 addition & 4 deletions bcos-executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ find_package(Boost REQUIRED serialization program_options context)
find_package(jsoncpp REQUIRED)

file(GLOB_RECURSE SRCS src/*.cpp)
message("All executor files is: ${SRCS}")
add_library(${EXECUTOR_TARGET} ${SRCS})
if(WITH_WASM)
target_link_libraries(${EXECUTOR_TARGET} PUBLIC jsoncpp_static ${CODEC_TARGET} ${TOOL_TARGET} ${CRYPTO_TARGET} ${TABLE_TARGET} wedprcrypto::fisco-bcos bcos-protocol
Expand All @@ -29,9 +28,7 @@ set_source_files_properties(
"src/vm/kzgPrecompiled.cpp"
"src/vm/VMFactory.cpp"
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
set_target_properties(${EXECUTOR_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${EXECUTOR_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TOOLS)
add_subdirectory(tools)
Expand Down
4 changes: 1 addition & 3 deletions bcos-front/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ aux_source_directory(bcos-front SRCS)

add_library(${FRONT_TARGET} ${SRCS})
target_link_libraries(${FRONT_TARGET} PUBLIC bcos-framework ${UTILITIES_TARGET})
set_target_properties(${FRONT_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${FRONT_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-gateway/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ find_package(tarscpp REQUIRED)

add_library(${GATEWAY_TARGET} ${SRCS})
target_link_libraries(${GATEWAY_TARGET} PUBLIC jsoncpp_static Boost::filesystem bcos-boostssl ${FRONT_TARGET} ${TARS_PROTOCOL_TARGET} tarscpp::tarsservant tarscpp::tarsutil)
set_target_properties(${GATEWAY_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${GATEWAY_TARGET} PROPERTIES UNITY_BUILD "ON")

if (APPLE)
# target_compile_options(${GATEWAY_TARGET} PRIVATE -faligned-allocation)
Expand Down
1 change: 1 addition & 0 deletions bcos-ledger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ find_package(Boost REQUIRED serialization)

add_library(${LEDGER_TARGET} ${SRCS})
target_link_libraries(${LEDGER_TARGET} PUBLIC ${TOOL_TARGET} ${CODEC_TARGET} ${TABLE_TARGET} bcos-concepts Boost::serialization)
set_target_properties(${LEDGER_TARGET} PROPERTIES UNITY_BUILD "ON")

# test related
if (TESTS)
Expand Down
5 changes: 5 additions & 0 deletions bcos-pbft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ find_package(jsoncpp CONFIG REQUIRED)
file(GLOB_RECURSE SRCS bcos-pbft/*.cpp)
add_library(${PBFT_TARGET} ${SRCS} ${MESSAGES_SRCS})
target_link_libraries(${PBFT_TARGET} PUBLIC ${TXPOOL_TARGET} ${UTILITIES_TARGET} ${TOOL_TARGET} bcos-framework jsoncpp_static)
set_source_files_properties(
"bcos-pbft/pbft/protocol/proto/PBFT.pb.cc"
"bcos-pbft/core/proto/Consensus.pb.cc"
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
# set_target_properties(${PBFT_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
# fetch bcos-test
Expand Down
2 changes: 1 addition & 1 deletion bcos-pbft/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ target_include_directories(${TEST_BINARY_NAME} PRIVATE . ${CMAKE_SOURCE_DIR})

find_package(Boost REQUIRED unit_test_framework)

target_link_libraries(${TEST_BINARY_NAME} ${PBFT_TARGET} ${RPBFT_TARGET} ${TOOL_TARGET} ${TABLE_TARGET} bcos-crypto ${TARS_PROTOCOL_TARGET} protobuf::libprotobuf Boost::unit_test_framework)
target_link_libraries(${TEST_BINARY_NAME} ${RPBFT_TARGET} ${PBFT_TARGET} ${TOOL_TARGET} ${TABLE_TARGET} bcos-crypto ${TARS_PROTOCOL_TARGET} protobuf::libprotobuf Boost::unit_test_framework)
add_test(NAME test-pbft WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TEST_BINARY_NAME})
1 change: 1 addition & 0 deletions bcos-rpbft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ file(GLOB_RECURSE SRCS bcos-rpbft/*.cpp)
add_library(${RPBFT_TARGET} ${SRCS})
include_directories(${CMAKE_BINARY_DIR}/bcos-pbft/)
target_link_libraries(${RPBFT_TARGET} PUBLIC ${PBFT_TARGET})
set_target_properties(${RPBFT_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
# fetch bcos-test
Expand Down
2 changes: 1 addition & 1 deletion bcos-rpbft/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ target_include_directories(${TEST_BINARY_NAME} PRIVATE . ${CMAKE_SOURCE_DIR})

find_package(Boost REQUIRED unit_test_framework)

target_link_libraries(${TEST_BINARY_NAME} ${PBFT_TARGET} ${RPBFT_TARGET} ${TABLE_TARGET} bcos-crypto ${TARS_PROTOCOL_TARGET} ${PBFT_TARGET} Boost::unit_test_framework)
target_link_libraries(${TEST_BINARY_NAME} ${RPBFT_TARGET} ${TABLE_TARGET} bcos-crypto ${TARS_PROTOCOL_TARGET} ${PBFT_TARGET} Boost::unit_test_framework)
add_test(NAME test-rpbft WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TEST_BINARY_NAME})
4 changes: 1 addition & 3 deletions bcos-rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ find_package(tarscpp REQUIRED)

add_library(${RPC_TARGET} ${SRCS} ${HEADERS})
target_link_libraries(${RPC_TARGET} PUBLIC bcos-boostssl ${LEDGER_TARGET} ${CRYPTO_TARGET} ${TARS_PROTOCOL_TARGET} jsoncpp_static tarscpp::tarsservant tarscpp::tarsutil)
set_target_properties(${RPC_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${RPC_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-scheduler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ aux_source_directory(src SRCS)

add_library(${SCHEDULER_TARGET} ${SRCS})
target_link_libraries(${SCHEDULER_TARGET} PUBLIC ${TABLE_TARGET} ${TARS_PROTOCOL_TARGET})
set_target_properties(${SCHEDULER_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${SCHEDULER_TARGET} PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ target_include_directories(${BCOS_CPP_SDK_TARGET} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/bcos-cpp-sdk>)
target_link_libraries(${BCOS_CPP_SDK_TARGET} PUBLIC ${LINK_LIB_LIST})
set_target_properties(${BCOS_CPP_SDK_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${BCOS_CPP_SDK_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-sealer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ add_library(${SEALER_TARGET} ${SRC_LIST})
find_package(tarscpp REQUIRED)

target_link_libraries(${SEALER_TARGET} PUBLIC ${TOOL_TARGET} ${UTILITIES_TARGET} bcos-framework ${TXPOOL_TARGET} ${TARS_PROTOCOL_TARGET})
set_target_properties(${SEALER_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${SEALER_TARGET} PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion bcos-sealer/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_include_directories(${TEST_BINARY_NAME} PRIVATE . ../bcos-sealer)
find_package(Boost REQUIRED unit_test_framework log)
find_package(fmt REQUIRED)

target_link_libraries(${TEST_BINARY_NAME} PUBLIC ${SEALER_TARGET} ${PBFT_TARGET} ${TARS_PROTOCOL_TARGET} Boost::unit_test_framework Boost::log fmt::fmt-header-only)
target_link_libraries(${TEST_BINARY_NAME} PUBLIC ${SEALER_TARGET} ${RPBFT_TARGET} ${PBFT_TARGET} ${TARS_PROTOCOL_TARGET} Boost::unit_test_framework Boost::log fmt::fmt-header-only)
include(SearchTestCases)
config_test_cases("" "${SOURCES}" ${TEST_BINARY_NAME} "${EXCLUDE_SUITES}")

1 change: 1 addition & 0 deletions bcos-security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ add_library(${SECURITY_TARGET} ${SRC_LIST})
find_package(jsoncpp REQUIRED)

target_link_libraries(${SECURITY_TARGET} PUBLIC ${UTILITIES_TARGET} ${TOOL_TARGET} ${CRYPTO_TARGET} jsoncpp_static)
set_target_properties(${SECURITY_TARGET} PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ target_include_directories(${STORAGE_TARGET} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/bcos-storage>)
target_link_libraries(${STORAGE_TARGET} PUBLIC ${LIB_LIST})
set_target_properties(${STORAGE_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${STORAGE_TARGET} PROPERTIES UNITY_BUILD "ON")

if (APPLE)
target_link_libraries(${STORAGE_TARGET} PUBLIC "-framework SystemConfiguration")
Expand Down
4 changes: 1 addition & 3 deletions bcos-sync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ include_directories(${PROTO_OUTPUT_PATH})
file(GLOB_RECURSE SRCS bcos-sync/*.cpp)
add_library(${SYNC_TARGET} ${SRCS} ${SYNC_SRCS})
target_link_libraries(${SYNC_TARGET} PUBLIC ${STORAGE_TARGET} bcos-framework ${UTILITIES_TARGET} ${CODEC_TARGET} ${TOOL_TARGET} jsoncpp_static)
set_target_properties(${SYNC_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${SYNC_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-table/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ find_package(TBB CONFIG REQUIRED)

add_library(${TABLE_TARGET} ${SRCS})
target_link_libraries(${TABLE_TARGET} PUBLIC ${UTILITIES_TARGET} bcos-framework Boost::serialization TBB::tbb)
set_target_properties(${TABLE_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${TABLE_TARGET} PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-tars-protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ target_include_directories(${TARS_PROTOCOL_TARGET} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated>
$<INSTALL_INTERFACE:include/bcos-tars-protocol>)
target_link_libraries(${TARS_PROTOCOL_TARGET} PUBLIC bcos-concepts bcos-crypto tarscpp::tarsservant tarscpp::tarsutil TBB::tbb)
set_target_properties(${TARS_PROTOCOL_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${TARS_PROTOCOL_TARGET} PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ target_include_directories(${TOOL_TARGET} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/bcos-protocol>
)
target_link_libraries(${TOOL_TARGET} PUBLIC ${TABLE_TARGET} ${UTILITIES_TARGET} bcos-framework jsoncpp_static tarscpp::tarsservant tarscpp::tarsutil TBB::tbb)
set_target_properties(${TOOL_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${TOOL_TARGET} PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions bcos-txpool/bcos-txpool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ find_package(Protobuf CONFIG REQUIRED)
target_include_directories(${TXPOOL_TARGET} PUBLIC .)
target_include_directories(${TXPOOL_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/bcos-txpool)
target_link_libraries(${TXPOOL_TARGET} PUBLIC TBB::tbb protobuf::libprotobuf bcos-protocol ${UTILITIES_TARGET} ${TOOL_TARGET})
set_target_properties(${TXPOOL_TARGET} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${TXPOOL_TARGET} PROPERTIES UNITY_BUILD "ON")
4 changes: 1 addition & 3 deletions bcos-utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ if (ONLY_CPP_SDK)
else ()
target_link_libraries(bcos-utilities PUBLIC Boost::iostreams Boost::log Boost::filesystem Boost::chrono Boost::thread Boost::serialization redis++::redis++_static ZLIB::ZLIB zstd::libzstd_static ittapi)
endif ()
set_target_properties(bcos-utilities PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(bcos-utilities PROPERTIES UNITY_BUILD "ON")

if(TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions fisco-bcos-air/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ aux_source_directory(. SRC_LIST)
set(BINARY_NAME fisco-bcos)
add_executable(${BINARY_NAME} ${SRC_LIST})
target_link_libraries(${BINARY_NAME} PUBLIC ${INIT_LIB} ${PBFT_INIT_LIB} ${TOOL_TARGET} ${COMMAND_HELPER_LIB} ${RPC_TARGET} ${GATEWAY_TARGET})
set_target_properties(${BINARY_NAME} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${BINARY_NAME} PROPERTIES UNITY_BUILD "ON")
5 changes: 2 additions & 3 deletions libinitializer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_link_libraries(${FRONTSERVICE_INIT_LIB} PUBLIC ${PROTOCOL_INIT_LIB} ${TOO

add_library(${PBFT_INIT_LIB} PBFTInitializer.cpp ProPBFTInitializer.cpp)
target_link_libraries(${PBFT_INIT_LIB} PUBLIC ${PROTOCOL_INIT_LIB} ${LEDGER_TARGET} ${TOOL_TARGET} ${SEALER_TARGET} ${RPBFT_TARGET} ${PBFT_TARGET} ${SYNC_TARGET} ${STORAGE_TARGET})
set_target_properties(${PBFT_INIT_LIB} PROPERTIES UNITY_BUILD "ON")
if(WITH_TIKV)
target_link_libraries(${PBFT_INIT_LIB} PUBLIC ${LEADER_ELECTION_TARGET})
endif()
Expand All @@ -31,7 +32,5 @@ if(WITH_LIGHTNODE)
list(APPEND INIT_LIB_DEPENDS lightnodeinit bcos-concepts)
endif()
target_link_libraries(${INIT_LIB} PUBLIC ${INIT_LIB_DEPENDS})
set_target_properties(${INIT_LIB} PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(${INIT_LIB} PROPERTIES UNITY_BUILD "ON")
add_dependencies(${INIT_LIB} BuildInfo.h)
4 changes: 1 addition & 3 deletions transaction-executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ target_include_directories(transaction-executor PUBLIC
$<INSTALL_INTERFACE:include/bcos-transaction-executor>)
target_link_libraries(transaction-executor PUBLIC ${EXECUTOR_TARGET} ${STORAGE_TARGET} jsoncpp_static ${CODEC_TARGET} ${CRYPTO_TARGET} ${TABLE_TARGET} bcos-protocol
evmone evmc::loader evmc::instructions fmt::fmt-header-only)
set_target_properties(transaction-executor PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(transaction-executor PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down
4 changes: 1 addition & 3 deletions transaction-scheduler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ target_include_directories(transaction-scheduler PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/bcos-transaction-scheduler>)
target_link_libraries(transaction-scheduler PUBLIC bcos-framework fmt::fmt-header-only)
set_target_properties(transaction-scheduler PROPERTIES
UNITY_BUILD "ON"
)
set_target_properties(transaction-scheduler PROPERTIES UNITY_BUILD "ON")

if (TESTS)
enable_testing()
Expand Down

0 comments on commit ee7935d

Please sign in to comment.