NOTICE: This repo will be merging with the googleapis/google-cloud-cpp monorepo in 60 days, around June 1, 2020. This change should not break any users who are using a released version. We expect this new monorepo organization to be better for our existing and new customers going forward. Please see googleapis/google-cloud-cpp#3612 for more details.
This repository contains common types and functions used by the Google Cloud C++ Client Libraries.
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 |
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 | 2.0.0 |
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 |
---|---|
protobuf | v3.11.3 |
gRPC | v1.26.x |
libcurl | 7.47.0 |
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 the development tools needed to compile the project:
sudo dnf makecache && \
sudo dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \
zlib-devel
Install the development tools and OpenSSL. The development tools distributed
with CentOS (notably CMake) are too old to build the
google-cloud-cpp-common
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
First install the development tools.
apt-get update && \
apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ca-certificates cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \
pkg-config tar wget zlib1g-dev
First install the development tools.
apt-get update && \
apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential cmake ca-certificates git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev m4 make \
pkg-config tar wget zlib1g-dev
Install the minimal development tools:
sudo dnf makecache && \
sudo dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \
zlib-devel
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
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
Install the minimal development tools:
apt-get update && \
apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential cmake ca-certificates git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \
pkg-config tar wget zlib1g-dev
Install the minimal development tools:
apt-get update && \
apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential cmake ca-certificates git gcc g++ m4 cmake \
libcurl4-openssl-dev libssl-dev make \
pkg-config tar wget zlib1g-dev
brew install curl cmake libressl c-ares
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.
To build all available libraries and run the tests, run the following commands after cloning this repo:
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.
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.
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
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 ^
gtest:x64-windows-static ^
googleapis: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.
By default google-cloud-cpp
downloads and compiles all its dependencies.
The default configuration disables the install
target, because the version of
the dependencies downloaded by google-cloud-cpp
may conflict with the versions
already installed in your system, or with the versions you want to use for
development.
To install google-cloud-cpp
you must first install all its dependencies. Then
you must configure google-cloud-cpp
to find these dependencies, and install
it.
Installing the dependencies themselves may be as simple as using the package
manager for your platform, or may require manually downloading, compiling, and
installing said dependencies. The INSTALL.md file describes how
to successfully install google-cloud-cpp
on several platforms.
Alternatively, if you prefer to use google-cloud-cpp
as a submodule, you can
use the CMake command
add_subdirectory()
to include google-cloud-cpp
directly in your CMake project.
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.
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.
Apache 2.0; see LICENSE
for details.