diff --git a/.gitmodules b/.gitmodules index 03e4a541eec..a346c23631f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -351,6 +351,9 @@ [submodule "contrib/idna"] path = contrib/idna url = https://github.com/ada-url/idna.git +[submodule "contrib/google-cloud-cpp"] + path = contrib/google-cloud-cpp + url = https://github.com/ClickHouse/google-cloud-cpp.git [submodule "contrib/rust_vendor"] path = contrib/rust_vendor url = https://github.com/ClickHouse/rust_vendor.git diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index f9c57dc7fa1..fcec9132cb7 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -219,6 +219,8 @@ add_contrib (prometheus-protobufs-cmake prometheus-protobufs prometheus-protobuf add_contrib (numactl-cmake numactl) +add_contrib (google-cloud-cpp-cmake google-cloud-cpp) # requires grpc, protobuf, absl + add_contrib (jwt-cpp-cmake jwt-cpp) # Put all targets defined here and in subdirectories under "contrib/" folders in GUI-based IDEs. diff --git a/contrib/google-cloud-cpp b/contrib/google-cloud-cpp new file mode 160000 index 00000000000..83f30caadb8 --- /dev/null +++ b/contrib/google-cloud-cpp @@ -0,0 +1 @@ +Subproject commit 83f30caadb8613fb5c408d8c2fd545291596b53f diff --git a/contrib/google-cloud-cpp-cmake/CMakeLists.txt b/contrib/google-cloud-cpp-cmake/CMakeLists.txt new file mode 100644 index 00000000000..d4e7a885a39 --- /dev/null +++ b/contrib/google-cloud-cpp-cmake/CMakeLists.txt @@ -0,0 +1,105 @@ +set(ENABLE_GOOGLE_CLOUD_CPP_DEFAULT OFF) + +if(ENABLE_LIBRARIES AND CLICKHOUSE_CLOUD AND OS_LINUX) + set(ENABLE_GOOGLE_CLOUD_CPP_DEFAULT ON) +endif() + +option(ENABLE_GOOGLE_CLOUD_CPP "Enable Google Cloud Cpp" ${ENABLE_GOOGLE_CLOUD_CPP_DEFAULT}) + +if(NOT ENABLE_GOOGLE_CLOUD_CPP) + message(STATUS "Not using Google Cloud Cpp") + return() +endif() + +if(NOT ENABLE_GRPC) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use Google Cloud Cpp without gRPC") +endif() +if (NOT ENABLE_PROTOBUF) + message( ${RECONFIGURE_MESSAGE_LEVEL} "Can't use Google Cloud Cpp without protobuf") +endif() + +# Gather sources and options. +set(GOOGLE_CLOUD_CPP_SOURCES) +set(GOOGLE_CLOUD_CPP_PUBLIC_INCLUDES) +set(GOOGLE_CLOUD_CPP_PRIVATE_INCLUDES) +set(GOOGLE_CLOUD_CPP_PRIVATE_LIBS) + +# Directories. +SET(GOOGLE_CLOUD_CPP_DIR "${ClickHouse_SOURCE_DIR}/contrib/google-cloud-cpp" ) +list(APPEND GOOGLE_CLOUD_CPP_PRIVATE_INCLUDES "${GOOGLE_CLOUD_CPP_DIR}") + +# Set the PROJECT_SOURCE_DIR so that all Google Cloud cmake files work +set(PROJECT_SOURCE_DIR_BAK ${PROJECT_SOURCE_DIR}) +set(PROJECT_SOURCE_DIR ${GOOGLE_CLOUD_CPP_DIR}) + +list(APPEND CMAKE_MODULE_PATH "${GOOGLE_CLOUD_CPP_DIR}/cmake") + +# Building this target results in all protobufs being compiled. +add_custom_target(google-cloud-cpp-protos) + +include("GoogleCloudCppLibrary") + +# Set some variables required for googleapis CMakeLists.txt to work. +set(GOOGLE_CLOUD_CPP_ENABLE_GRPC ON) +set(PROJECT_VERSION "1") +set(PROJECT_VERSION_MAJOR "1") +set(PROTO_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/google-protobuf/src") +set(GOOGLE_CLOUD_CPP_GRPC_PLUGIN_EXECUTABLE $) + +include(GoogleApis.cmake) + +add_library(gRPC::grpc++ ALIAS _ch_contrib_grpc) +add_library(gRPC::grpc ALIAS _ch_contrib_grpc) + +# google-cloud-cpp-kms. +google_cloud_cpp_add_library_protos(kms) + +include(google_cloud_cpp_common.cmake) +include(google_cloud_cpp_grpc_utils.cmake) + +SET(GOOGLE_CLOUD_CPP_KMS_DIR "${GOOGLE_CLOUD_CPP_DIR}/google/cloud/kms") + +file(GLOB GOOGLE_CLOUD_CPP_KMS_SRC + "${GOOGLE_CLOUD_CPP_KMS_DIR}/v1/*.cc" + "${GOOGLE_CLOUD_CPP_KMS_DIR}/v1/internal/*.cc" + "${GOOGLE_CLOUD_CPP_KMS_DIR}/inventory/v1/*.cc" +) + +list(APPEND GOOGLE_CLOUD_CPP_SOURCES ${GOOGLE_CLOUD_CPP_KMS_SRC}) +list(APPEND GOOGLE_CLOUD_CPP_PUBLIC_INCLUDES "${GOOGLE_CLOUD_CPP_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") + +set(GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc") +list(APPEND GOOGLE_CLOUD_CPP_PUBLIC_INCLUDES "${GRPC_INCLUDE_DIR}/include" "${GRPC_INCLUDE_DIR}/spm-cpp-include") + +# Restore the PROJECT_SOURCE_DIR. +set(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR_BAK}) + +# Link against external libraries. +list(APPEND GOOGLE_CLOUD_CPP_PRIVATE_LIBS + google_cloud_cpp_common + google_cloud_cpp_grpc_utils + google_cloud_cpp_kms_protos + google_cloud_cpp_cloud_location_locations_protos + google_cloud_cpp_iam_v1_iam_policy_protos + gRPC::grpc++ + absl::optional +) + +list(APPEND GOOGLE_CLOUD_CPP_PUBLIC_LIBS + absl::optional + gRPC::grpc++ +) + +# Add library. +add_library(_gcloud ${GOOGLE_CLOUD_CPP_SOURCES}) + +target_include_directories(_gcloud SYSTEM PUBLIC ${GOOGLE_CLOUD_CPP_PUBLIC_INCLUDES}) +target_include_directories(_gcloud SYSTEM PRIVATE ${GOOGLE_CLOUD_CPP_PRIVATE_INCLUDES}) +target_link_libraries(_gcloud PRIVATE ${GOOGLE_CLOUD_CPP_PRIVATE_LIBS}) + +# The library is large - avoid bloat. +if (OMIT_HEAVY_DEBUG_SYMBOLS) + target_compile_options(_gcloud PRIVATE -g0) +endif() + +add_library(ch_contrib::google_cloud_cpp ALIAS _gcloud) diff --git a/contrib/google-cloud-cpp-cmake/GoogleApis.cmake b/contrib/google-cloud-cpp-cmake/GoogleApis.cmake new file mode 100644 index 00000000000..070ce2275c4 --- /dev/null +++ b/contrib/google-cloud-cpp-cmake/GoogleApis.cmake @@ -0,0 +1,469 @@ +# ~~~ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +# File copied from google-cloud-cpp/external/googleapis/CMakeLists.txt with minor modifications. + +if (NOT GOOGLE_CLOUD_CPP_ENABLE_GRPC) + return() +endif () + +include(GoogleapisConfig) + +set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL + "https://github.com/googleapis/googleapis/archive/${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA}.tar.gz" + "https://storage.googleapis.com/cloud-cpp-community-archive/github.com/googleapis/googleapis/archive/${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA}.tar.gz" +) +set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL_HASH + "${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256}") +if (GOOGLE_CLOUD_CPP_OVERRIDE_GOOGLEAPIS_URL) + set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL + ${GOOGLE_CLOUD_CPP_OVERRIDE_GOOGLEAPIS_URL}) +endif () +if (GOOGLE_CLOUD_CPP_OVERRIDE_GOOGLEAPIS_URL_HASH) + set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL_HASH + "${GOOGLE_CLOUD_CPP_OVERRIDE_GOOGLEAPIS_URL_HASH}") +endif () + +set(EXTERNAL_GOOGLEAPIS_PROTO_FILES + # cmake-format: sort + "google/api/annotations.proto" + "google/api/auth.proto" + "google/api/backend.proto" + "google/api/billing.proto" + "google/api/client.proto" + "google/api/config_change.proto" + "google/api/consumer.proto" + "google/api/context.proto" + "google/api/control.proto" + "google/api/distribution.proto" + "google/api/documentation.proto" + "google/api/endpoint.proto" + "google/api/error_reason.proto" + "google/api/field_behavior.proto" + "google/api/field_info.proto" + "google/api/http.proto" + "google/api/httpbody.proto" + "google/api/label.proto" + "google/api/launch_stage.proto" + "google/api/log.proto" + "google/api/logging.proto" + "google/api/metric.proto" + "google/api/monitored_resource.proto" + "google/api/monitoring.proto" + "google/api/policy.proto" + "google/api/quota.proto" + "google/api/resource.proto" + "google/api/routing.proto" + "google/api/service.proto" + "google/api/source_info.proto" + "google/api/system_parameter.proto" + "google/api/usage.proto" + "google/api/visibility.proto" + "google/cloud/extended_operations.proto" + "google/cloud/location/locations.proto" + # orgpolicy/v**1** is used *indirectly* by google/cloud/asset, therefore it + # does not appear in protolists/asset.list. In addition, it is not compiled + # by any other library. So, added manually. + "google/cloud/orgpolicy/v1/orgpolicy.proto" + # Some gRPC based authentication is implemented by the IAM Credentials + # service. + "google/iam/credentials/v1/common.proto" + "google/iam/credentials/v1/iamcredentials.proto" + # We expose google::iam::v1::Policy in our google::cloud::IAMUpdater + "google/iam/v1/iam_policy.proto" + "google/iam/v1/options.proto" + "google/iam/v1/policy.proto" + "google/longrunning/operations.proto" + "google/rpc/code.proto" + "google/rpc/context/attribute_context.proto" + "google/rpc/error_details.proto" + "google/rpc/status.proto" + "google/type/calendar_period.proto" + "google/type/color.proto" + "google/type/date.proto" + "google/type/datetime.proto" + "google/type/dayofweek.proto" + "google/type/decimal.proto" + "google/type/expr.proto" + "google/type/fraction.proto" + "google/type/interval.proto" + "google/type/latlng.proto" + "google/type/localized_text.proto" + "google/type/money.proto" + "google/type/month.proto" + "google/type/phone_number.proto" + "google/type/postal_address.proto" + "google/type/quaternion.proto" + "google/type/timeofday.proto") + +include(GoogleCloudCppCommonOptions) + +# Set EXTERNAL_GOOGLEAPIS_SOURCE in the parent directory, as it is used by all +# the generated libraries. The Conan packages (https://conan.io), will need to +# patch this value. Setting the value in a single place makes such patching +# easier. +set(EXTERNAL_GOOGLEAPIS_PREFIX "${PROJECT_BINARY_DIR}/external/googleapis") +set(EXTERNAL_GOOGLEAPIS_SOURCE + "${EXTERNAL_GOOGLEAPIS_PREFIX}/src/googleapis_download" + PARENT_SCOPE) +set(EXTERNAL_GOOGLEAPIS_SOURCE + "${EXTERNAL_GOOGLEAPIS_PREFIX}/src/googleapis_download") + +# Include the functions to compile proto files and maintain proto libraries. +include(CompileProtos) + +set(EXTERNAL_GOOGLEAPIS_BYPRODUCTS) +foreach (proto ${EXTERNAL_GOOGLEAPIS_PROTO_FILES}) + list(APPEND EXTERNAL_GOOGLEAPIS_BYPRODUCTS + "${EXTERNAL_GOOGLEAPIS_SOURCE}/${proto}") +endforeach () + +file(GLOB protolists "protolists/*.list") +foreach (file IN LISTS protolists) + google_cloud_cpp_load_protolist(protos "${file}") + foreach (proto IN LISTS protos) + list(APPEND EXTERNAL_GOOGLEAPIS_BYPRODUCTS "${proto}") + endforeach () +endforeach () + +include(ExternalProject) + +# -- The build needs protobuf files. The original build scripts download them from a remote server (see target 'googleapis_download'). +# This is too unreliable in the context of ClickHouse ... we instead ship the downloaded archive with the ClickHouse source and +# extract it into the build directory directly. + +# Dummy googleapis_download target. This needs to exist because lots of other targets depend on it +# We however trick it a little bit saying this target generates the ${EXTERNAL_GOOGLEAPIS_BYPRODUCTS} BYPRODUCTS when +# actually the following section is the one actually providing such BYPRODUCTS. +externalproject_add( + googleapis_download + EXCLUDE_FROM_ALL ON + PREFIX "${EXTERNAL_GOOGLEAPIS_PREFIX}" + PATCH_COMMAND "" + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS ${EXTERNAL_GOOGLEAPIS_BYPRODUCTS} + LOG_DOWNLOAD OFF) + +# Command that extracts the tarball into the proper dir +# Note: The hash must match the Google Cloud Api version, otherwise funny things will happen. +# Find the right hash in "strip-prefix" in MODULE.bazel in the subrepository +message(STATUS "Extracting googleapis tarball") +set(PB_HASH "e60db19f11f94175ac682c5898cce0f77cc508ea") +set(PB_ARCHIVE "${PB_HASH}.tar.gz") +set(PB_DIR "googleapis-${PB_HASH}") + +file(ARCHIVE_EXTRACT INPUT + "${ClickHouse_SOURCE_DIR}/contrib/google-cloud-cpp-cmake/googleapis/${PB_ARCHIVE}" + DESTINATION + "${EXTERNAL_GOOGLEAPIS_PREFIX}/tmp") + +file(REMOVE_RECURSE "${EXTERNAL_GOOGLEAPIS_SOURCE}") +file(RENAME + "${EXTERNAL_GOOGLEAPIS_PREFIX}/tmp/${PB_DIR}" + "${EXTERNAL_GOOGLEAPIS_SOURCE}" +) + +google_cloud_cpp_find_proto_include_dir(PROTO_INCLUDE_DIR) + +google_cloud_cpp_add_protos_property() + +function (external_googleapis_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) +endfunction () + +# Create a single source proto library. +# +# * proto: the filename for the proto source. +# * (optional) ARGN: proto libraries the new library depends on. +function (external_googleapis_add_library proto) + external_googleapis_short_name(short_name "${proto}") + google_cloud_cpp_grpcpp_library( + google_cloud_cpp_${short_name} "${EXTERNAL_GOOGLEAPIS_SOURCE}/${proto}" + PROTO_PATH_DIRECTORIES "${EXTERNAL_GOOGLEAPIS_SOURCE}" + "${PROTO_INCLUDE_DIR}") + + external_googleapis_set_version_and_alias("${short_name}") + + set(public_deps) + foreach (dep_short_name ${ARGN}) + list(APPEND public_deps "google-cloud-cpp::${dep_short_name}") + endforeach () + list(LENGTH public_deps public_deps_length) + if (public_deps_length EQUAL 0) + target_link_libraries("google_cloud_cpp_${short_name}") + else () + target_link_libraries("google_cloud_cpp_${short_name}" + PUBLIC ${public_deps}) + endif () +endfunction () + +function (external_googleapis_set_version_and_alias short_name) + add_dependencies("google_cloud_cpp_${short_name}" googleapis_download) + set_target_properties( + "google_cloud_cpp_${short_name}" + PROPERTIES EXPORT_NAME google-cloud-cpp::${short_name} + VERSION "${PROJECT_VERSION}" + SOVERSION ${PROJECT_VERSION_MAJOR}) + add_library("google-cloud-cpp::${short_name}" ALIAS + "google_cloud_cpp_${short_name}") +endfunction () + +if (GOOGLE_CLOUD_CPP_USE_INSTALLED_COMMON) + return() +endif () + +# Avoid adding new proto libraries to this list as these libraries are always +# installed, regardless of whether or not they are needed. See #8022 for more +# details. +set(external_googleapis_installed_libraries_list + # cmake-format: sort + google_cloud_cpp_cloud_common_common_protos + google_cloud_cpp_iam_credentials_v1_common_protos + google_cloud_cpp_iam_credentials_v1_iamcredentials_protos + google_cloud_cpp_iam_v1_iam_policy_protos + google_cloud_cpp_iam_v1_options_protos + google_cloud_cpp_iam_v1_policy_protos + google_cloud_cpp_longrunning_operations_protos) + +# These proto files cannot be added in the foreach() loop because they have +# dependencies. +set(PROTO_FILES_WITH_DEPENDENCIES + # cmake-format: sort + "google/api/annotations.proto" + "google/api/auth.proto" + "google/api/billing.proto" + "google/api/client.proto" + "google/api/control.proto" + "google/api/distribution.proto" + "google/api/endpoint.proto" + "google/api/log.proto" + "google/api/logging.proto" + "google/api/metric.proto" + "google/api/monitored_resource.proto" + "google/api/monitoring.proto" + "google/api/quota.proto" + "google/api/service.proto" + "google/api/usage.proto" + "google/cloud/location/locations.proto" + "google/rpc/status.proto") + +# For some directories *most* (but not all) the proto files are simple enough +# that the libraries can be generated with a foreach() loop. +foreach (proto IN LISTS EXTERNAL_GOOGLEAPIS_PROTO_FILES) + if (proto MATCHES "^google/api/" + OR proto MATCHES "^google/type" + OR proto MATCHES "^google/rpc/" + OR proto MATCHES "^google/cloud/") + external_googleapis_short_name(short_name "${proto}") + list(APPEND external_googleapis_installed_libraries_list + google_cloud_cpp_${short_name}) + list(FIND PROTO_FILES_WITH_DEPENDENCIES "${proto}" has_dependency) + if (has_dependency EQUAL -1) + external_googleapis_add_library("${proto}") + endif () + endif () +endforeach () + +# Out of order because they have dependencies. +external_googleapis_add_library("google/api/annotations.proto" api_http_protos) +external_googleapis_add_library("google/api/auth.proto" api_annotations_protos) +external_googleapis_add_library("google/api/client.proto" + api_launch_stage_protos) +external_googleapis_add_library("google/api/control.proto" api_policy_protos) +external_googleapis_add_library("google/api/metric.proto" + api_launch_stage_protos api_label_protos) +external_googleapis_add_library("google/api/billing.proto" + api_annotations_protos api_metric_protos) +external_googleapis_add_library("google/api/distribution.proto" + api_annotations_protos) +external_googleapis_add_library("google/api/endpoint.proto" + api_annotations_protos) +external_googleapis_add_library("google/api/log.proto" api_label_protos) +external_googleapis_add_library("google/api/logging.proto" + api_annotations_protos api_label_protos) +external_googleapis_add_library("google/api/monitored_resource.proto" + api_launch_stage_protos api_label_protos) +external_googleapis_add_library("google/api/monitoring.proto" + api_annotations_protos) +external_googleapis_add_library("google/api/quota.proto" api_annotations_protos) +external_googleapis_add_library("google/api/usage.proto" api_annotations_protos + api_visibility_protos) +external_googleapis_add_library( + "google/api/service.proto" + api_annotations_protos + api_auth_protos + api_backend_protos + api_billing_protos + api_client_protos + api_context_protos + api_control_protos + api_documentation_protos + api_endpoint_protos + api_http_protos + api_label_protos + api_log_protos + api_logging_protos + api_metric_protos + api_monitored_resource_protos + api_monitoring_protos + api_quota_protos + api_resource_protos + api_source_info_protos + api_system_parameter_protos + api_usage_protos) + +external_googleapis_add_library("google/cloud/location/locations.proto" + api_annotations_protos api_client_protos) + +external_googleapis_add_library("google/iam/v1/options.proto" + api_annotations_protos) +external_googleapis_add_library("google/iam/v1/policy.proto" + api_annotations_protos type_expr_protos) +external_googleapis_add_library("google/rpc/status.proto" + rpc_error_details_protos) + +external_googleapis_add_library( + "google/longrunning/operations.proto" api_annotations_protos + api_client_protos rpc_status_protos) + +external_googleapis_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) + +external_googleapis_add_library("google/iam/credentials/v1/common.proto" + api_field_behavior_protos api_resource_protos) + +external_googleapis_add_library( + "google/iam/credentials/v1/iamcredentials.proto" api_annotations_protos + api_client_protos iam_credentials_v1_common_protos) + +google_cloud_cpp_load_protolist(cloud_common_list "${GOOGLE_CLOUD_CPP_DIR}/external/googleapis/protolists/common.list") +google_cloud_cpp_load_protodeps(cloud_common_deps "${GOOGLE_CLOUD_CPP_DIR}/external/googleapis/protodeps/common.deps") +google_cloud_cpp_grpcpp_library( + google_cloud_cpp_cloud_common_common_protos ${cloud_common_list} + PROTO_PATH_DIRECTORIES "${EXTERNAL_GOOGLEAPIS_SOURCE}" + "${PROTO_INCLUDE_DIR}") +external_googleapis_set_version_and_alias(cloud_common_common_protos) +target_link_libraries(google_cloud_cpp_cloud_common_common_protos + PUBLIC ${cloud_common_deps}) + +# Install the libraries and headers in the locations determined by +# GNUInstallDirs +include(GNUInstallDirs) + +install( + TARGETS ${external_googleapis_installed_libraries_list} + EXPORT googleapis-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT google_cloud_cpp_runtime + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT google_cloud_cpp_runtime + NAMELINK_COMPONENT google_cloud_cpp_development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT google_cloud_cpp_development) + +foreach (target ${external_googleapis_installed_libraries_list}) + google_cloud_cpp_install_proto_library_headers("${target}") + google_cloud_cpp_install_proto_library_protos( + "${target}" "${EXTERNAL_GOOGLEAPIS_SOURCE}") +endforeach () + +# Create and install the pkg-config files. +foreach (target ${external_googleapis_installed_libraries_list}) + external_googleapis_install_pc("${target}") +endforeach () + +# Create and install the googleapis pkg-config file for backwards compatibility. +set(GOOGLE_CLOUD_CPP_PC_LIBS "") +google_cloud_cpp_set_pkgconfig_paths() +set(GOOGLE_CLOUD_CPP_PC_NAME "The Google APIS C++ Proto Library") +set(GOOGLE_CLOUD_CPP_PC_DESCRIPTION + "Provides C++ APIs to access Google Cloud Platforms.") +# This list is for backwards compatibility purposes only. DO NOT add new +# libraries to it. +string( + JOIN + " " + GOOGLE_CLOUD_CPP_PC_REQUIRES + "google_cloud_cpp_bigtable_protos" + "google_cloud_cpp_cloud_bigquery_protos" + "google_cloud_cpp_iam_protos" + "google_cloud_cpp_pubsub_protos" + "google_cloud_cpp_storage_protos" + "google_cloud_cpp_logging_protos" + "google_cloud_cpp_iam_v1_iam_policy_protos" + "google_cloud_cpp_iam_v1_options_protos" + "google_cloud_cpp_iam_v1_policy_protos" + "google_cloud_cpp_longrunning_operations_protos" + "google_cloud_cpp_api_auth_protos" + "google_cloud_cpp_api_annotations_protos" + "google_cloud_cpp_api_client_protos" + "google_cloud_cpp_api_field_behavior_protos" + "google_cloud_cpp_api_http_protos" + "google_cloud_cpp_rpc_status_protos" + "google_cloud_cpp_rpc_error_details_protos" + "google_cloud_cpp_type_expr_protos" + "grpc++" + "grpc" + "openssl" + "protobuf" + "zlib" + "libcares") +set(GOOGLE_CLOUD_CPP_PC_LIBS "") +google_cloud_cpp_set_pkgconfig_paths() +configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/config.pc.in" + "googleapis.pc" @ONLY) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/googleapis.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + COMPONENT google_cloud_cpp_development) + +# Create and install the CMake configuration files. +# include(CMakePackageConfigHelpers) + +# configure_file("${CMAKE_CURRENT_LIST_DIR}/config.cmake.in" +# "google_cloud_cpp_googleapis-config.cmake" @ONLY) +# write_basic_package_version_file( +# "google_cloud_cpp_googleapis-config-version.cmake" +# VERSION ${PROJECT_VERSION} +# COMPATIBILITY ExactVersion) + +# Export the CMake targets to make it easy to create configuration files. +# install( +# EXPORT googleapis-targets +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_googleapis" +# COMPONENT google_cloud_cpp_development) +# install( +# FILES +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_googleapis-config.cmake" +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_googleapis-config-version.cmake" +# "${PROJECT_SOURCE_DIR}/cmake/FindgRPC.cmake" +# "${PROJECT_SOURCE_DIR}/cmake/CompileProtos.cmake" +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_googleapis" +# COMPONENT google_cloud_cpp_development) diff --git a/contrib/google-cloud-cpp-cmake/google_cloud_cpp_common.cmake b/contrib/google-cloud-cpp-cmake/google_cloud_cpp_common.cmake new file mode 100644 index 00000000000..5f23ce0fafb --- /dev/null +++ b/contrib/google-cloud-cpp-cmake/google_cloud_cpp_common.cmake @@ -0,0 +1,447 @@ +# ~~~ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +# File copied from google-cloud-cpp/google-cloud-cpp/google_cloud_cpp_common.cmake with minor modifications. + +set(GOOGLE_CLOUD_CPP_COMMON_DIR "${GOOGLE_CLOUD_CPP_DIR}/google/cloud") + +# Generate the version information from the CMake values. +# configure_file(${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/version_info.h.in +# ${CMAKE_CURRENT_SOURCE_DIR}/internal/version_info.h) + +# Create the file that captures build information. Having access to the compiler +# and build flags at runtime allows us to print better benchmark results. +string(TOUPPER "${CMAKE_BUILD_TYPE}" GOOGLE_CLOUD_CPP_BUILD_TYPE_UPPER) +configure_file(${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/build_info.cc.in internal/build_info.cc) + +# the client library +add_library( + google_cloud_cpp_common # cmake-format: sort + ${CMAKE_CURRENT_BINARY_DIR}/internal/build_info.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/access_token.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/access_token.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/backoff_policy.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/common_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/credentials.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/credentials.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/experimental_tag.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/future.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/future_generic.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/future_void.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/idempotency.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/absl_str_cat_quiet.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/absl_str_join_quiet.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/absl_str_replace_quiet.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/algorithm.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/api_client_header.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/api_client_header.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/attributes.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/auth_header_error.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/auth_header_error.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/backoff_policy.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/backoff_policy.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/base64_transforms.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/base64_transforms.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/big_endian.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/build_info.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/call_context.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/clock.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/compiler_info.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/compiler_info.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/compute_engine_util.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/compute_engine_util.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/credentials_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/credentials_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_future_status.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_future_status.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/detect_gcp.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/detect_gcp_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/detect_gcp_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/diagnostics_pop.inc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/diagnostics_push.inc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/disable_deprecation_warnings.inc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/disable_msvc_crt_secure_warnings.inc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/error_context.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/error_context.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/filesystem.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/filesystem.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/format_time_point.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/format_time_point.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_base.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_coroutines.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_fwd.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_then_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/future_then_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/getenv.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/getenv.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/group_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/invocation_id_generator.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/invocation_id_generator.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/invoke_result.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/ios_flags_saver.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/log_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/log_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/make_status.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/make_status.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/noexcept_action.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/noexcept_action.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/non_constructible.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/opentelemetry.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/opentelemetry.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/opentelemetry_context.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/opentelemetry_context.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/pagination_range.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/parse_rfc3339.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/parse_rfc3339.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/populate_common_options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/populate_common_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/port_platform.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/random.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/random.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_info.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_loop_helpers.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_loop_helpers.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_policy_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_policy_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/service_endpoint.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/service_endpoint.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/sha256_hash.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/sha256_hash.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/sha256_hmac.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/sha256_hmac.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/sha256_type.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/status_payload_keys.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/status_payload_keys.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/status_utils.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/status_utils.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/strerror.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/strerror.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/subject_token.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/subject_token.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/throw_delegate.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/throw_delegate.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/timer_queue.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/timer_queue.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/trace_propagator.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/trace_propagator.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/traced_stream_range.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/tuple.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/type_list.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/type_traits.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/url_encode.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/url_encode.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/user_agent_prefix.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/user_agent_prefix.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/utility.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/version_info.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/kms_key_name.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/kms_key_name.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/location.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/location.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/log.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/log.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/no_await_tag.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/opentelemetry_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/optional.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/polling_policy.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/project.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/project.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/retry_policy.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/rpc_metadata.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/status.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/status.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/status_or.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/stream_range.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/terminate_handler.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/terminate_handler.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/tracing_options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/tracing_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/universe_domain_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/version.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/version.h) +target_link_libraries( + google_cloud_cpp_common + PUBLIC absl::base + absl::memory + absl::optional + absl::span + absl::str_format + absl::time + absl::variant + Threads::Threads) +if (WIN32) + target_compile_definitions(google_cloud_cpp_common + PRIVATE WIN32_LEAN_AND_MEAN) + target_link_libraries(google_cloud_cpp_common PUBLIC bcrypt) +else () + target_link_libraries(google_cloud_cpp_common PUBLIC OpenSSL::Crypto ch_contrib::re2) +endif () + +google_cloud_cpp_add_common_options(google_cloud_cpp_common) +target_include_directories( + google_cloud_cpp_common PUBLIC $ + $) + +# We're putting generated code into ${PROJECT_BINARY_DIR} (e.g. compiled +# protobufs or build info), so we need it on the include path, however we don't +# want it checked by linters so we mark it as SYSTEM. +target_include_directories(google_cloud_cpp_common SYSTEM + PUBLIC $) +target_compile_options(google_cloud_cpp_common + PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG}) + +set_target_properties( + google_cloud_cpp_common + PROPERTIES EXPORT_NAME "google-cloud-cpp::common" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) +add_library(google-cloud-cpp::common ALIAS google_cloud_cpp_common) + +#create_bazel_config(google_cloud_cpp_common YEAR 2018) + +# # Export the CMake targets to make it easy to create configuration files. +# install( +# EXPORT google_cloud_cpp_common-targets +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" +# COMPONENT google_cloud_cpp_development) + +# # Install the libraries and headers in the locations determined by +# # GNUInstallDirs +# install( +# TARGETS google_cloud_cpp_common +# EXPORT google_cloud_cpp_common-targets +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +# COMPONENT google_cloud_cpp_runtime +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# COMPONENT google_cloud_cpp_runtime +# NAMELINK_COMPONENT google_cloud_cpp_development +# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +# COMPONENT google_cloud_cpp_development) + +#google_cloud_cpp_install_headers(google_cloud_cpp_common include/google/cloud) + +# google_cloud_cpp_add_pkgconfig( +# "common" +# "Google Cloud C++ Client Library Common Components" +# "Common Components used by the Google Cloud C++ Client Libraries." +# "absl_optional" +# "absl_span" +# "absl_strings" +# "absl_time" +# "absl_time_zone" +# "absl_variant" +# "${GOOGLE_CLOUD_CPP_OPENTELEMETRY_API}" +# NON_WIN32_REQUIRES +# openssl +# WIN32_LIBS +# bcrypt) + +# Create and install the CMake configuration files. +# configure_file("config.cmake.in" "google_cloud_cpp_common-config.cmake" @ONLY) +# write_basic_package_version_file( +# "google_cloud_cpp_common-config-version.cmake" +# VERSION ${PROJECT_VERSION} +# COMPATIBILITY ExactVersion) + +# install( +# FILES +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config.cmake" +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config-version.cmake" +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" +# COMPONENT google_cloud_cpp_development) + +# if (GOOGLE_CLOUD_CPP_WITH_MOCKS) +# # Create a header-only library for the mocks. We use a CMake `INTERFACE` +# # library for these, a regular library would not work on macOS (where the +# # library needs at least one .o file). +# add_library(google_cloud_cpp_mocks INTERFACE) +# set(google_cloud_cpp_mocks_hdrs +# # cmake-format: sort +# mocks/current_options.h mocks/mock_async_streaming_read_write_rpc.h +# mocks/mock_stream_range.h) +# export_list_to_bazel("google_cloud_cpp_mocks.bzl" +# "google_cloud_cpp_mocks_hdrs" YEAR "2022") +# target_link_libraries( +# google_cloud_cpp_mocks INTERFACE google-cloud-cpp::common GTest::gmock +# GTest::gtest) +# set_target_properties(google_cloud_cpp_mocks +# PROPERTIES EXPORT_NAME google-cloud-cpp::mocks) +# target_include_directories( +# google_cloud_cpp_mocks +# INTERFACE $ +# $ +# $) +# target_compile_options(google_cloud_cpp_mocks +# INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG}) +# add_library(google-cloud-cpp::mocks ALIAS google_cloud_cpp_mocks) + +# install( +# FILES ${google_cloud_cpp_mocks_hdrs} +# DESTINATION "include/google/cloud/mocks" +# COMPONENT google_cloud_cpp_development) + +# # Export the CMake targets to make it easy to create configuration files. +# install( +# EXPORT google_cloud_cpp_mocks-targets +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_mocks" +# COMPONENT google_cloud_cpp_development) + +# install( +# TARGETS google_cloud_cpp_mocks +# EXPORT google_cloud_cpp_mocks-targets +# COMPONENT google_cloud_cpp_development) + +# google_cloud_cpp_add_pkgconfig( +# "mocks" "Google Cloud C++ Testing Library" +# "Helpers for testing the Google Cloud C++ Client Libraries" +# "google_cloud_cpp_common" "gmock") + +# # Create and install the CMake configuration files. +# configure_file("mocks-config.cmake.in" +# "google_cloud_cpp_mocks-config.cmake" @ONLY) +# write_basic_package_version_file( +# "google_cloud_cpp_mocks-config-version.cmake" +# VERSION ${PROJECT_VERSION} +# COMPATIBILITY ExactVersion) + +# install( +# FILES +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_mocks-config.cmake" +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_mocks-config-version.cmake" +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_mocks" +# COMPONENT google_cloud_cpp_development) +# endif () + +# if (BUILD_TESTING) +# include(FindBenchmarkWithWorkarounds) + +# set(google_cloud_cpp_common_unit_tests +# # cmake-format: sort +# access_token_test.cc +# common_options_test.cc +# future_coroutines_test.cc +# future_generic_test.cc +# future_generic_then_test.cc +# future_void_test.cc +# future_void_then_test.cc +# internal/algorithm_test.cc +# internal/api_client_header_test.cc +# internal/backoff_policy_test.cc +# internal/base64_transforms_test.cc +# internal/big_endian_test.cc +# internal/call_context_test.cc +# internal/clock_test.cc +# internal/compiler_info_test.cc +# internal/compute_engine_util_test.cc +# internal/credentials_impl_test.cc +# internal/debug_future_status_test.cc +# internal/debug_string_test.cc +# internal/detect_gcp_test.cc +# internal/error_context_test.cc +# internal/filesystem_test.cc +# internal/format_time_point_test.cc +# internal/future_impl_test.cc +# internal/future_then_impl_test.cc +# internal/group_options_test.cc +# internal/invocation_id_generator_test.cc +# internal/invoke_result_test.cc +# internal/log_impl_test.cc +# internal/make_status_test.cc +# internal/noexcept_action_test.cc +# internal/opentelemetry_context_test.cc +# internal/opentelemetry_test.cc +# internal/pagination_range_test.cc +# internal/parse_rfc3339_test.cc +# internal/populate_common_options_test.cc +# internal/random_test.cc +# internal/retry_loop_helpers_test.cc +# internal/retry_policy_impl_test.cc +# internal/service_endpoint_test.cc +# internal/sha256_hash_test.cc +# internal/sha256_hmac_test.cc +# internal/status_payload_keys_test.cc +# internal/status_utils_test.cc +# internal/strerror_test.cc +# internal/subject_token_test.cc +# internal/throw_delegate_test.cc +# internal/timer_queue_test.cc +# internal/trace_propagator_test.cc +# internal/traced_stream_range_test.cc +# internal/tuple_test.cc +# internal/type_list_test.cc +# internal/url_encode_test.cc +# internal/user_agent_prefix_test.cc +# internal/utility_test.cc +# kms_key_name_test.cc +# location_test.cc +# log_test.cc +# mocks/current_options_test.cc +# mocks/mock_stream_range_test.cc +# options_test.cc +# polling_policy_test.cc +# project_test.cc +# status_or_test.cc +# status_test.cc +# stream_range_test.cc +# terminate_handler_test.cc +# tracing_options_test.cc) + +# # Export the list of unit tests so the Bazel BUILD file can pick it up. +# export_list_to_bazel("google_cloud_cpp_common_unit_tests.bzl" +# "google_cloud_cpp_common_unit_tests" YEAR "2018") + +# foreach (fname ${google_cloud_cpp_common_unit_tests}) +# google_cloud_cpp_add_executable(target "common" "${fname}") +# target_link_libraries( +# ${target} +# PRIVATE google_cloud_cpp_testing +# google-cloud-cpp::common +# google-cloud-cpp::mocks +# absl::variant +# GTest::gmock_main +# GTest::gmock +# GTest::gtest) +# google_cloud_cpp_add_common_options(${target}) +# add_test(NAME ${target} COMMAND ${target}) +# endforeach () + +# set(google_cloud_cpp_common_benchmarks # cmake-format: sort +# options_benchmark.cc) + +# # Export the list of benchmarks to a .bzl file so we do not need to maintain +# # the list in two places. +# export_list_to_bazel("google_cloud_cpp_common_benchmarks.bzl" +# "google_cloud_cpp_common_benchmarks" YEAR "2020") + +# # Generate a target for each benchmark. +# foreach (fname ${google_cloud_cpp_common_benchmarks}) +# google_cloud_cpp_add_executable(target "common" "${fname}") +# add_test(NAME ${target} COMMAND ${target}) +# target_link_libraries(${target} PRIVATE google-cloud-cpp::common +# benchmark::benchmark_main) +# google_cloud_cpp_add_common_options(${target}) +# endforeach () +# endif () + +# if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) +# google_cloud_cpp_add_samples_relative("common" "samples/") +# endif () diff --git a/contrib/google-cloud-cpp-cmake/google_cloud_cpp_grpc_utils.cmake b/contrib/google-cloud-cpp-cmake/google_cloud_cpp_grpc_utils.cmake new file mode 100644 index 00000000000..e5538b2eaa8 --- /dev/null +++ b/contrib/google-cloud-cpp-cmake/google_cloud_cpp_grpc_utils.cmake @@ -0,0 +1,350 @@ +# ~~~ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +# File copied from google-cloud-cpp/google-cloud-cpp/google_cloud_cpp_grpc_utils.cmake with minor modifications. + +set(GOOGLE_CLOUD_CPP_COMMON_DIR "${GOOGLE_CLOUD_CPP_DIR}/google/cloud") + +# the library +add_library( + google_cloud_cpp_grpc_utils # cmake-format: sort + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/async_operation.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/async_streaming_read_write_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/background_threads.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/completion_queue.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/completion_queue.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/connection_options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/connection_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_error_delegate.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_error_delegate.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_utils/async_operation.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_utils/completion_queue.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_utils/grpc_error_delegate.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/grpc_utils/version.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/iam_updater.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_connection_ready.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_connection_ready.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_long_running_operation.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_polling_loop.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_polling_loop.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_stream_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_write_stream_auth.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_write_stream_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_write_stream_logging.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_write_stream_timeout.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_read_write_stream_tracing.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_retry_loop.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_retry_unary_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_rpc_details.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc_auth.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc_logging.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc_timeout.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_read_rpc_tracing.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc_auth.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc_logging.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc_timeout.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/async_streaming_write_rpc_tracing.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/background_threads_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/background_threads_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/completion_queue_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string_protobuf.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string_protobuf.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string_status.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/debug_string_status.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/default_completion_queue_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/default_completion_queue_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/extract_long_running_result.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/extract_long_running_result.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_access_token_authentication.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_access_token_authentication.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_api_key_authentication.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_api_key_authentication.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_async_access_token_cache.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_async_access_token_cache.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_channel_credentials_authentication.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_channel_credentials_authentication.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_impersonate_service_account.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_impersonate_service_account.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_metadata_view.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_opentelemetry.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_opentelemetry.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_request_metadata.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_request_metadata.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_service_account_authentication.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/grpc_service_account_authentication.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/log_wrapper.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/log_wrapper.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/minimal_iam_credentials_stub.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/minimal_iam_credentials_stub.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/populate_grpc_options.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/populate_grpc_options.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/resumable_streaming_read_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/retry_loop.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/routing_matcher.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/setup_context.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_read_rpc.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_read_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_read_rpc_logging.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_read_rpc_tracing.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_write_rpc.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_write_rpc_impl.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_write_rpc_impl.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_write_rpc_logging.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/streaming_write_rpc_tracing.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/time_utils.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/time_utils.h + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/unified_grpc_credentials.cc + ${GOOGLE_CLOUD_CPP_COMMON_DIR}/internal/unified_grpc_credentials.h) +target_link_libraries( + google_cloud_cpp_grpc_utils + PUBLIC absl::function_ref + absl::memory + absl::time + absl::variant + google-cloud-cpp::iam_credentials_v1_iamcredentials_protos + google-cloud-cpp::iam_v1_policy_protos + google-cloud-cpp::longrunning_operations_protos + google-cloud-cpp::iam_v1_iam_policy_protos + google-cloud-cpp::rpc_error_details_protos + google-cloud-cpp::rpc_status_protos + google-cloud-cpp::common + gRPC::grpc++ + gRPC::grpc) +google_cloud_cpp_add_common_options(google_cloud_cpp_grpc_utils) +target_include_directories( + google_cloud_cpp_grpc_utils PUBLIC $ + $) +target_compile_options(google_cloud_cpp_grpc_utils + PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG}) +set_target_properties( + google_cloud_cpp_grpc_utils + PROPERTIES EXPORT_NAME "google-cloud-cpp::grpc_utils" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) +add_library(google-cloud-cpp::grpc_utils ALIAS google_cloud_cpp_grpc_utils) + +#create_bazel_config(google_cloud_cpp_grpc_utils YEAR 2019) + +# # Install the libraries and headers in the locations determined by +# # GNUInstallDirs +# install( +# TARGETS +# EXPORT grpc_utils-targets +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +# COMPONENT google_cloud_cpp_development) + +# # Export the CMake targets to make it easy to create configuration files. +# install( +# EXPORT grpc_utils-targets +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_grpc_utils" +# COMPONENT google_cloud_cpp_development) + +# install( +# TARGETS google_cloud_cpp_grpc_utils +# EXPORT grpc_utils-targets +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +# COMPONENT google_cloud_cpp_runtime +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# COMPONENT google_cloud_cpp_runtime +# NAMELINK_COMPONENT google_cloud_cpp_development +# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +# COMPONENT google_cloud_cpp_development) + +# google_cloud_cpp_install_headers(google_cloud_cpp_grpc_utils +# include/google/cloud) + +# google_cloud_cpp_add_pkgconfig( +# grpc_utils +# "gRPC Utilities for the Google Cloud C++ Client Library" +# "Provides gRPC Utilities for the Google Cloud C++ Client Library." +# "google_cloud_cpp_common" +# "google_cloud_cpp_iam_credentials_v1_iamcredentials_protos" +# "google_cloud_cpp_iam_v1_policy_protos" +# "google_cloud_cpp_iam_v1_iam_policy_protos" +# "google_cloud_cpp_longrunning_operations_protos" +# "google_cloud_cpp_rpc_status_protos" +# "absl_function_ref" +# "absl_strings" +# "absl_time" +# "absl_time_zone" +# "absl_variant" +# "openssl") + +# # Create and install the CMake configuration files. +# configure_file("grpc_utils/config.cmake.in" +# "google_cloud_cpp_grpc_utils-config.cmake" @ONLY) +# write_basic_package_version_file( +# "google_cloud_cpp_grpc_utils-config-version.cmake" +# VERSION ${PROJECT_VERSION} +# COMPATIBILITY ExactVersion) + +# install( +# FILES +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_grpc_utils-config.cmake" +# "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_grpc_utils-config-version.cmake" +# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_grpc_utils" +# COMPONENT google_cloud_cpp_development) + +# function (google_cloud_cpp_grpc_utils_add_test fname labels) +# google_cloud_cpp_add_executable(target "common" "${fname}") +# target_link_libraries( +# ${target} +# PRIVATE google-cloud-cpp::grpc_utils +# google_cloud_cpp_testing_grpc +# google_cloud_cpp_testing +# google-cloud-cpp::common +# absl::variant +# GTest::gmock_main +# GTest::gmock +# GTest::gtest +# gRPC::grpc++ +# gRPC::grpc) +# google_cloud_cpp_add_common_options(${target}) +# add_test(NAME ${target} COMMAND ${target}) +# set_tests_properties(${target} PROPERTIES LABELS "${labels}") +# endfunction () + +# if (BUILD_TESTING) +# include(FindBenchmarkWithWorkarounds) + +# # List the unit tests, then setup the targets and dependencies. +# set(google_cloud_cpp_grpc_utils_unit_tests +# # cmake-format: sort +# completion_queue_test.cc +# connection_options_test.cc +# grpc_error_delegate_test.cc +# grpc_options_test.cc +# internal/async_connection_ready_test.cc +# internal/async_long_running_operation_test.cc +# internal/async_polling_loop_test.cc +# internal/async_read_write_stream_auth_test.cc +# internal/async_read_write_stream_impl_test.cc +# internal/async_read_write_stream_logging_test.cc +# internal/async_read_write_stream_timeout_test.cc +# internal/async_read_write_stream_tracing_test.cc +# internal/async_retry_loop_test.cc +# internal/async_retry_unary_rpc_test.cc +# internal/async_streaming_read_rpc_auth_test.cc +# internal/async_streaming_read_rpc_impl_test.cc +# internal/async_streaming_read_rpc_logging_test.cc +# internal/async_streaming_read_rpc_timeout_test.cc +# internal/async_streaming_read_rpc_tracing_test.cc +# internal/async_streaming_write_rpc_auth_test.cc +# internal/async_streaming_write_rpc_impl_test.cc +# internal/async_streaming_write_rpc_logging_test.cc +# internal/async_streaming_write_rpc_timeout_test.cc +# internal/async_streaming_write_rpc_tracing_test.cc +# internal/background_threads_impl_test.cc +# internal/debug_string_protobuf_test.cc +# internal/debug_string_status_test.cc +# internal/extract_long_running_result_test.cc +# internal/grpc_access_token_authentication_test.cc +# internal/grpc_async_access_token_cache_test.cc +# internal/grpc_channel_credentials_authentication_test.cc +# internal/grpc_opentelemetry_test.cc +# internal/grpc_request_metadata_test.cc +# internal/grpc_service_account_authentication_test.cc +# internal/log_wrapper_test.cc +# internal/minimal_iam_credentials_stub_test.cc +# internal/populate_grpc_options_test.cc +# internal/resumable_streaming_read_rpc_test.cc +# internal/retry_loop_test.cc +# internal/routing_matcher_test.cc +# internal/streaming_read_rpc_logging_test.cc +# internal/streaming_read_rpc_test.cc +# internal/streaming_read_rpc_tracing_test.cc +# internal/streaming_write_rpc_logging_test.cc +# internal/streaming_write_rpc_test.cc +# internal/streaming_write_rpc_tracing_test.cc +# internal/time_utils_test.cc +# internal/unified_grpc_credentials_test.cc) + +# # List the unit tests, then setup the targets and dependencies. +# set(google_cloud_cpp_grpc_utils_integration_tests +# # cmake-format: sort +# internal/grpc_impersonate_service_account_integration_test.cc) + +# # Export the list of unit and integration tests so the Bazel BUILD file can +# # pick them up. +# export_list_to_bazel("google_cloud_cpp_grpc_utils_unit_tests.bzl" +# "google_cloud_cpp_grpc_utils_unit_tests" YEAR "2019") +# export_list_to_bazel( +# "google_cloud_cpp_grpc_utils_integration_tests.bzl" +# "google_cloud_cpp_grpc_utils_integration_tests" YEAR "2021") + +# foreach (fname ${google_cloud_cpp_grpc_utils_unit_tests}) +# google_cloud_cpp_grpc_utils_add_test("${fname}" "") +# endforeach () + +# # TODO(#12485) - remove dependency on bigtable in this integration test. +# if (NOT bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE) +# list(REMOVE_ITEM google_cloud_cpp_grpc_utils_integration_tests +# "internal/grpc_impersonate_service_account_integration_test.cc") +# endif () + +# foreach (fname ${google_cloud_cpp_grpc_utils_integration_tests}) +# google_cloud_cpp_add_executable(target "common" "${fname}") +# target_link_libraries( +# ${target} +# PRIVATE google-cloud-cpp::grpc_utils +# google_cloud_cpp_testing_grpc +# google_cloud_cpp_testing +# google-cloud-cpp::common +# google-cloud-cpp::iam_credentials_v1_iamcredentials_protos +# absl::variant +# GTest::gmock_main +# GTest::gmock +# GTest::gtest +# gRPC::grpc++ +# gRPC::grpc) +# google_cloud_cpp_add_common_options(${target}) +# add_test(NAME ${target} COMMAND ${target}) +# set_tests_properties(${target} PROPERTIES LABELS +# "integration-test-production") +# # TODO(12485) - remove dep on bigtable_protos +# if (bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE) +# target_link_libraries(${target} +# PRIVATE google-cloud-cpp::bigtable_protos) +# endif () +# endforeach () + +# set(google_cloud_cpp_grpc_utils_benchmarks # cmake-format: sortable +# completion_queue_benchmark.cc) + +# # Export the list of benchmarks to a .bzl file so we do not need to maintain +# # the list in two places. +# export_list_to_bazel("google_cloud_cpp_grpc_utils_benchmarks.bzl" +# "google_cloud_cpp_grpc_utils_benchmarks" YEAR "2020") + +# # Generate a target for each benchmark. +# foreach (fname ${google_cloud_cpp_grpc_utils_benchmarks}) +# google_cloud_cpp_add_executable(target "common" "${fname}") +# add_test(NAME ${target} COMMAND ${target}) +# target_link_libraries( +# ${target} +# PRIVATE google-cloud-cpp::grpc_utils google-cloud-cpp::common +# benchmark::benchmark_main) +# google_cloud_cpp_add_common_options(${target}) +# endforeach () +# endif () diff --git a/contrib/google-cloud-cpp-cmake/googleapis/e60db19f11f94175ac682c5898cce0f77cc508ea.tar.gz b/contrib/google-cloud-cpp-cmake/googleapis/e60db19f11f94175ac682c5898cce0f77cc508ea.tar.gz new file mode 100644 index 00000000000..07c1a189d9b Binary files /dev/null and b/contrib/google-cloud-cpp-cmake/googleapis/e60db19f11f94175ac682c5898cce0f77cc508ea.tar.gz differ diff --git a/contrib/update-submodules.sh b/contrib/update-submodules.sh index 072d7a5dc2f..e496f905356 100755 --- a/contrib/update-submodules.sh +++ b/contrib/update-submodules.sh @@ -24,7 +24,7 @@ git config --file .gitmodules --get-regexp '.*path' | sed 's/[^ ]* //' | xargs - # We don't want to depend on any third-party CMake files. # To check it, find and delete them. grep -o -P '"contrib/[^"]+"' .gitmodules | - grep -v -P 'contrib/(llvm-project|google-protobuf|grpc|abseil-cpp|corrosion|aws-crt-cpp)' | + grep -v -P 'contrib/(llvm-project|google-protobuf|grpc|abseil-cpp|corrosion|aws-crt-cpp|google-cloud-cpp)' | xargs -I@ find @ \ -'(' -name 'CMakeLists.txt' -or -name '*.cmake' -')' -and -not -name '*.h.cmake' \ -delete diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3627d760d4c..55228b2d1ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -639,6 +639,10 @@ if (TARGET ch_rust::skim) dbms_target_link_libraries(PUBLIC ch_rust::skim) endif() +if (TARGET ch_contrib::google_cloud_cpp) + dbms_target_link_libraries(PUBLIC ch_contrib::google_cloud_cpp) +endif() + if (ENABLE_TESTS) macro (grep_gtest_sources BASE_DIR DST_VAR) # Cold match files that are not in tests/ directories