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

Convert cmake build to (mostly) use urls rather than git clones #852

Merged
merged 3 commits into from
Feb 27, 2018
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
12 changes: 4 additions & 8 deletions cmake/external/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
# limitations under the License.

include(ExternalProject)
include(ExternalProjectFlags)

ExternalProject_GitSource(
GOOGLETEST_GIT
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "release-1.8.0"
)

ExternalProject_Add(
googletest

${GOOGLETEST_GIT}
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This puts the downloaded tarballs into ./build/downloads. Alternatively, we could put them into the top level directory (./downloads or similar). This would prevent them from being deleted when the user make clean's via a rm -rf ./build. OTOH, it's kinda surprising that the build would touch files outside of ./build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Travis caching doesn't really care.

DOWNLOAD_NAME googletest-1.8.0.tar.gz
URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(As mentioned) It's possible to use http (rather than https) here, which may help if cmake is having trouble with ssl. But unless there's a compelling reason, I'd rather just use https.

Note that the URL_HASH is (more-or-less) required even when using https. (If you omit it, cmake can't tell if the file was downloaded successfully, so it insists on re-downloading it.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https FTW. Let there be no unencrypted bits.

URL_HASH SHA256=58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8

PREFIX ${PROJECT_BINARY_DIR}/external/googletest

Expand Down
12 changes: 4 additions & 8 deletions cmake/external/leveldb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

include(ExternalProject)
include(ExternalProjectFlags)

if(WIN32 OR LEVELDB_ROOT)
# If the user has supplied a LEVELDB_ROOT then just use it. Add an empty
Expand Down Expand Up @@ -42,16 +41,13 @@ else()
$<$<CONFIG:Release>:${CMAKE_CXX_FLAGS_RELEASE}>"
)

ExternalProject_GitSource(
LEVELDB_GIT
GIT_REPOSITORY "https://github.com/google/leveldb.git"
GIT_TAG "v1.20"
)

ExternalProject_Add(
leveldb

${LEVELDB_GIT}
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads
DOWNLOAD_NAME leveldb-v1.20.tar.gz
URL https://github.com/google/leveldb/archive/v1.20.tar.gz
URL_HASH SHA256=f5abe8b5b209c2f36560b75f32ce61412f39a2922f7045ae764a2c23335b6664

PREFIX ${PROJECT_BINARY_DIR}/external/leveldb

Expand Down
11 changes: 3 additions & 8 deletions cmake/external/nanopb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
# limitations under the License.

include(ExternalProject)
include(ExternalProjectFlags)

ExternalProject_GitSource(
NANOPB_GIT
GIT_REPOSITORY "https://github.com/nanopb/nanopb.git"
GIT_TAG "0.3.8"
)

set(
NANOPB_PROTOC_BIN
Expand All @@ -29,7 +22,9 @@ ExternalProject_Add(
DEPENDS
protobuf

${NANOPB_GIT}
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads
URL https://github.com/nanopb/nanopb/archive/nanopb-0.3.8.tar.gz
URL_HASH SHA256=f192c7c7cc036be36babc303b7d2315d4f62e2fe4be28c172cfed4cfa0ed5f22

BUILD_IN_SOURCE ON

Expand Down
12 changes: 4 additions & 8 deletions cmake/external/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
# limitations under the License.

include(ExternalProject)
include(ExternalProjectFlags)

ExternalProject_GitSource(
PROTOBUF_GIT
GIT_REPOSITORY "https://github.com/google/protobuf.git"
GIT_TAG "v3.5.1.1"
)

ExternalProject_Add(
protobuf

${PROTOBUF_GIT}
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads
DOWNLOAD_NAME protobuf-v3.5.11.tar.gz
URL https://github.com/google/protobuf/archive/v3.5.1.1.tar.gz
URL_HASH SHA256=56b5d9e1ab2bf4f5736c4cfba9f4981fbc6976246721e7ded5602fbaee6d6869

PREFIX ${PROJECT_BINARY_DIR}/external/protobuf

Expand Down