Skip to content

fbrmedia/google-cloud-cpp

 
 

Repository files navigation

Google Cloud Platform C++ Client Libraries

C++ Idiomatic Clients for Google Cloud Platform services.

Core Results: Kokoro CI status Kokoro CI status Kokoro CI status Codecov Coverage status

Test Install Instructions: Kokoro install centos-7 status Kokoro install debian-stretch status Kokoro install fedora status Kokoro install opensuse-tumbleweed status Kokoro install opensuse-leap status Kokoro install ubuntu-bionic status Kokoro install ubuntu-xenial status

Special Builds: Kokoro CI status Kokoro CI status Kokoro CI status Kokoro CI status Kokoro CI status Kokoro CI status Kokoro CI status Kokoro CI status Travis CI status Kokoro CI status

This library supports the following Google Cloud Platform services with clients at the GA quality level:

Table of Contents

Requirements

Compiler

The Google Cloud C++ libraries are tested with the following compilers:

Compiler Minimum Version
GCC 4.8
Clang 3.8
MSVC++ 14.1
Apple Clang 8.1

Build Tools

The Google Cloud C++ Client Libraries can be built with CMake or Bazel. The minimal versions of these tools we test with are:

Tool Minimum Version
CMake 3.5
Bazel 0.24.0

Libraries

The libraries also depend on gRPC, libcurl, and the dependencies of those libraries. The Google Cloud C++ Client libraries are tested with the following versions of these dependencies:

Library Minimum version Notes
gRPC v1.16.x
libcurl 7.47.0 7.64.0 has known problems for multi-threaded applications

Tests

Integration tests at times use the Google Cloud SDK. The integration tests run against the latest version of the SDK on each commit and PR.

Install Dependencies

CentOS (7)

Kokoro install centos-7 status

Install the development tools and OpenSSL. The development tools distributed with CentOS (notably CMake) are too old to build the google-cloud-cpp project. We recommend you install cmake3 from Software Collections.

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y centos-release-scl
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum makecache && \
sudo yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \
        make openssl-devel pkgconfig tar wget which zlib-devel
sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake && sudo ln -sf /usr/bin/ctest3 /usr/bin/ctest

Debian (Stretch)

Kokoro install debian-stretch status

First install the development tools.

sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
        libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev make \
        pkg-config tar wget zlib1g-dev

Fedora (30)

Kokoro install fedora status

Install the minimal development tools:

sudo dnf makecache && \
sudo dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \
        zlib-devel

openSUSE (Tumbleweed)

Kokoro install opensuse-tumbleweed status

Install the minimal development tools:

sudo zypper refresh && \
sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
        libcurl-devel libopenssl-devel make tar wget zlib-devel

openSUSE (Leap)

Kokoro install opensuse-leap status

Install the minimal development tools:

sudo zypper refresh && \
sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
        libcurl-devel libopenssl-devel make tar wget

Ubuntu (18.04 - Bionic Beaver)

Kokoro install ubuntu-bionic status

Install the minimal development tools:

sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
        libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \
        pkg-config tar wget zlib1g-dev

Ubuntu (16.04 - Xenial Xerus)

Kokoro install ubuntu-xenial status

Install the minimal development tools:

sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
        libcurl4-openssl-dev libssl-dev make \
        pkg-config tar wget zlib1g-dev

macOS (using brew)

brew install curl cmake libressl c-ares

Windows (using vcpkg)

If you are already using vcpkg, a package manager from Microsoft, you can download and compile google-cloud-cpp in a single step:

.\vcpkg.exe install google-cloud-cpp:x64-windows-static

This command will also print out instructions on how to use the library from your MSBuild or CMake-based projects. We try to keep the version of google-cloud-cpp included with vcpkg up-to-date, our practice is to submit a PR to update the version in vcpkg after each release of google-cloud-cpp.

See below for instructions to compile the code yourself.

Build

To build all available libraries and run the tests, run the following commands after cloning this repo:

Linux

To automatically download the dependencies and compile the libraries and examples you can use the CMake super build:

# Add -DBUILD_TESTING=OFF to disable tests
cmake -Hsuper -Bcmake-out

# Adjust the number of threads used by modifying parameter for `-j 4`
# following command will also invoke ctest at the end
cmake --build cmake-out -- -j 4

You will find compiled binaries in cmake-out/ respective to their source paths.

If you prefer to compile against installed versions of the dependencies please check the INSTALL.md file.

