From 1b8c00cf98afc5bf964ab5a1430522f191237abb Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Tue, 5 Oct 2021 19:03:03 -0400 Subject: [PATCH] [google-cloud-cpp] migrate to vcpkg_cmake_config_fixup() (#20521) * [google-cloud-cpp] migrate to vcpkg_cmake_config_fixup() * Address review comments --- ports/google-cloud-cpp/portfile.cmake | 45 +++++++++++++++++++++++++-- ports/google-cloud-cpp/vcpkg.json | 5 +++ versions/baseline.json | 2 +- versions/g-/google-cloud-cpp.json | 5 +++ 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake index 06ff7860a6..cc29525cc8 100644 --- a/ports/google-cloud-cpp/portfile.cmake +++ b/ports/google-cloud-cpp/portfile.cmake @@ -31,9 +31,50 @@ vcpkg_cmake_configure( vcpkg_cmake_install() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) +foreach(feature IN LISTS FEATURES) + set(config_path "lib/cmake/google_cloud_cpp_${feature}") + # Most features get their own package in `google-cloud-cpp`. + # The exceptions are captured by this `if()` command, basically + # things like `core` and `experimental-storage-grpc` are skipped. + if(NOT IS_DIRECTORY "${CURRENT_PACKAGES_DIR}/${config_path}") + continue() + endif() + vcpkg_cmake_config_fixup(PACKAGE_NAME "google_cloud_cpp_${feature}" + CONFIG_PATH "${config_path}" + DO_NOT_DELETE_PARENT_CONFIG_PATH) +endforeach() +# These packages are automatically installed depending on what features are +# enabled. +foreach(suffix common googleapis grpc_utils) + set(config_path "lib/cmake/google_cloud_cpp_${suffix}") + if(NOT IS_DIRECTORY "${CURRENT_PACKAGES_DIR}/${config_path}") + continue() + endif() + vcpkg_cmake_config_fixup(PACKAGE_NAME "google_cloud_cpp_${suffix}" + CONFIG_PATH "${config_path}" + DO_NOT_DELETE_PARENT_CONFIG_PATH) +endforeach() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +# These packages are only for backwards compability. The google-cloud-cpp team +# is planning to remove them around 2022-02-15. +foreach(package + googleapis + bigtable_client + pubsub_client + spanner_client + storage_client) + set(config_path "lib/cmake/google_cloud_cpp_${suffix}") + if(NOT IS_DIRECTORY "${config_path}") + continue() + endif() + vcpkg_cmake_config_fixup(PACKAGE_NAME "${package}" + CONFIG_PATH "${config_path}" + DO_NOT_DELETE_PARENT_CONFIG_PATH) +endforeach() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" + "${CURRENT_PACKAGES_DIR}/debug/lib/cmake" + "${CURRENT_PACKAGES_DIR}/debug/share") file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/google-cloud-cpp/vcpkg.json b/ports/google-cloud-cpp/vcpkg.json index 35cbf153b0..5b3f62ef42 100644 --- a/ports/google-cloud-cpp/vcpkg.json +++ b/ports/google-cloud-cpp/vcpkg.json @@ -1,6 +1,7 @@ { "name": "google-cloud-cpp", "version": "1.32.0", + "port-version": 1, "description": "C++ Client Libraries for Google Cloud Platform APIs.", "homepage": "https://github.com/googleapis/google-cloud-cpp", "license": "Apache-2.0", @@ -10,6 +11,10 @@ { "name": "vcpkg-cmake", "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true } ], "default-features": [ diff --git a/versions/baseline.json b/versions/baseline.json index a4c57e3e9a..e7fd77ee69 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2474,7 +2474,7 @@ }, "google-cloud-cpp": { "baseline": "1.32.0", - "port-version": 0 + "port-version": 1 }, "google-cloud-cpp-common": { "baseline": "alias", diff --git a/versions/g-/google-cloud-cpp.json b/versions/g-/google-cloud-cpp.json index ea0a234d27..94dbefbdc3 100644 --- a/versions/g-/google-cloud-cpp.json +++ b/versions/g-/google-cloud-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2b53c52b812f1d7fe8ada0a6d938b047b5a3dbd2", + "version": "1.32.0", + "port-version": 1 + }, { "git-tree": "d138daefe227de160954ecdce23178fa659edb36", "version": "1.32.0",