Skip to content

Commit

Permalink
Add FIND_PROTOBUF and FIND_GRPC option for system library search
Browse files Browse the repository at this point in the history
  • Loading branch information
lebdron committed Sep 20, 2017
1 parent ad3a481 commit 2fd1bca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
ccache --max-size=1G
- run:
name: cmake
command: cmake -DCOVERAGE=ON -H$IROHA_HOME -B$IROHA_BUILD
command: cmake -DCOVERAGE=ON -DFIND_PROTOBUF=ON -DFIND_GRPC=ON -H$IROHA_HOME -B$IROHA_BUILD
- run:
name: make
command: cmake --build $IROHA_BUILD -- -j2
Expand Down
22 changes: 12 additions & 10 deletions cmake/Modules/Findgrpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ add_library(grpc++ UNKNOWN IMPORTED)
add_library(grpc++_reflection UNKNOWN IMPORTED)
add_executable(grpc_cpp_plugin IMPORTED)

find_path(grpc_INCLUDE_DIR grpc/grpc.h)
mark_as_advanced(grpc_INCLUDE_DIR)
if (FIND_GRPC)
find_path(grpc_INCLUDE_DIR grpc/grpc.h)
mark_as_advanced(grpc_INCLUDE_DIR)

find_library(grpc_LIBRARY grpc)
mark_as_advanced(grpc_LIBRARY)
find_library(grpc_LIBRARY grpc)
mark_as_advanced(grpc_LIBRARY)

find_library(grpc_grpc++_LIBRARY grpc++)
mark_as_advanced(grpc_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(grpc_grpc++_reflection_LIBRARY grpc++_reflection)
mark_as_advanced(grpc_grpc++_reflection_LIBRARY)

find_program(grpc_CPP_PLUGIN grpc_cpp_plugin)
mark_as_advanced(grpc_CPP_PLUGIN)
find_program(grpc_CPP_PLUGIN grpc_cpp_plugin)
mark_as_advanced(grpc_CPP_PLUGIN)
endif()

find_package(PackageHandleStandardArgs REQUIRED)
find_package_handle_standard_args(grpc DEFAULT_MSG
Expand Down
14 changes: 8 additions & 6 deletions cmake/Modules/Findprotobuf.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
add_library(protobuf UNKNOWN IMPORTED)
add_executable(protoc IMPORTED)

find_path(protobuf_INCLUDE_DIR google/protobuf/service.h)
mark_as_advanced(protobuf_INCLUDE_DIR)
if (FIND_PROTOBUF)
find_path(protobuf_INCLUDE_DIR google/protobuf/service.h)
mark_as_advanced(protobuf_INCLUDE_DIR)

find_library(protobuf_LIBRARY protobuf)
mark_as_advanced(protobuf_LIBRARY)
find_library(protobuf_LIBRARY protobuf)
mark_as_advanced(protobuf_LIBRARY)

find_program(protoc_EXECUTABLE protoc)
mark_as_advanced(protoc_EXECUTABLE)
find_program(protoc_EXECUTABLE protoc)
mark_as_advanced(protoc_EXECUTABLE)
endif()

find_package(PackageHandleStandardArgs REQUIRED)
find_package_handle_standard_args(protobuf DEFAULT_MSG
Expand Down
2 changes: 2 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ find_package(spdlog)
################################
# protobuf #
################################
option(FIND_PROTOBUF "Try to find protobuf in system" OFF)
find_package(protobuf)

#########################
# gRPC #
#########################
option(FIND_GRPC "Try to find gRPC in system" OFF)
find_package(grpc)

################################
Expand Down

0 comments on commit 2fd1bca

Please sign in to comment.