Skip to content

derekmauro/google-cloud-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Cloud Platform C++ Client Libraries

GCB CI status GCB CI status GHA Codecov Coverage status

This repository contains idiomatic C++ client libraries for the following Google Cloud Platform services.

Please check the CHANGELOG for important announcements and upcoming changes.

Quickstart

Each library (see below) contains a directory named quickstart/ that's intended to help you get up and running in a matter of minutes. This quickstart/ directory contains a minimal "Hello World" program demonstrating how to use the library, along with minimal build files for common build systems, such as CMake and Bazel.

As an example, the following code snippet, taken from Google Cloud Storage, should give you a sense of what it's like to use one of these C++ libraries.

#include "google/cloud/storage/client.h"
#include <iostream>

int main(int argc, char* argv[]) {
  if (argc != 2) {
    std::cerr << "Missing bucket name.\n";
    std::cerr << "Usage: quickstart <bucket-name>\n";
    return 1;
  }
  std::string const bucket_name = argv[1];

  // Create aliases to make the code easier to read.
  namespace gcs = ::google::cloud::storage;

  // Create a client to communicate with Google Cloud Storage. This client
  // uses the default configuration for authentication and project id.
  auto client = gcs::Client();

  auto writer = client.WriteObject(bucket_name, "quickstart.txt");
  writer << "Hello World!";
  writer.Close();
  if (!writer.metadata()) {
    std::cerr << "Error creating object: " << writer.metadata().status()
              << "\n";
    return 1;
  }
  std::cout << "Successfully created object: " << *writer.metadata() << "\n";

  auto reader = client.ReadObject(bucket_name, "quickstart.txt");
  if (!reader) {
    std::cerr << "Error reading object: " << reader.status() << "\n";
    return 1;
  }

  std::string contents{std::istreambuf_iterator<char>{reader}, {}};
  std::cout << contents << "\n";

  return 0;
}

GA Libraries

See each library's README.md file for more information about:

  • Where to find the documentation for the library and the service.
  • How to get started using the library.
  • How to incorporate the library into your build system.
  • The library's support status if not Generally Available (GA); unless noted in a library's README.md, these libraries are all GA and supported by Google.
Expand to see the full list of GA libraries

Building and Installing

This is a quickstart guide for developers wanting to compile the libraries and run the examples included with the libraries.

  • Packaging maintainers or developers who prefer to install the library in a fixed directory (such as /usr/local or /opt) should consult the packaging guide.
  • Developers who prefer using a package manager such as vcpkg, or Conda, should follow the instructions for their package manager.
  • Developers wanting to use the libraries as part of a larger CMake or Bazel project should consult the quickstart guides for the library or libraries they want to use.
  • Developers wanting to compile the library just to run some examples or tests should read the current document.
  • Contributors and developers to google-cloud-cpp should consult the guide to set up a development workstation.

Building with Bazel

This library requires Bazel >= 6.0. From the top-level directory, run the usual commands.

bazel build //...

Building with CMake

This library requires CMake >= 3.10. If you are planning to install the libraries please consult the packaging guide, these instructions will NOT produce artifacts that you can put in /usr/local, or share with your colleagues.

From the top-level directory of google-cloud-cpp run these commands:

git -C $HOME clone https://github.com/microsoft/vcpkg.git
env VCPKG_ROOT=$HOME/vcpkg $HOME/vcpkg/bootstrap-vcpkg.sh
cmake -S . -B cmake-out/ -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build cmake-out -- -j $(nproc)

The binary artifacts, such as examples, will be placed in cmake-out/.

Support

  • This project follows Google's Foundational C++ Support Policy, which is summarized in the Foundational C++ Support Matrix.
    • Language Version (>= C++14).
    • Operating Systems: Windows, macOS, and Linux.
    • Build Systems: Bazel (>= 6.0), CMake (>= 3.10).
    • Compilers: GCC (>= 7.3), Clang (>= 6.0), MSVC (>= 2019), Apple Clang (>= 12).
  • This project uses dependencies described in doc/packaging.md.
  • This project works with or without exceptions enabled.
  • This project cuts monthly releases with detailed release notes.

Public API and API Breaking Changes

This project follows Google's OSS Library Breaking Change Policy.

In general, we avoid making backwards incompatible changes to our public API. Sometimes such changes yield benefits to our customers, in the form of better performance, easier-to-understand APIs, and/or more consistent APIs across services. When these benefits warrant it, we will:

  • Announce these changes prominently in our CHANGELOG.md file and in the affected release's notes.
  • Increase the major version for google-cloud-cpp.

Nevertheless, though we take commercially reasonable efforts to prevent this, it is possible that backwards incompatible changes go undetected and, therefore, undocumented. We apologize if this is the case and welcome feedback or bug reports to rectify the problem.

Contact us

Contributing changes

See CONTRIBUTING.md for details on how to contribute to this project, including how to build and test your changes as well as how to properly format your code.

Licensing

Apache 2.0; see LICENSE for details.

About

C++ Client Libraries for Google Cloud Services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.5%
  • Starlark 0.9%
  • CMake 0.8%
  • Shell 0.3%
  • Makefile 0.2%
  • C 0.2%
  • Other 0.1%