forked from conda-forge/staged-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request conda-forge#24841 from coryan/feat-shard-google-cl…
…oud-cpp-pr3 Add `google-cloud-cpp-compute` feedstock
- Loading branch information
Showing
9 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@echo on | ||
|
||
:: CMake does not like paths with \ characters | ||
set LIBRARY_PREFIX=%LIBRARY_PREFIX:\=/% | ||
|
||
cmake -G "Ninja" ^ | ||
-S . -B build ^ | ||
-DGOOGLE_CLOUD_CPP_ENABLE=compute ^ | ||
-DGOOGLE_CLOUD_CPP_USE_INSTALLED_COMMON=ON ^ | ||
-DBUILD_TESTING=OFF ^ | ||
-DBUILD_SHARED_LIBS=OFF ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DCMAKE_CXX_STANDARD=17 ^ | ||
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ | ||
-DCMAKE_MODULE_PATH="%LIBRARY_PREFIX%/lib/cmake" ^ | ||
-DCMAKE_INSTALL_LIBDIR=lib ^ | ||
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF ^ | ||
-DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
cmake --build build --config Release | ||
if %ERRORLEVEL% neq 0 exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export OPENSSL_ROOT_DIR=$PREFIX | ||
|
||
if [[ "${target_platform}" == osx-* ]]; then | ||
# See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk | ||
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" | ||
fi | ||
|
||
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ'): Building compute" | ||
cmake ${CMAKE_ARGS} \ | ||
-GNinja -S . -B build \ | ||
-DGOOGLE_CLOUD_CPP_ENABLE=compute \ | ||
-DGOOGLE_CLOUD_CPP_USE_INSTALLED_COMMON=ON \ | ||
-DBUILD_TESTING=OFF \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DOPENSSL_ROOT_DIR=$PREFIX \ | ||
-DCMAKE_BUILD_TYPE=release \ | ||
-DCMAKE_CXX_STANDARD=17 \ | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | ||
-DCMAKE_INSTALL_LIBDIR=lib \ | ||
-DProtobuf_PROTOC_EXECUTABLE=$BUILD_PREFIX/bin/protoc \ | ||
-DGOOGLE_CLOUD_CPP_GRPC_PLUGIN_EXECUTABLE=$BUILD_PREFIX/bin/grpc_cpp_plugin \ | ||
-DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF | ||
cmake --build build | ||
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ'): DONE - Building compute" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# The default at [1] is 10.9 and abseil does not compile with that | ||
# [1]: https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/main/recipe/conda_build_config.yaml | ||
MACOSX_DEPLOYMENT_TARGET: | ||
- 10.13 # [osx and x86_64] |
16 changes: 16 additions & 0 deletions
16
recipes/google-cloud-cpp-compute/install-libgoogle-cloud.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo on | ||
|
||
:: Once DLLs are working, we should install the non-devel packages using | ||
:: cmake --install .b --component google_cloud_cpp_runtime | ||
:: and the devel packages using | ||
:: cmake --install .b --component google_cloud_cpp_development | ||
|
||
if [%PKG_NAME%] == [libgoogle-cloud-compute-devel] ( | ||
cmake --install build | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
) else if [%PKG_NAME%] == [libgoogle-cloud-compute] ( | ||
@REM TODO: fix when DLL support comes along | ||
) else ( | ||
@ECHO Unknown package name %PKG_NAME% | ||
exit 1 | ||
) |
16 changes: 16 additions & 0 deletions
16
recipes/google-cloud-cpp-compute/install-libgoogle-cloud.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
case "${PKG_NAME}" in | ||
libgoogle-cloud-*-devel) | ||
cmake --install build --component google_cloud_cpp_development | ||
;; | ||
libgoogle-cloud-*) | ||
cmake --install build --component google_cloud_cpp_runtime | ||
;; | ||
*) | ||
echo Unknown package name "${PKG_NAME}" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{% set version = "2.17.0" %} | ||
|
||
package: | ||
name: google-cloud-cpp-compute | ||
version: {{ version }} | ||
|
||
source: | ||
url: https://github.com/googleapis/google-cloud-cpp/archive/v{{ version }}.tar.gz | ||
sha256: 8cb87ec2947e691a7f8631877e78453bcfda51b3d3cd4940794a376741888d37 | ||
patches: | ||
# This is an upstream fix to allow sharding google/cloud/oauth2 | ||
- patches/0001-Backport-12911-from-upstream.patch | ||
|
||
build: | ||
number: 0 | ||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
- libgrpc | ||
- libprotobuf | ||
host: | ||
- libgoogle-cloud-devel =={{ version }} | ||
- libabseil | ||
- libcurl | ||
- libgrpc | ||
- libprotobuf | ||
- openssl | ||
- nlohmann_json | ||
- zlib # Needed by gRPC | ||
|
||
outputs: | ||
- name: libgoogle-cloud-compute | ||
script: install-libgoogle-cloud.sh # [unix] | ||
script: install-libgoogle-cloud.bat # [win] | ||
build: | ||
run_exports: | ||
- libgoogle-cloud =={{ version }} | ||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
host: | ||
- libgoogle-cloud-devel =={{ version }} | ||
- libabseil | ||
- libprotobuf | ||
test: | ||
commands: | ||
# `google-cloud-cpp::compute` is an interface library, it has no | ||
# binary artifacts. We use `compute_instances` as a canary for the | ||
# almost 100 artifacts created by the `compute` feature. | ||
# | ||
# presence of shared library (unix) | ||
- test -f $PREFIX/lib/libgoogle_cloud_cpp_compute_instances.{{ version }}.dylib # [osx] | ||
- test -f $PREFIX/lib/libgoogle_cloud_cpp_compute_instances.so.{{ version }} # [linux] | ||
|
||
# absence of static library (windows). It belongs only in devel package. | ||
- if exist %LIBRARY_LIB%\google_cloud_cpp_compute_instances.lib exit 1 # [win] | ||
|
||
# absence of headers (they belong in devel package) | ||
- test ! -f $PREFIX/include/google/cloud/compute/instances/v1/instances_client.h # [unix] | ||
- if exist %LIBRARY_INC%\google\cloud\compute\instances\v1\instances_client.h exit 1 # [win] | ||
|
||
# absence of metadata for CMake & pkgconfig (belongs in devel package) | ||
- test ! -f $PREFIX/lib/pkgconfig/google_cloud_cpp_compute_instances.pc # [unix] | ||
- test ! -f $PREFIX/lib/cmake/google_cloud_cpp_common/google_cloud_cpp_compute_instances-config.cmake # [unix] | ||
- if exist %LIBRARY_LIB%\cmake\google_cloud_cpp_common\google_cloud_cpp_compute_instances-config.cmake exit 1 # [win] | ||
|
||
- name: libgoogle-cloud-compute-devel | ||
script: install-libgoogle-cloud.sh # [unix] | ||
script: install-libgoogle-cloud.bat # [win] | ||
build: | ||
run_exports: | ||
# patch versions guaranteed to be ABI-compatible, see | ||
# https://github.com/googleapis/google-cloud-cpp/blob/main/doc/adr/2023-05-03-patch-releases-are-ABI-compatible.md | ||
- {{ pin_subpackage("libgoogle-cloud-compute", max_pin="x.x") }} | ||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
host: | ||
- libgoogle-cloud-devel =={{ version }} | ||
run: | ||
- {{ pin_subpackage("libgoogle-cloud-compute", exact=True) }} | ||
test: | ||
commands: | ||
# build an example | ||
- ./run_test_feature.sh # [unix] | ||
- ./run_test_feature.bat # [win] | ||
requires: | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
- libgoogle-cloud-devel =={{ version }} | ||
files: | ||
- run_test_feature.sh | ||
- run_test_feature.bat | ||
source_files: | ||
- google/cloud/compute/quickstart/*.cc | ||
- google/cloud/compute/quickstart/CMakeLists.txt | ||
|
||
about: | ||
home: https://github.com/googleapis/google-cloud-cpp | ||
license: Apache-2.0 | ||
license_family: Apache | ||
license_file: LICENSE | ||
summary: Google Cloud Client Library for C++ | ||
|
||
extra: | ||
feedstock-name: google-cloud-cpp-core | ||
recipe-maintainers: | ||
- coryan | ||
- conda-forge/google-cloud-cpp |
23 changes: 23 additions & 0 deletions
23
recipes/google-cloud-cpp-compute/patches/0001-Backport-12911-from-upstream.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
From 379266c74e0a3fce4e48b4788ad32508b02ec626 Mon Sep 17 00:00:00 2001 | ||
From: Carlos O'Ryan <[email protected]> | ||
Date: Wed, 20 Dec 2023 16:57:10 +0000 | ||
Subject: [PATCH] Backport #12911 from upstream | ||
|
||
--- | ||
cmake/GoogleCloudCppFeatures.cmake | 3 --- | ||
1 file changed, 3 deletions(-) | ||
|
||
diff --git a/cmake/GoogleCloudCppFeatures.cmake b/cmake/GoogleCloudCppFeatures.cmake | ||
index a69cd85a..e86b9d03 100644 | ||
--- a/cmake/GoogleCloudCppFeatures.cmake | ||
+++ b/cmake/GoogleCloudCppFeatures.cmake | ||
@@ -361,9 +361,6 @@ macro (google_cloud_cpp_enable_cleanup) | ||
OR (sql IN_LIST GOOGLE_CLOUD_CPP_ENABLE) | ||
OR (generator IN_LIST GOOGLE_CLOUD_CPP_ENABLE)) | ||
set(GOOGLE_CLOUD_CPP_ENABLE_REST ON) | ||
- # Backwards compatibility. In the original release of `oauth2` we | ||
- # automatically compiled the library if REST was enabled | ||
- list(APPEND GOOGLE_CLOUD_CPP_ENABLE oauth2) | ||
endif () | ||
|
||
list(REMOVE_DUPLICATES GOOGLE_CLOUD_CPP_ENABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo on | ||
setlocal EnableDelayedExpansion | ||
|
||
:: CMake does not like paths with \ characters | ||
set LIBRARY_PREFIX=%LIBRARY_PREFIX:\=/% | ||
|
||
:: Remove any libgoogle-cloud- prefix and any -devel suffix from PKG_NAME to | ||
:: find the feature name. | ||
set FEATURE=%PKG_NAME:libgoogle-cloud-=% | ||
set FEATURE=%FEATURE:-devel=% | ||
|
||
cmake -GNinja ^ | ||
-S "google/cloud/%FEATURE%/quickstart" -B build ^ | ||
-DCMAKE_CXX_STANDARD=17 ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ | ||
-DCMAKE_MODULE_PATH="%LIBRARY_PREFIX%/lib/cmake" | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
cmake --build build --config Release | ||
if %ERRORLEVEL% neq 0 exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Stop on first error | ||
set -euo pipefail | ||
|
||
if [[ "${target_platform}" == osx-* ]]; then | ||
# as in build.sh | ||
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" | ||
fi | ||
|
||
# Remove any libgoogle-cloud- prefix and any -devel suffix from PKG_NAME to | ||
# find the feature name. | ||
feature=${PKG_NAME/#libgoogle-cloud-/} | ||
feature=${feature/%-devel/} | ||
|
||
cmake -GNinja \ | ||
-S "google/cloud/${feature}/quickstart" -B build \ | ||
-DCMAKE_CXX_STANDARD=17 \ | ||
-DCMAKE_PREFIX_PATH="$PREFIX" \ | ||
-DCMAKE_MODULE_PATH="$PREFIX/lib/cmake" | ||
cmake --build build |