Skip to content

Commit

Permalink
Refactor dependency in cmake model
Browse files Browse the repository at this point in the history
  • Loading branch information
muratovv committed Aug 30, 2017
1 parent 5533db8 commit 2c91f80
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 76 deletions.
36 changes: 25 additions & 11 deletions iroha-cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
# GenesisBlockClient
add_library(genesis_block_client genesis_block_client_impl.cpp)
target_link_libraries(genesis_block_client
endpoint
optional
model
)

# BootstrapNetwork
add_library(bootstrap_network bootstrap_network.cpp)
target_link_libraries(bootstrap_network
pb_model_converters
json_model_converters
genesis_block_client
ip_tools
)

# Gflags config validators
add_library(cli-flags_validators validators.cpp)
target_link_libraries(cli-flags_validators gflags)
target_link_libraries(cli-flags_validators gflags
)

add_library(keys_manager impl/keys_manager_impl.cpp)
add_library(keys_manager impl/keys_manager_impl.cpp
)
target_link_libraries(keys_manager
optional
crypto
Expand All @@ -17,14 +34,12 @@ add_library(client
impl/grpc_response_handler.cpp
)
target_link_libraries(client
model_converters
crypto
optional
logger
rapidjson
pb_model_converters
json_model_converters
model_generators
command_client
query_client
model_generators
logger
)

target_include_directories(client PUBLIC
Expand All @@ -39,7 +54,6 @@ add_executable(iroha-cli
target_link_libraries(iroha-cli
client
cli-flags_validators
rapidjson
model
bootstrap_network
keys_manager
)
2 changes: 1 addition & 1 deletion irohad/ametsuchi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ add_library(ametsuchi
)

target_link_libraries(ametsuchi
json_model_converters
logger
rxcpp
optional
pqxx
cpp_redis
model
libs_common
command_execution
)
28 changes: 2 additions & 26 deletions irohad/model/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
add_subdirectory(generators)
add_subdirectory(converters)

add_library(model
model_crypto_provider_impl.cpp
model_hash_provider_impl.cpp
impl/model_operators.cpp
converters/impl/pb_block_factory.cpp
converters/impl/pb_transaction_factory.cpp
converters/impl/pb_command_factory.cpp
converters/impl/pb_query_response_factory.cpp
impl/query_execution.cpp
converters/impl/pb_query_factory.cpp
converters/impl/json_common.cpp
converters/impl/json_command_factory.cpp
converters/impl/json_transaction_factory.cpp
converters/impl/json_block_factory.cpp
)

target_link_libraries(model
schema
hash
optional
rxcpp
hash
crypto
rapidjson
logger
)


add_library(model_converters
converters/impl/json_query_factory.cpp
)

target_link_libraries(model_converters
rapidjson
optional
logger
model_generators
model
)

add_library(model_registrations INTERFACE)
target_include_directories(model_registrations INTERFACE
registration
Expand Down
14 changes: 4 additions & 10 deletions irohad/model/converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ add_library(json_model_converters
impl/json_query_factory.cpp
impl/json_transaction_factory.cpp
)

target_link_libraries(json_model_converters
model
model_generators
rapidjson
schema
optional
rxcpp
hash
crypto
rapidjson
logger
model
)

add_library(pb_model_converters
Expand All @@ -24,12 +21,9 @@ add_library(pb_model_converters
impl/pb_query_response_factory.cpp
impl/pb_transaction_factory.cpp
)

target_link_libraries(pb_model_converters
model
schema
optional
rxcpp
hash
crypto
logger
)
1 change: 1 addition & 0 deletions irohad/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ add_library(block_loader
impl/block_loader_impl.cpp
)
target_link_libraries(block_loader
pb_model_converters
loader_grpc
rxcpp
model
Expand Down
1 change: 1 addition & 0 deletions irohad/ordering/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_library(ordering_service
)

target_link_libraries(ordering_service
pb_model_converters
rxcpp
optional
tbb
Expand Down
25 changes: 13 additions & 12 deletions irohad/torii/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ add_subdirectory(processor)

add_library(command_client command_client.cpp)
target_link_libraries(command_client
torii_service
endpoint
model
)
torii_service
endpoint
model
)

add_library(torii_service
torii_service_handler.cpp
impl/query_service.cpp
impl/command_service.cpp)

torii_service_handler.cpp
impl/query_service.cpp
impl/command_service.cpp
)
target_link_libraries(torii_service
endpoint
stateless_validator
model
)
pb_model_converters
endpoint
stateless_validator
model
)
4 changes: 3 additions & 1 deletion test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/test_bin)

add_subdirectory(consensus)
add_subdirectory(pipeline)

addtest(client_test client_test.cpp)
target_link_libraries(client_test
pb_model_converters
json_model_converters
client
processors
server_runner
Expand All @@ -12,4 +15,3 @@ target_include_directories(client_test PUBLIC
${PROJECT_SOURCE_DIR}/iroha-cli
)

add_subdirectory(pipeline)
3 changes: 2 additions & 1 deletion test/module/irohad/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ AddTest(blob_converter_test blob_converter_test.cpp)

AddTest(block_insertion_test block_insertion_test.cpp)
target_link_libraries(block_insertion_test
model
json_model_converters
genesis_block_server
test_block_generator
raw_block_insertion
logger
Expand Down
29 changes: 15 additions & 14 deletions test/module/irohad/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ target_link_libraries(model_crypto_provider_test

addtest(command_converter_test converters/pb_commands_test.cpp)
target_link_libraries(command_converter_test
model
pb_model_converters
)

addtest(transaction_converter_test converters/pb_transaction_test.cpp)
target_link_libraries(transaction_converter_test
model
pb_model_converters
)

addtest(block_converter_test converters/pb_block_test.cpp)
target_link_libraries(block_converter_test
model
pb_model_converters
)

addtest(query_responses_test converters/pb_query_responses_test.cpp)
target_link_libraries(query_responses_test
model
pb_model_converters
)

addtest(model_operators_test operators/model_operators_test.cpp)
Expand All @@ -59,22 +59,29 @@ target_link_libraries(command_validate_execute_test

addtest(json_command_converter_test converters/json_commands_test.cpp)
target_link_libraries(json_command_converter_test
model
json_model_converters
)

addtest(json_transaction_converter_test converters/json_transaction_test.cpp)
target_link_libraries(json_transaction_converter_test
model
json_model_converters
)

addtest(json_block_converter_test converters/json_block_test.cpp)
target_link_libraries(json_block_converter_test
model
json_model_converters
)

addtest(json_query_factory_test converters/json_query_factory_test.cpp)
target_link_libraries(json_query_factory_test
model_converters
model_generators
json_model_converters
)

addtest(pb_query_factory_test converters/pb_query_factory_test.cpp)
target_link_libraries(pb_query_factory_test
model_generators
pb_model_converters
)

addtest(static_map static_map.cpp)
Expand All @@ -83,9 +90,3 @@ target_link_libraries(static_map
logger
)

addtest(pb_query_factory_test converters/pb_query_factory_test.cpp)
target_link_libraries(pb_query_factory_test
model
model_generators
)

0 comments on commit 2c91f80

Please sign in to comment.