If you prefer to install dependencies at a custom location and want to compile against it, please check the instruction at build with CMake.

macOS

export OPENSSL_ROOT_DIR=/usr/local/opt/libressl
# Add -DBUILD_TESTING=OFF to disable tests
cmake -Hsuper -Bcmake-out

# Adjust the number of threads used by modifying parameter for `-j 4`
cmake --build cmake-out -- -j 4

# Verify build by running tests
(cd cmake-out && ctest --output-on-failure)

You will find compiled binaries in cmake-out/ respective to their source paths. You will find compiled binaries in cmake-out/ respective to their source paths.

If you prefer to compile against installed versions of the dependencies please check the INSTALL.md file.

Problems with /usr/include on macOS Mojave (and later).

If you see the following error:

CMake Error in google/cloud/storage/CMakeLists.txt:
  Imported target "CURL::libcurl" includes non-existent path

    "/usr/include"

you need to update your Xcode version. Install the package located at /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

and run:

xcode-select -s /Library/Developer/CommandLineTools

Windows

If you prefer to manually compile on Windows the following instructions should work, though there is a lot more variability on this platform. We welcome suggestions to make this an easier process.

We will assume that you have installed CMake, Ninja, and "Microsoft Visual Studio 2017". If you have not, install Chocolatey using this command as the administrator:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command ^
 "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Then you can easily install the necessary development tools.

choco install -y cmake cmake.portable ninja visualstudio2017community
choco install -y visualstudio2017-workload-nativedesktop
choco install -y microsoft-build-tools
choco install -y git

Then clone and compile vcpkg:

set SOURCE="%cd%"
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat

Use vcpkg to download and install google-cloud-cpp's dependencies:

.\vcpkg.exe install openssl:x64-windows-static ^
    grpc:x64-windows-static ^
    curl:x64-windows-static ^
    gtest:x64-windows-static ^
    googleapis:x64-windows-static ^
    crc32c:x64-windows-static
.\vcpkg.exe integrate install

Now clone google-cloud-cpp:

cd ..
git clone https://github.com/googleapis/google-cloud-cpp.git
cd google-cloud-cpp

Load the environment variables needed to use Microsoft Visual Studio:

call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

Use CMake to create the build files:

cmake -H. -Bcmake-out -GNinja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_TOOLCHAIN_FILE="%SOURCE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
    -DVCPKG_TARGET_TRIPLET=x64-windows-static ^
    -DCMAKE_C_COMPILER=cl.exe ^
    -DCMAKE_CXX_COMPILER=cl.exe ^
    -DCMAKE_MAKE_PROGRAM=ninja

And compile the code:

cmake --build cmake-out

Finally, verify the unit tests pass:

cd cmake-out
ctest --output-on-failure

You will find compiled binaries in cmake-out\ respective to their source directories.

Installing google-cloud-cpp using CMake

The default CMake builds for google-cloud-cpp assume that all the necessary dependencies are installed in your system. Installing the dependencies may be as simple as using the package manager for your platform, or may require manually downloading, compiling, and installing a number of additional libraries. The INSTALL.md file describes how to successfully install google-cloud-cpp on several platforms.

If installing all the dependencies is not an option for you, consider using a CMake super build, an example of such can be found in the super/ directory.

Alternatively, you may be able to use google-cloud-cpp as a git submodule of your source, and then use CMake's add_subdirectory() command to compile the project as part of your build. However, this is not a configuration that we test routinely and/or we recommend for teams working on large projects.

Versioning

Please note that the Google Cloud C++ client libraries do not follow Semantic Versioning.

GA: Libraries defined at a GA quality level are expected to be stable and any backwards-incompatible changes will be noted in the documentation. Major changes to the API will signaled by changing major version number (e.g. 1.x.y -> 2.0.0).

Beta: Libraries defined at a Beta quality level are expected to be mostly stable and we're working towards their release candidate. We will address issues and requests with a higher priority.

Alpha: Libraries defined at an Alpha quality level are still a work-in-progress and are more likely to get backwards-incompatible updates. Additionally, it's possible for Alpha libraries to get deprecated and deleted before ever being promoted to Beta or GA.

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

Google Cloud Client Library for C++

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 86.9%
  • Shell 4.9%
  • Python 4.1%
  • CMake 3.0%
  • Go 0.4%
  • Dockerfile 0.2%
  • Other 0.5%