feat: update protos to 2020-02-25 version (#37)
Update the dependencies based on the new protos.
This commit is contained in:
parent
3e4f8c025e
commit
c1713cb00d
6 changed files with 306 additions and 365 deletions
307
CMakeLists.txt
307
CMakeLists.txt
|
@ -24,12 +24,13 @@ set(GOOGLEAPIS_CPP_PROTOS_VERSION_MAJOR 0)
|
|||
set(GOOGLEAPIS_CPP_PROTOS_VERSION_MINOR 5)
|
||||
set(GOOGLEAPIS_CPP_PROTOS_VERSION_PATCH 0)
|
||||
|
||||
string(CONCAT GOOGLE_APIS_CPP_PROTOS_VERSION
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_MAJOR}"
|
||||
"."
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_MINOR}"
|
||||
"."
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_PATCH}")
|
||||
string(
|
||||
CONCAT GOOGLE_APIS_CPP_PROTOS_VERSION
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_MAJOR}"
|
||||
"."
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_MINOR}"
|
||||
"."
|
||||
"${GOOGLEAPIS_CPP_PROTOS_VERSION_PATCH}")
|
||||
|
||||
# Configure the compiler options, we will be using C++11 features.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
@ -37,12 +38,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
|
||||
# Give application developers a hook to configure the version and hash
|
||||
# downloaded from GitHub.
|
||||
set(
|
||||
GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL
|
||||
"https://github.com/googleapis/googleapis/archive/19c4589a3cb44b3679f7b3fba88365b3d055d5f8.tar.gz"
|
||||
)
|
||||
set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL
|
||||
"https://github.com/googleapis/googleapis/archive/0b1876b35e98f560f9c9ca9797955f020238a092.tar.gz"
|
||||
)
|
||||
set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256
|
||||
"ef455e46cfb967962aef30248f1a2a69bc78b041e89b04644e24e7844f0215c4")
|
||||
"4b0db7279ddf0b9ec6a39fd741ef4694b20025fe38f7d98f1ab1ba224c417c2d")
|
||||
|
||||
set(GOOGLEAPIS_CPP_SOURCE
|
||||
"${CMAKE_BINARY_DIR}/external/googleapis/src/googleapis_download")
|
||||
|
@ -104,16 +104,17 @@ foreach (proto ${GOOGLEAPIS_CPP_PROTO_FILES})
|
|||
endforeach ()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googleapis_download
|
||||
EXCLUDE_FROM_ALL ON
|
||||
PREFIX "${CMAKE_BINARY_DIR}/external/googleapis"
|
||||
URL ${GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL}
|
||||
URL_HASH SHA256=${GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS ${GOOGLEAPIS_CPP_BYPRODUCTS}
|
||||
LOG_DOWNLOAD OFF)
|
||||
ExternalProject_Add(
|
||||
googleapis_download
|
||||
EXCLUDE_FROM_ALL ON
|
||||
PREFIX "${CMAKE_BINARY_DIR}/external/googleapis"
|
||||
URL ${GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL}
|
||||
URL_HASH SHA256=${GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS ${GOOGLEAPIS_CPP_BYPRODUCTS}
|
||||
LOG_DOWNLOAD OFF)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
find_package(ProtobufTargets REQUIRED)
|
||||
|
@ -137,19 +138,12 @@ include(CompileProtos)
|
|||
google_cloud_cpp_add_protos_property()
|
||||
|
||||
function (googleapis_cpp_short_name var proto)
|
||||
string(REPLACE "google/"
|
||||
""
|
||||
short_name
|
||||
"${proto}")
|
||||
string(REPLACE "/"
|
||||
"_"
|
||||
short_name
|
||||
"${short_name}")
|
||||
string(REPLACE ".proto"
|
||||
"_protos"
|
||||
short_name
|
||||
"${short_name}")
|
||||
set("${var}" "${short_name}" PARENT_SCOPE)
|
||||
string(REPLACE "google/" "" short_name "${proto}")
|
||||
string(REPLACE "/" "_" short_name "${short_name}")
|
||||
string(REPLACE ".proto" "_protos" short_name "${short_name}")
|
||||
set("${var}"
|
||||
"${short_name}"
|
||||
PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Create a single source proto library.
|
||||
|
@ -158,11 +152,10 @@ endfunction ()
|
|||
# * (optional) ARGN: proto libraries the new library depends on.
|
||||
function (googleapis_cpp_add_library proto)
|
||||
googleapis_cpp_short_name(short_name "${proto}")
|
||||
google_cloud_cpp_grpcpp_library(googleapis_cpp_${short_name}
|
||||
"${GOOGLEAPIS_CPP_SOURCE}/${proto}"
|
||||
PROTO_PATH_DIRECTORIES
|
||||
"${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
google_cloud_cpp_grpcpp_library(
|
||||
googleapis_cpp_${short_name} "${GOOGLEAPIS_CPP_SOURCE}/${proto}"
|
||||
PROTO_PATH_DIRECTORIES "${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
|
||||
googleapis_cpp_set_version_and_alias("${short_name}")
|
||||
|
||||
|
@ -175,34 +168,34 @@ function (googleapis_cpp_add_library proto)
|
|||
target_link_libraries("googleapis_cpp_${short_name}"
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
else ()
|
||||
target_link_libraries("googleapis_cpp_${short_name}"
|
||||
PUBLIC ${public_deps}
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
target_link_libraries(
|
||||
"googleapis_cpp_${short_name}"
|
||||
PUBLIC ${public_deps}
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
function (googleapis_cpp_set_version_and_alias short_name)
|
||||
add_dependencies("googleapis_cpp_${short_name}" googleapis_download)
|
||||
set_target_properties("googleapis_cpp_${short_name}"
|
||||
PROPERTIES VERSION
|
||||
"${GOOGLE_APIS_CPP_PROTOS_VERSION}"
|
||||
SOVERSION
|
||||
${GOOGLEAPIS_CPP_PROTOS_VERSION_MAJOR})
|
||||
set_target_properties(
|
||||
"googleapis_cpp_${short_name}"
|
||||
PROPERTIES VERSION "${GOOGLE_APIS_CPP_PROTOS_VERSION}"
|
||||
SOVERSION ${GOOGLEAPIS_CPP_PROTOS_VERSION_MAJOR})
|
||||
add_library("googleapis-c++::${short_name}" ALIAS
|
||||
"googleapis_cpp_${short_name}")
|
||||
endfunction ()
|
||||
|
||||
googleapis_cpp_add_library("google/api/http.proto")
|
||||
googleapis_cpp_add_library("google/api/metric.proto" api_launch_stage_protos
|
||||
api_label_protos)
|
||||
googleapis_cpp_add_library("google/api/monitored_resource.proto"
|
||||
api_launch_stage_protos api_label_protos)
|
||||
googleapis_cpp_add_library("google/api/annotations.proto" api_http_protos)
|
||||
googleapis_cpp_add_library("google/api/auth.proto" api_annotations_protos)
|
||||
googleapis_cpp_add_library("google/api/client.proto")
|
||||
googleapis_cpp_add_library("google/api/field_behavior.proto")
|
||||
googleapis_cpp_add_library("google/api/label.proto")
|
||||
googleapis_cpp_add_library("google/api/launch_stage.proto")
|
||||
googleapis_cpp_add_library("google/api/metric.proto" api_launch_stage_protos
|
||||
api_label_protos)
|
||||
googleapis_cpp_add_library("google/api/monitored_resource.proto"
|
||||
api_launch_stage_protos api_label_protos)
|
||||
googleapis_cpp_add_library("google/api/resource.proto")
|
||||
|
||||
googleapis_cpp_add_library("google/type/expr.proto")
|
||||
|
@ -211,31 +204,29 @@ googleapis_cpp_add_library("google/rpc/error_details.proto")
|
|||
googleapis_cpp_add_library("google/rpc/status.proto" rpc_error_details_protos)
|
||||
|
||||
googleapis_cpp_add_library("google/iam/v1/options.proto" api_annotations_protos)
|
||||
googleapis_cpp_add_library("google/iam/v1/policy.proto"
|
||||
api_annotations_protos
|
||||
api_resource_protos
|
||||
googleapis_cpp_add_library("google/iam/v1/policy.proto" api_annotations_protos
|
||||
type_expr_protos)
|
||||
|
||||
googleapis_cpp_add_library("google/iam/v1/iam_policy.proto"
|
||||
api_annotations_protos
|
||||
api_client_protos
|
||||
api_field_behavior_protos
|
||||
iam_v1_options_protos
|
||||
iam_v1_policy_protos)
|
||||
googleapis_cpp_add_library(
|
||||
"google/iam/v1/iam_policy.proto"
|
||||
api_annotations_protos
|
||||
api_client_protos
|
||||
api_field_behavior_protos
|
||||
api_resource_protos
|
||||
iam_v1_options_protos
|
||||
iam_v1_policy_protos)
|
||||
|
||||
googleapis_cpp_add_library("google/longrunning/operations.proto"
|
||||
api_annotations_protos rpc_status_protos)
|
||||
googleapis_cpp_add_library(
|
||||
"google/longrunning/operations.proto" api_annotations_protos
|
||||
api_client_protos rpc_status_protos)
|
||||
|
||||
googleapis_cpp_add_library("google/devtools/cloudtrace/v2/trace.proto"
|
||||
api_annotations_protos
|
||||
api_client_protos
|
||||
api_field_behavior_protos
|
||||
api_resource_protos
|
||||
rpc_status_protos)
|
||||
googleapis_cpp_add_library("google/devtools/cloudtrace/v2/tracing.proto"
|
||||
devtools_cloudtrace_v2_trace_protos
|
||||
api_annotations_protos
|
||||
rpc_status_protos)
|
||||
googleapis_cpp_add_library(
|
||||
"google/devtools/cloudtrace/v2/trace.proto" api_annotations_protos
|
||||
api_field_behavior_protos api_resource_protos rpc_status_protos)
|
||||
googleapis_cpp_add_library(
|
||||
"google/devtools/cloudtrace/v2/tracing.proto"
|
||||
devtools_cloudtrace_v2_trace_protos api_annotations_protos
|
||||
api_client_protos api_field_behavior_protos rpc_status_protos)
|
||||
|
||||
google_cloud_cpp_grpcpp_library(
|
||||
googleapis_cpp_cloud_bigquery_protos
|
||||
|
@ -256,14 +247,17 @@ google_cloud_cpp_grpcpp_library(
|
|||
"${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
googleapis_cpp_set_version_and_alias(cloud_bigquery_protos)
|
||||
target_link_libraries(googleapis_cpp_cloud_bigquery_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_http_protos
|
||||
googleapis-c++::api_field_behavior_protos
|
||||
googleapis-c++::api_client_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
target_link_libraries(
|
||||
googleapis_cpp_cloud_bigquery_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_client_protos
|
||||
googleapis-c++::api_field_behavior_protos
|
||||
googleapis-c++::api_resource_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
googleapis-c++::iam_v1_policy_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
googleapis-c++::api_http_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
|
||||
google_cloud_cpp_grpcpp_library(
|
||||
googleapis_cpp_bigtable_protos
|
||||
|
@ -278,25 +272,31 @@ google_cloud_cpp_grpcpp_library(
|
|||
"${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
googleapis_cpp_set_version_and_alias(bigtable_protos)
|
||||
target_link_libraries(googleapis_cpp_bigtable_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_auth_protos
|
||||
googleapis-c++::longrunning_operations_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
target_link_libraries(
|
||||
googleapis_cpp_bigtable_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_client_protos
|
||||
googleapis-c++::api_field_behavior_protos
|
||||
googleapis-c++::api_resource_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
googleapis-c++::iam_v1_policy_protos
|
||||
googleapis-c++::longrunning_operations_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
googleapis-c++::api_auth_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
|
||||
google_cloud_cpp_grpcpp_library(
|
||||
googleapis_cpp_pubsub_protos
|
||||
"${GOOGLEAPIS_CPP_SOURCE}/google/pubsub/v1/pubsub.proto"
|
||||
PROTO_PATH_DIRECTORIES
|
||||
"${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
PROTO_PATH_DIRECTORIES "${GOOGLEAPIS_CPP_SOURCE}" "${PROTO_INCLUDE_DIR}")
|
||||
googleapis_cpp_set_version_and_alias(pubsub_protos)
|
||||
target_link_libraries(googleapis_cpp_pubsub_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_client_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
target_link_libraries(
|
||||
googleapis_cpp_pubsub_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_client_protos
|
||||
googleapis-c++::api_field_behavior_protos
|
||||
googleapis-c++::api_resource_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
|
||||
google_cloud_cpp_grpcpp_library(
|
||||
googleapis_cpp_spanner_protos
|
||||
|
@ -313,12 +313,17 @@ google_cloud_cpp_grpcpp_library(
|
|||
"${GOOGLEAPIS_CPP_SOURCE}"
|
||||
"${PROTO_INCLUDE_DIR}")
|
||||
googleapis_cpp_set_version_and_alias(spanner_protos)
|
||||
target_link_libraries(googleapis_cpp_spanner_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::longrunning_operations_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
target_link_libraries(
|
||||
googleapis_cpp_spanner_protos
|
||||
PUBLIC googleapis-c++::api_annotations_protos
|
||||
googleapis-c++::api_client_protos
|
||||
googleapis-c++::api_field_behavior_protos
|
||||
googleapis-c++::api_resource_protos
|
||||
googleapis-c++::iam_v1_iam_policy_protos
|
||||
googleapis-c++::iam_v1_policy_protos
|
||||
googleapis-c++::longrunning_operations_protos
|
||||
googleapis-c++::rpc_status_protos
|
||||
PRIVATE googleapis_cpp_common_flags)
|
||||
|
||||
# Install the libraries and headers in the locations determined by
|
||||
# GNUInstallDirs
|
||||
|
@ -345,12 +350,13 @@ set(googleapis_cpp_installed_libraries_list
|
|||
googleapis_cpp_rpc_status_protos
|
||||
googleapis_cpp_type_expr_protos)
|
||||
|
||||
install(TARGETS ${googleapis_cpp_installed_libraries_list}
|
||||
googleapis_cpp_common_flags
|
||||
EXPORT googleapis-targets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(
|
||||
TARGETS ${googleapis_cpp_installed_libraries_list}
|
||||
googleapis_cpp_common_flags
|
||||
EXPORT googleapis-targets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
foreach (target ${googleapis_cpp_installed_libraries_list})
|
||||
google_cloud_cpp_install_proto_library_headers("${target}")
|
||||
|
@ -372,14 +378,8 @@ set(GOOGLE_CLOUD_CPP_CONFIG_VERSION_PATCH
|
|||
|
||||
# Use a function to create a scope for the variables.
|
||||
function (googleapis_cpp_install_pc target)
|
||||
string(REPLACE "googleapis_cpp_"
|
||||
""
|
||||
_short_name
|
||||
${target})
|
||||
string(REPLACE "_protos"
|
||||
""
|
||||
_short_name
|
||||
${_short_name})
|
||||
string(REPLACE "googleapis_cpp_" "" _short_name ${target})
|
||||
string(REPLACE "_protos" "" _short_name ${_short_name})
|
||||
set(GOOGLE_CLOUD_CPP_PC_NAME
|
||||
"The Google APIS C++ ${_short_name} Proto Library")
|
||||
set(GOOGLE_CLOUD_CPP_PC_DESCRIPTION "Compiled proto for C++.")
|
||||
|
@ -389,21 +389,20 @@ function (googleapis_cpp_install_pc target)
|
|||
get_target_property(_target_deps ${target} LINK_LIBRARIES)
|
||||
foreach (dep ${_target_deps})
|
||||
if ("${dep}" MATCHES "^googleapis-c\\+\\+::")
|
||||
string(REPLACE "googleapis-c++::"
|
||||
"googleapis_cpp_"
|
||||
dep
|
||||
"${dep}")
|
||||
string(REPLACE "googleapis-c++::" "googleapis_cpp_" dep "${dep}")
|
||||
list(APPEND _target_pc_requires " " "${dep}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
# These dependencies are required for all the googleapis-c++::* libraries.
|
||||
list(APPEND _target_pc_requires
|
||||
" grpc++"
|
||||
" grpc"
|
||||
" openssl"
|
||||
" protobuf"
|
||||
" zlib"
|
||||
" libcares")
|
||||
list(
|
||||
APPEND
|
||||
_target_pc_requires
|
||||
" grpc++"
|
||||
" grpc"
|
||||
" openssl"
|
||||
" protobuf"
|
||||
" zlib"
|
||||
" libcares")
|
||||
string(CONCAT GOOGLE_CLOUD_CPP_PC_REQUIRES ${_target_pc_requires})
|
||||
set(GOOGLE_CLOUD_CPP_PC_LIBS "-l${target}")
|
||||
configure_file("cmake/config.pc.in" "${target}.pc" @ONLY)
|
||||
|
@ -422,26 +421,27 @@ set(GOOGLE_CLOUD_CPP_PC_DESCRIPTION
|
|||
"Provides C++ APIs to access Google Cloud Platforms.")
|
||||
# Note the use of spaces, `string(JOIN)` is not available in cmake-3.5, so we
|
||||
# need to add the separator ourselves.
|
||||
string(CONCAT GOOGLE_CLOUD_CPP_PC_REQUIRES
|
||||
"googleapis_cpp_bigtable_protos"
|
||||
" googleapis_cpp_cloud_bigquery_protos"
|
||||
" googleapis_cpp_iam_v1_iam_policy_protos"
|
||||
" googleapis_cpp_iam_v1_options_protos"
|
||||
" googleapis_cpp_iam_v1_policy_protos"
|
||||
" googleapis_cpp_longrunning_operations_protos"
|
||||
" googleapis_cpp_api_auth_protos"
|
||||
" googleapis_cpp_api_annotations_protos"
|
||||
" googleapis_cpp_api_client_protos"
|
||||
" googleapis_cpp_api_field_behavior_protos"
|
||||
" googleapis_cpp_api_http_protos"
|
||||
" googleapis_cpp_rpc_status_protos"
|
||||
" googleapis_cpp_rpc_error_details_protos"
|
||||
" grpc++"
|
||||
" grpc"
|
||||
" openssl"
|
||||
" protobuf"
|
||||
" zlib"
|
||||
" libcares")
|
||||
string(
|
||||
CONCAT GOOGLE_CLOUD_CPP_PC_REQUIRES
|
||||
"googleapis_cpp_bigtable_protos"
|
||||
" googleapis_cpp_cloud_bigquery_protos"
|
||||
" googleapis_cpp_iam_v1_iam_policy_protos"
|
||||
" googleapis_cpp_iam_v1_options_protos"
|
||||
" googleapis_cpp_iam_v1_policy_protos"
|
||||
" googleapis_cpp_longrunning_operations_protos"
|
||||
" googleapis_cpp_api_auth_protos"
|
||||
" googleapis_cpp_api_annotations_protos"
|
||||
" googleapis_cpp_api_client_protos"
|
||||
" googleapis_cpp_api_field_behavior_protos"
|
||||
" googleapis_cpp_api_http_protos"
|
||||
" googleapis_cpp_rpc_status_protos"
|
||||
" googleapis_cpp_rpc_error_details_protos"
|
||||
" grpc++"
|
||||
" grpc"
|
||||
" openssl"
|
||||
" protobuf"
|
||||
" zlib"
|
||||
" libcares")
|
||||
set(GOOGLE_CLOUD_CPP_PC_LIBS "")
|
||||
configure_file("cmake/config.pc.in" "googleapis.pc" @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/googleapis.pc"
|
||||
|
@ -449,11 +449,12 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/googleapis.pc"
|
|||
|
||||
# Create and install the CMake configuration files.
|
||||
configure_file("cmake/config.cmake.in" "googleapis-config.cmake" @ONLY)
|
||||
configure_file("cmake/config-version.cmake.in" "googleapis-config-version.cmake"
|
||||
@ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/googleapis-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/googleapis-config-version.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/FindgRPC.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/FindProtobufTargets.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/CompileProtos.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/googleapis")
|
||||
configure_file("cmake/config-version.cmake.in"
|
||||
"googleapis-config-version.cmake" @ONLY)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/googleapis-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/googleapis-config-version.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/FindgRPC.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/FindProtobufTargets.cmake"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/CompileProtos.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/googleapis")
|
||||
|
|
|
@ -35,4 +35,4 @@ RUN chmod 755 /usr/bin/buildifier
|
|||
# "latest" version is updated, and we do not want the builds to break just
|
||||
# because some third party changed something.
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install numpy cmake_format==0.5.2
|
||||
RUN pip install numpy cmake_format==0.6.9
|
||||
|
|
|
@ -19,12 +19,11 @@
|
|||
# We use a function to define the property so it can be called multiple times
|
||||
# without introducing the property over and over.
|
||||
function (google_cloud_cpp_add_protos_property)
|
||||
set_property(TARGET
|
||||
PROPERTY PROTO_SOURCES
|
||||
BRIEF_DOCS
|
||||
"The list of .proto files for a target."
|
||||
FULL_DOCS
|
||||
"List of .proto files specified for a target.")
|
||||
set_property(
|
||||
TARGET
|
||||
PROPERTY PROTO_SOURCES BRIEF_DOCS
|
||||
"The list of .proto files for a target." FULL_DOCS
|
||||
"List of .proto files specified for a target.")
|
||||
endfunction ()
|
||||
|
||||
# Generate C++ for .proto files preserving the directory hierarchy
|
||||
|
@ -54,11 +53,7 @@ endfunction ()
|
|||
# `foo/bar/baz.proto` then the directory containing `foo` must be in the search
|
||||
# path.
|
||||
function (google_cloud_cpp_generate_proto SRCS)
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_generate_proto() called"
|
||||
" without any proto files")
|
||||
|
@ -71,7 +66,7 @@ function (google_cloud_cpp_generate_proto SRCS)
|
|||
foreach (dir ${_opt_PROTO_PATH_DIRECTORIES})
|
||||
get_filename_component(absolute_path ${dir} ABSOLUTE)
|
||||
list(FIND protobuf_include_path "${absolute_path}"
|
||||
already_in_search_path)
|
||||
already_in_search_path)
|
||||
if (${already_in_search_path} EQUAL -1)
|
||||
list(APPEND protobuf_include_path "--proto_path" "${absolute_path}")
|
||||
endif ()
|
||||
|
@ -89,11 +84,7 @@ function (google_cloud_cpp_generate_proto SRCS)
|
|||
set(D "${file_directory}")
|
||||
if (DEFINED _opt_PROTO_PATH_DIRECTORIES)
|
||||
foreach (P ${_opt_PROTO_PATH_DIRECTORIES})
|
||||
string(REGEX
|
||||
REPLACE "^${P}"
|
||||
""
|
||||
T
|
||||
"${D}")
|
||||
string(REGEX REPLACE "^${P}" "" T "${D}")
|
||||
set(D ${T})
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
@ -102,22 +93,19 @@ function (google_cloud_cpp_generate_proto SRCS)
|
|||
list(APPEND ${SRCS} "${pb_cc}" "${pb_h}")
|
||||
add_custom_command(
|
||||
OUTPUT "${pb_cc}" "${pb_h}"
|
||||
COMMAND $<TARGET_FILE:protobuf::protoc>
|
||||
ARGS
|
||||
--cpp_out
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path}
|
||||
"${filename}"
|
||||
COMMAND
|
||||
$<TARGET_FILE:protobuf::protoc> ARGS --cpp_out
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" ${protobuf_include_path}
|
||||
"${filename}"
|
||||
DEPENDS "${filename}" protobuf::protoc
|
||||
COMMENT "Running C++ protocol buffer compiler on ${filename}"
|
||||
VERBATIM)
|
||||
endforeach ()
|
||||
|
||||
set_source_files_properties(${${SRCS}}
|
||||
PROPERTIES
|
||||
GENERATED
|
||||
TRUE)
|
||||
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||
set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
|
||||
set(${SRCS}
|
||||
${${SRCS}}
|
||||
PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Generate gRPC C++ files from .proto files preserving the directory hierarchy.
|
||||
|
@ -147,11 +135,7 @@ endfunction ()
|
|||
# `foo/bar/baz.proto` then the directory containing `foo` must be in the search
|
||||
# path.
|
||||
function (google_cloud_cpp_generate_grpcpp SRCS)
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(
|
||||
SEND_ERROR "Error: google_cloud_cpp_generate_grpc() called without"
|
||||
|
@ -165,7 +149,7 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
|
|||
foreach (dir ${_opt_PROTO_PATH_DIRECTORIES})
|
||||
get_filename_component(absolute_path ${dir} ABSOLUTE)
|
||||
list(FIND protobuf_include_path "${absolute_path}"
|
||||
already_in_search_path)
|
||||
already_in_search_path)
|
||||
if (${already_in_search_path} EQUAL -1)
|
||||
list(APPEND protobuf_include_path "--proto_path" "${absolute_path}")
|
||||
endif ()
|
||||
|
@ -183,11 +167,7 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
|
|||
set(D "${file_directory}")
|
||||
if (DEFINED _opt_PROTO_PATH_DIRECTORIES)
|
||||
foreach (P ${_opt_PROTO_PATH_DIRECTORIES})
|
||||
string(REGEX
|
||||
REPLACE "^${P}"
|
||||
""
|
||||
T
|
||||
"${D}")
|
||||
string(REGEX REPLACE "^${P}" "" T "${D}")
|
||||
set(D ${T})
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
@ -198,23 +178,20 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
|
|||
add_custom_command(
|
||||
OUTPUT "${grpc_pb_cc}" "${grpc_pb_h}"
|
||||
COMMAND
|
||||
$<TARGET_FILE:protobuf::protoc>
|
||||
ARGS
|
||||
$<TARGET_FILE:protobuf::protoc> ARGS
|
||||
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path}
|
||||
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" ${protobuf_include_path}
|
||||
"${filename}"
|
||||
DEPENDS "${filename}" protobuf::protoc gRPC::grpc_cpp_plugin
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${filename}"
|
||||
VERBATIM)
|
||||
endforeach ()
|
||||
|
||||
set_source_files_properties(${${SRCS}}
|
||||
PROPERTIES
|
||||
GENERATED
|
||||
TRUE)
|
||||
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||
set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
|
||||
set(${SRCS}
|
||||
${${SRCS}}
|
||||
PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
@ -227,10 +204,7 @@ function (google_cloud_cpp_install_proto_library_headers target)
|
|||
if (NOT "${header}" MATCHES "\\.h$")
|
||||
continue()
|
||||
endif ()
|
||||
string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/"
|
||||
""
|
||||
relative
|
||||
"${header}")
|
||||
string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" relative "${header}")
|
||||
get_filename_component(dir "${relative}" DIRECTORY)
|
||||
install(FILES "${header}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
|
||||
|
@ -245,10 +219,7 @@ function (google_cloud_cpp_install_proto_library_protos target strip_prefix)
|
|||
if (NOT "${proto}" MATCHES "\\.proto$")
|
||||
continue()
|
||||
endif ()
|
||||
string(REPLACE "${strip_prefix}/"
|
||||
""
|
||||
relative
|
||||
"${proto}")
|
||||
string(REPLACE "${strip_prefix}/" "" relative "${proto}")
|
||||
get_filename_component(dir "${relative}" DIRECTORY)
|
||||
# This is modeled after the Protobuf library, it installs the basic
|
||||
# protos (think google/protobuf/any.proto) in the include directory for
|
||||
|
@ -259,27 +230,22 @@ function (google_cloud_cpp_install_proto_library_protos target strip_prefix)
|
|||
endfunction ()
|
||||
|
||||
function (google_cloud_cpp_proto_library libname)
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_proto_library() called"
|
||||
" without any proto files")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
google_cloud_cpp_generate_proto(proto_sources
|
||||
${_opt_UNPARSED_ARGUMENTS}
|
||||
PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
google_cloud_cpp_generate_proto(
|
||||
proto_sources ${_opt_UNPARSED_ARGUMENTS} PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
|
||||
add_library(${libname} ${proto_sources})
|
||||
set_property(TARGET ${libname}
|
||||
PROPERTY PROTO_SOURCES ${_opt_UNPARSED_ARGUMENTS})
|
||||
target_link_libraries(${libname}
|
||||
PUBLIC gRPC::grpc++ gRPC::grpc protobuf::libprotobuf)
|
||||
set_property(TARGET ${libname} PROPERTY PROTO_SOURCES
|
||||
${_opt_UNPARSED_ARGUMENTS})
|
||||
target_link_libraries(${libname} PUBLIC gRPC::grpc++ gRPC::grpc
|
||||
protobuf::libprotobuf)
|
||||
target_include_directories(
|
||||
${libname}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
|
@ -288,24 +254,18 @@ function (google_cloud_cpp_proto_library libname)
|
|||
endfunction ()
|
||||
|
||||
function (google_cloud_cpp_grpcpp_library libname)
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_proto_library() called"
|
||||
" without any proto files")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
google_cloud_cpp_generate_grpcpp(grpcpp_sources
|
||||
${_opt_UNPARSED_ARGUMENTS}
|
||||
PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
google_cloud_cpp_proto_library(${libname}
|
||||
${_opt_UNPARSED_ARGUMENTS}
|
||||
PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
google_cloud_cpp_generate_grpcpp(
|
||||
grpcpp_sources ${_opt_UNPARSED_ARGUMENTS} PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
google_cloud_cpp_proto_library(
|
||||
${libname} ${_opt_UNPARSED_ARGUMENTS} PROTO_PATH_DIRECTORIES
|
||||
${_opt_PROTO_PATH_DIRECTORIES})
|
||||
target_sources(${libname} PRIVATE ${grpcpp_sources})
|
||||
endfunction ()
|
||||
|
|
|
@ -107,35 +107,35 @@ else ()
|
|||
|
||||
if (NOT TARGET protobuf::libprotobuf)
|
||||
add_library(protobuf::libprotobuf IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotobuf
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
set_property(TARGET protobuf::libprotobuf
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_LIBRARY}
|
||||
Threads::Threads)
|
||||
set_property(
|
||||
TARGET protobuf::libprotobuf
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Protobuf_INCLUDE_DIR})
|
||||
set_property(
|
||||
TARGET protobuf::libprotobuf APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_LIBRARY}
|
||||
Threads::Threads)
|
||||
endif ()
|
||||
|
||||
if (NOT TARGET protobuf::libprotobuf-lite)
|
||||
add_library(protobuf::libprotobuf-lite IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotobuf-lite
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
set_property(TARGET protobuf::libprotobuf-lite
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
${Protobuf_LITE_LIBRARY} Threads::Threads)
|
||||
set_property(
|
||||
TARGET protobuf::libprotobuf-lite
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Protobuf_INCLUDE_DIR})
|
||||
set_property(
|
||||
TARGET protobuf::libprotobuf-lite APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_LITE_LIBRARY}
|
||||
Threads::Threads)
|
||||
endif ()
|
||||
|
||||
if (NOT TARGET protobuf::libprotoc)
|
||||
add_library(protobuf::libprotoc IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotoc
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
set_property(TARGET protobuf::libprotoc
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
${Protobuf_PROTOC_LIBRARY} Threads::Threads)
|
||||
set_property(
|
||||
TARGET protobuf::libprotoc
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Protobuf_INCLUDE_DIR})
|
||||
set_property(
|
||||
TARGET protobuf::libprotoc APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_PROTOC_LIBRARY}
|
||||
Threads::Threads)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
@ -152,9 +152,10 @@ if (ProtobufTargets_FOUND AND NOT TARGET protobuf::protoc)
|
|||
add_executable(protobuf::protoc IMPORTED)
|
||||
|
||||
# Discover the protoc compiler location.
|
||||
find_program(_protobuf_PROTOC_EXECUTABLE
|
||||
NAMES protoc
|
||||
DOC "The Google Protocol Buffers Compiler")
|
||||
find_program(
|
||||
_protobuf_PROTOC_EXECUTABLE
|
||||
NAMES protoc
|
||||
DOC "The Google Protocol Buffers Compiler")
|
||||
if (protobuf_DEBUG)
|
||||
message(
|
||||
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
|
@ -165,11 +166,11 @@ if (ProtobufTargets_FOUND AND NOT TARGET protobuf::protoc)
|
|||
set_property(TARGET protobuf::protoc
|
||||
PROPERTY IMPORTED_LOCATION ${_protobuf_PROTOC_EXECUTABLE})
|
||||
set_property(
|
||||
TARGET protobuf::protoc
|
||||
PROPERTY IMPORTED_LOCATION_DEBUG ${_protobuf_PROTOC_EXECUTABLE})
|
||||
set_property(TARGET protobuf::protoc
|
||||
PROPERTY IMPORTED_LOCATION_RELEASE
|
||||
${_protobuf_PROTOC_EXECUTABLE})
|
||||
TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION_DEBUG
|
||||
${_protobuf_PROTOC_EXECUTABLE})
|
||||
set_property(
|
||||
TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION_RELEASE
|
||||
${_protobuf_PROTOC_EXECUTABLE})
|
||||
unset(_protobuf_PROTOC_EXECUTABLE)
|
||||
|
||||
if (protobuf_DEBUG)
|
||||
|
@ -186,10 +187,8 @@ if (protobuf_DEBUG)
|
|||
"ProtobufTargets_FOUND = ${ProtobufTargets_FOUND}"
|
||||
" ProtobufTargets_VERSION = ${ProtobufTargets_VERSION}")
|
||||
if (ProtobufTargets_FOUND)
|
||||
foreach (_target
|
||||
protobuf::libprotobuf
|
||||
protobuf::libprotobuf-lite
|
||||
protobuf::libprotoc)
|
||||
foreach (_target protobuf::libprotobuf protobuf::libprotobuf-lite
|
||||
protobuf::libprotoc)
|
||||
if (NOT TARGET ${_target})
|
||||
message(
|
||||
STATUS
|
||||
|
@ -201,7 +200,5 @@ if (protobuf_DEBUG)
|
|||
endif ()
|
||||
endif ()
|
||||
|
||||
find_package_handle_standard_args(ProtobufTargets
|
||||
REQUIRED_VARS
|
||||
ProtobufTargets_FOUND
|
||||
ProtobufTargets_VERSION)
|
||||
find_package_handle_standard_args(ProtobufTargets REQUIRED_VARS
|
||||
ProtobufTargets_FOUND ProtobufTargets_VERSION)
|
||||
|
|
|
@ -92,9 +92,9 @@ function (_grpc_fix_grpc_cpp_plugin_target)
|
|||
DOC "The gRPC C++ plugin for protoc")
|
||||
mark_as_advanced(_gRPC_CPP_PLUGIN_EXECUTABLE)
|
||||
if (_gRPC_CPP_PLUGIN_EXECUTABLE)
|
||||
set_property(TARGET gRPC::grpc_cpp_plugin
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
${_gRPC_CPP_PLUGIN_EXECUTABLE})
|
||||
set_property(
|
||||
TARGET gRPC::grpc_cpp_plugin
|
||||
PROPERTY IMPORTED_LOCATION ${_gRPC_CPP_PLUGIN_EXECUTABLE})
|
||||
else ()
|
||||
set(gRPC_FOUND "grpc_cpp_plugin-NOTFOUND")
|
||||
endif ()
|
||||
|
@ -106,11 +106,9 @@ endfunction ()
|
|||
function (_grpc_fix_grpc_target_definitions)
|
||||
# Including gRPC headers without this definition results in a build error.
|
||||
if (WIN32)
|
||||
set_property(TARGET gRPC::grpc
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc APPEND
|
||||
PROPERTY INTERFACE_COMPILE_DEFINITIONS _WIN32_WINNT=0x600)
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY INTERFACE_COMPILE_DEFINITIONS _WIN32_WINNT=0x600)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
@ -155,10 +153,12 @@ function (_gRPC_find_library name filename)
|
|||
"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"${name} ${filename} RELEASE=${${name}_LIBRARY}"
|
||||
" DEBUG=${${name}_LIBRARY_DEBUG} DEFAULT=${${name}_LIBRARY}"
|
||||
)
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
|
||||
set(${name}_LIBRARY
|
||||
"${${name}_LIBRARY}"
|
||||
PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
|
@ -196,85 +196,75 @@ endif ()
|
|||
if (_gRPC_grpc_LIBRARY)
|
||||
if (NOT TARGET gRPC::grpc)
|
||||
add_library(gRPC::grpc IMPORTED UNKNOWN)
|
||||
set_target_properties(gRPC::grpc
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC_INCLUDE_DIR}")
|
||||
set_target_properties(
|
||||
gRPC::grpc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC_INCLUDE_DIR}")
|
||||
if (EXISTS "${_gRPC_grpc_LIBRARY}")
|
||||
set_target_properties(gRPC::grpc
|
||||
PROPERTIES IMPORTED_LOCATION
|
||||
"${_gRPC_grpc_LIBRARY}")
|
||||
set_target_properties(gRPC::grpc PROPERTIES IMPORTED_LOCATION
|
||||
"${_gRPC_grpc_LIBRARY}")
|
||||
endif ()
|
||||
if (EXISTS "${_gRPC_grpc_LIBRARY_RELEASE}")
|
||||
set_property(TARGET gRPC::grpc
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc APPEND
|
||||
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(gRPC::grpc
|
||||
PROPERTIES IMPORTED_LOCATION_RELEASE
|
||||
"${_gRPC_grpc_LIBRARY_RELEASE}")
|
||||
set_target_properties(
|
||||
gRPC::grpc PROPERTIES IMPORTED_LOCATION_RELEASE
|
||||
"${_gRPC_grpc_LIBRARY_RELEASE}")
|
||||
endif ()
|
||||
if (EXISTS "${_gRPC_grpc_LIBRARY_DEBUG}")
|
||||
set_property(TARGET gRPC::grpc
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc APPEND
|
||||
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(gRPC::grpc
|
||||
PROPERTIES IMPORTED_LOCATION_DEBUG
|
||||
"${_gRPC_grpc_LIBRARY_DEBUG}")
|
||||
set_target_properties(
|
||||
gRPC::grpc PROPERTIES IMPORTED_LOCATION_DEBUG
|
||||
"${_gRPC_grpc_LIBRARY_DEBUG}")
|
||||
endif ()
|
||||
set_property(TARGET gRPC::grpc
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
|
||||
Threads::Threads)
|
||||
set_property(
|
||||
TARGET gRPC::grpc APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
|
||||
Threads::Threads)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (_gRPC_grpc++_LIBRARY)
|
||||
if (NOT TARGET gRPC::grpc++)
|
||||
add_library(gRPC::grpc++ IMPORTED UNKNOWN)
|
||||
set_target_properties(gRPC::grpc++
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC++_INCLUDE_DIR}")
|
||||
set_target_properties(
|
||||
gRPC::grpc++ PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC++_INCLUDE_DIR}")
|
||||
if (EXISTS "${_gRPC_grpc++_LIBRARY}")
|
||||
set_target_properties(gRPC::grpc++
|
||||
PROPERTIES IMPORTED_LOCATION
|
||||
"${_gRPC_grpc++_LIBRARY}")
|
||||
set_target_properties(
|
||||
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION
|
||||
"${_gRPC_grpc++_LIBRARY}")
|
||||
endif ()
|
||||
if (EXISTS "${_gRPC_grpc++_LIBRARY_RELEASE}")
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(gRPC::grpc++
|
||||
PROPERTIES IMPORTED_LOCATION_RELEASE
|
||||
"${_gRPC_grpc++_LIBRARY_RELEASE}")
|
||||
set_target_properties(
|
||||
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION_RELEASE
|
||||
"${_gRPC_grpc++_LIBRARY_RELEASE}")
|
||||
endif ()
|
||||
if (EXISTS "${_gRPC_grpc++_LIBRARY_DEBUG}")
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(gRPC::grpc++
|
||||
PROPERTIES IMPORTED_LOCATION_DEBUG
|
||||
"${_gRPC_grpc++_LIBRARY_DEBUG}")
|
||||
set_target_properties(
|
||||
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION_DEBUG
|
||||
"${_gRPC_grpc++_LIBRARY_DEBUG}")
|
||||
endif ()
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
gRPC::grpc
|
||||
protobuf::libprotobuf
|
||||
Threads::Threads)
|
||||
set_property(
|
||||
TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES gRPC::grpc protobuf::libprotobuf
|
||||
Threads::Threads)
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.8)
|
||||
# gRPC++ requires C++11, but only CMake-3.8 introduced a target
|
||||
# compiler feature to meet that requirement.
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_11)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# CMake 3.5 is still alive and kicking in some older distros, use
|
||||
# the compiler-specific versions in these cases.
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++11")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
set_property(TARGET gRPC::grpc++ APPEND
|
||||
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++11")
|
||||
else ()
|
||||
message(
|
||||
|
@ -294,7 +284,9 @@ if (_gRPC_USE_STATIC_LIBS)
|
|||
set(CMAKE_FIND_LIBRARY_PREFIXES "${_gRPC_ORIG_FIND_LIBRARY_PREFIXES}")
|
||||
endif ()
|
||||
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/get_gRPC_version.cc" [====[
|
||||
file(
|
||||
WRITE "${CMAKE_BINARY_DIR}/get_gRPC_version.cc"
|
||||
[====[
|
||||
#include <grpcpp/grpcpp.h>
|
||||
#include <iostream>
|
||||
int main() {
|
||||
|
@ -303,30 +295,32 @@ int main() {
|
|||
}
|
||||
]====])
|
||||
|
||||
try_run(_gRPC_GET_VERSION_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_STATUS
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/get_gRPC_version.cc"
|
||||
LINK_LIBRARIES
|
||||
gRPC::grpc++
|
||||
gRPC::grpc
|
||||
COMPILE_OUTPUT_VARIABLE _gRPC_GET_VERSION_COMPILE_OUTPUT
|
||||
RUN_OUTPUT_VARIABLE gRPC_VERSION)
|
||||
try_run(
|
||||
_gRPC_GET_VERSION_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_STATUS
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/get_gRPC_version.cc"
|
||||
LINK_LIBRARIES
|
||||
gRPC::grpc++
|
||||
gRPC::grpc
|
||||
COMPILE_OUTPUT_VARIABLE _gRPC_GET_VERSION_COMPILE_OUTPUT
|
||||
RUN_OUTPUT_VARIABLE gRPC_VERSION)
|
||||
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/get_gRPC_version.cc")
|
||||
|
||||
_grpc_fix_grpc_cpp_plugin_target()
|
||||
|
||||
if (gRPC_DEBUG)
|
||||
foreach (_var
|
||||
_gRPC_CPP_PLUGIN_EXECUTABLE
|
||||
_gRPC_VERSION_RAW
|
||||
_gRPC_GET_VERSION_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_OUTPUT
|
||||
_gRPC_grpc_LIBRARY
|
||||
_gRPC_grpc++_LIBRARY
|
||||
_gRPC_INCLUDE_DIR)
|
||||
foreach (
|
||||
_var
|
||||
_gRPC_CPP_PLUGIN_EXECUTABLE
|
||||
_gRPC_VERSION_RAW
|
||||
_gRPC_GET_VERSION_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_STATUS
|
||||
_gRPC_GET_VERSION_COMPILE_OUTPUT
|
||||
_gRPC_grpc_LIBRARY
|
||||
_gRPC_grpc++_LIBRARY
|
||||
_gRPC_INCLUDE_DIR)
|
||||
message(
|
||||
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||
"${_var} = ${${_var}}")
|
||||
|
@ -335,9 +329,5 @@ if (gRPC_DEBUG)
|
|||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(gRPC
|
||||
REQUIRED_VARS
|
||||
_gRPC_grpc_LIBRARY
|
||||
_gRPC_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
gRPC_VERSION)
|
||||
find_package_handle_standard_args(gRPC REQUIRED_VARS _gRPC_grpc_LIBRARY
|
||||
_gRPC_INCLUDE_DIR VERSION_VAR gRPC_VERSION)
|
||||
|
|
|
@ -29,17 +29,10 @@
|
|||
#
|
||||
if (MSVC AND VCPKG_TARGET_TRIPLET MATCHES "-static$")
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if (${flag_var} MATCHES "/MD")
|
||||
string(REGEX
|
||||
REPLACE "/MD"
|
||||
"/MT"
|
||||
${flag_var}
|
||||
"${${flag_var}}")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif ()
|
||||
endforeach (flag_var)
|
||||
unset(flag_var)
|
||||
|
|
Loading…
Reference in a new issue