2021-07-27 23:15:27 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC2079
|
|
|
|
|
2023-07-24 19:54:11 +00:00
|
|
|
##=============================================================================
|
|
|
|
##
|
|
|
|
## Copyright (c) Kitware, Inc.
|
|
|
|
## All rights reserved.
|
|
|
|
## See LICENSE.txt for details.
|
|
|
|
##
|
|
|
|
## This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
## PURPOSE. See the above copyright notice for more information.
|
|
|
|
##
|
|
|
|
##=============================================================================
|
|
|
|
|
2022-10-26 21:18:15 +00:00
|
|
|
set -ex
|
2021-07-27 23:15:27 +00:00
|
|
|
|
2022-10-26 21:18:15 +00:00
|
|
|
version="${1:-3.23.4}"
|
2021-07-27 23:15:27 +00:00
|
|
|
|
|
|
|
case "$( uname -s )" in
|
|
|
|
Linux)
|
2022-10-26 21:18:15 +00:00
|
|
|
readonly -A sumsByVersion=(
|
|
|
|
# We require CMake >= 3.13 in the CI to support CUDA builds
|
|
|
|
['3.13.5']='e2fd0080a6f0fc1ec84647acdcd8e0b4019770f48d83509e6a5b0b6ea27e5864'
|
|
|
|
['3.23.4']='3fbcbff85043d63a8a83c8bdf8bd5b1b2fd5768f922de7dc4443de7805a2670d'
|
2022-07-08 20:39:46 +00:00
|
|
|
)
|
2022-10-26 21:18:15 +00:00
|
|
|
shatool="sha256sum"
|
|
|
|
sha256sum="${sumsByVersion[$version]}"
|
|
|
|
platform="linux"
|
2021-07-27 23:15:27 +00:00
|
|
|
arch="x86_64"
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
shatool="shasum -a 256"
|
2022-10-26 21:18:15 +00:00
|
|
|
sha256sum="98cac043cdf321caa4fd07f27da3316db6c8bc48c39997bf78e27e5c46c4eb68"
|
2021-07-27 23:15:27 +00:00
|
|
|
platform="macos"
|
|
|
|
arch="universal"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unrecognized platform $( uname -s )"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
readonly shatool
|
|
|
|
readonly sha256sum
|
|
|
|
readonly platform
|
|
|
|
readonly arch
|
|
|
|
|
|
|
|
cd .gitlab || exit
|
|
|
|
|
2022-10-26 21:18:15 +00:00
|
|
|
readonly tarball="cmake-$version-$platform-$arch.tar.gz"
|
|
|
|
curl -SOL "https://github.com/Kitware/CMake/releases/download/v$version/$tarball"
|
|
|
|
|
2021-07-27 23:15:27 +00:00
|
|
|
echo "$sha256sum $tarball" > cmake.sha256sum
|
|
|
|
$shatool --check cmake.sha256sum
|
2022-10-26 21:18:15 +00:00
|
|
|
|
|
|
|
# Extract cmake install root into director named cmake
|
|
|
|
mkdir cmake
|
|
|
|
tar xf "$tarball" --strip-components=1 -C cmake
|
2021-07-27 23:15:27 +00:00
|
|
|
|
|
|
|
if [ "$( uname -s )" = "Darwin" ]; then
|
|
|
|
ln -s CMake.app/Contents/bin cmake/bin
|
|
|
|
fi
|