Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Use only find_package to find dependencies. #2967

Merged
merged 18 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"EXCLUDE_FROM_ALL": 1,
"INSTALL_COMMAND": "+",
"INSTALL_DIR": 1,
"TEST_COMMAND": "+",
"LOG_BUILD": 1,
"LOG_CONFIGURE": 1,
"LOG_DOWNLOAD": 1,
Expand Down
32 changes: 7 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,32 +101,14 @@ if ("${GOOGLE_CLOUD_CPP_ENABLE_CCACHE}")
endif ()

# The default source for dependencies.
set(GOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER "external" CACHE STRING "[===[
How to find the dependencies for google-cloud-cpp.

The Google Cloud C++ client libraries have several external dependencies,
notably gRPC, libcurl, OpenSSL, and a few others.

This configuration option controls how are these dependencies are found. It can
be set to:

* external: use CMake's `ExternalProject` to download and compile the
dependencies. This is the recommended configuration for development, as it
isolates your build from the system configuration.

* package: use CMake's `find_package()` to find the dependencies. This is the
recommended configuration for compiling and installing google-cloud-cpp.

To experiment with different configurations developers can override the setting
for one or more dependencies. For example, you could set
`GOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER` to `package` and
`GOOGLE_CLOUD_CPP_GMOCK_PROVIDER` to `external`. These overrides are intended
for development and testing of new dependencies and are not recommended for
production use.
]===]")
set(GOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER "unused"
CACHE STRING "This option is no longer used.")

set_property(CACHE GOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER
PROPERTY STRINGS "external" "package")
PROPERTY STRINGS
"external"
"package"
"unused")

# Generate docs with relative URLs matching with the directory structure on
# googleapis.dev hositng.
Expand Down Expand Up @@ -156,7 +138,7 @@ add_custom_target(google-cloud-cpp-dependencies)
# Add gRPC and protobuf targets as submodules or packages, depending on the
# configuration. This should happen before enable_testing(), because we are not
# interested in compiling and running the gRPC tests.
include(IncludeGrpc)
find_package(gRPC)

# Enable testing in this directory so we can do a top-level `make test`. This
# also includes the BUILD_TESTING option, which is on by default.
Expand Down
179 changes: 153 additions & 26 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ CMake support files, then compiling and installing the libraries
requires two commands:

```bash
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package
cmake -H. -Bcmake-out
cmake --build cmake-out --target install
```

Expand Down Expand Up @@ -210,15 +209,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

We can now compile and install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -281,15 +296,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

We can now compile and install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -412,15 +443,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

We can now compile and install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -510,15 +557,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

Finally we can install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -632,15 +695,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

Finally we can install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -799,16 +878,32 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

We can now compile and install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl" \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
-DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl"
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -905,15 +1000,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

Finally we can install `google-cloud-cpp`.

```bash
cd $HOME/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down Expand Up @@ -1024,15 +1135,31 @@ sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### googletest

We need a recent version of GoogleTest to compile the unit and integration
tests.

```bash
cd $HOME/Downloads
wget -q https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
tar -xf b6cd405286ed8635ece71c72f118e659f4ade3fb.tar.gz
cd $HOME/Downloads/googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}
sudo ldconfig
```

#### google-cloud-cpp

Finally we can install `google-cloud-cpp`.

```bash
cd $HOME/Downloads/google-cloud-cpp
cmake -H. -Bcmake-out \
-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package \
-DGOOGLE_CLOUD_CPP_GMOCK_PROVIDER=external
cmake -H. -Bcmake-out
cmake --build cmake-out -- -j ${NCPU:-4}
cd $HOME/Downloads/google-cloud-cpp/cmake-out
ctest --output-on-failure
Expand Down
Loading