travis vs FetchContent_MakeAvailable(): give up on a recent cmake

... Avoid using the modern cmake function, and go back to an earlier
approach. The ppc64le travis images was not dealing well with the
attempt to hoist a modern cmake into it:

https://travis-ci.com/github/lemire/fast_float/jobs/444278392
This commit is contained in:
Joao Paulo Magalhaes 2020-11-21 00:59:13 +01:00
parent ed6664d93e
commit 8ba7d2e850
3 changed files with 85 additions and 55 deletions

View File

@ -2,11 +2,6 @@ language: cpp
dist: bionic
arch:
- amd64
- ppc64le
- s390x
cache:
directories:
- $HOME/.dep_cache
@ -15,9 +10,30 @@ env:
global:
- fastfloat_DEPENDENCY_CACHE_DIR=$HOME/.dep_cache
# the ppc64le and s390x images use cmake 3.10, but fast_float requires 3.11.
# so we compile cmake from source in those images.
# - tried the kitware ppa but that is using 3.10 as well
# - tried also using snap to get a more recent version but that failed with
# udev errors.
matrix:
include:
- os: linux
- arch: ppc64le
os: linux
env:
- CMAKE_SRC="https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4.tar.gz"
- arch: s390x
os: linux
env:
- CMAKE_SRC="https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4.tar.gz"
- arch: amd64
os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -28,7 +44,8 @@ matrix:
- COMPILER="CC=gcc-8 && CXX=g++-8"
compiler: gcc-8
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -39,7 +56,8 @@ matrix:
- COMPILER="CC=gcc-9 && CXX=g++-9"
compiler: gcc-9
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -50,7 +68,8 @@ matrix:
- COMPILER="CC=gcc-10 && CXX=g++-10"
compiler: gcc-10
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -62,7 +81,8 @@ matrix:
- SANITIZE="on"
compiler: gcc-10-sanitize
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -72,9 +92,10 @@ matrix:
env:
- COMPILER="CC=gcc-10 && CXX=g++-10"
- STATIC="on"
compiler: gcc-10-static
acompiler: gcc-10-static
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -85,7 +106,8 @@ matrix:
- COMPILER="CC=clang-6.0 && CXX=clang++-6.0"
compiler: clang-6
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -96,7 +118,8 @@ matrix:
- COMPILER="CC=clang-7 && CXX=clang++-7"
compiler: clang-7
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -107,7 +130,8 @@ matrix:
- COMPILER="CC=clang-8 && CXX=clang++-8"
compiler: clang-8
- os: linux
- arch: amd64
os: linux
addons:
apt:
sources:
@ -118,7 +142,8 @@ matrix:
- COMPILER="CC=clang-9 && CXX=clang++-9"
compiler: clang-9
- os: linux
- arch: amd64
os: linux
addons:
apt:
packages:
@ -131,7 +156,8 @@ matrix:
- COMPILER="CC=clang-10 && CXX=clang++-10"
compiler: clang-10
- os: linux
- arch: amd64
os: linux
addons:
apt:
packages:
@ -145,7 +171,8 @@ matrix:
- STATIC="on"
compiler: clang-10-static
- os: linux
- arch: amd64
os: linux
addons:
apt:
packages:
@ -163,42 +190,36 @@ before_install:
- eval "${COMPILER}"
install:
# make sure we have a recent cmake version.
# fastfloat itself does not require it, but the tests require >= 3.14.
# these architectures have a snap:
# https://gitlab.kitware.com/cmake/cmake/-/issues/20122
- sudo -E apt-get -y update
- sudo -E apt-get -y install snapd
- sudo -E snap install cmake --beta --classic
- export PATH=/snap/cmake/current/bin:$PATH
# ALTERNATIVE: does not work on s390 and ppc64le
## https://github.com/kahypar/kahypar/blob/master/.travis.yml
#- echo ${TRAVIS_OS_NAME}
#- |
# if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
# pwd ;
# export DEPS_DIR="${HOME}/deps" ;
# mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} ;
# export CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.tar.gz";
# mkdir cmake;
# travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake;
# export PATH=${DEPS_DIR}/cmake/bin:${PATH};
# cd - ;
# pwd
# else
# brew install cmake || brew upgrade cmake;
# fi
- |
if [ "$CMAKE_SRC" != "" ] ; then
set -x
set -e
sudo -E apt remove --purge cmake
sudo -E apt-get update
sudo -E apt-get install -y build-essential libssl-dev
mkdir cmake_src
pushd cmake_src
wget "$CMAKE_SRC"
tar xfz $(basename "$CMAKE_SRC")
pushd $(basename "$CMAKE_SRC" | sed "s:.tar.gz::")
./bootstrap
make -j2
sudo make install
popd
popd
set +x
fi
- echo ${PATH}
- which cmake
- cmake --version
- which ${CC}
- ${CC} --version
- which ${CXX}
- ${CXX} --version
script:
- mkdir build
- cd build
- cmake -DFASTFLOAT_TEST=ON ..
- make
- cmake -DFASTFLOAT_TEST=ON ..
- make -j2
- ctest --output-on-failure -R basictest

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.9)
project(fast_float VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)

View File

@ -1,13 +1,22 @@
# FetchContent_MakeAvailable() was only introduced in 3.14
# https://cmake.org/cmake/help/v3.14/release/3.14.html#modules
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# FetchContent requires cmake >=3.11
# see https://cmake.org/cmake/help/v3.11/module/FetchContent.html
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
include(FetchContent)
FetchContent_Declare(doctest
GIT_REPOSITORY https://github.com/onqtam/doctest.git
GIT_TAG master)
FetchContent_MakeAvailable(doctest)
GIT_TAG 2.4.1)
# FetchContent_MakeAvailable() was only introduced in 3.14
# https://cmake.org/cmake/help/v3.14/release/3.14.html#modules
# FetchContent_MakeAvailable(doctest)
FetchContent_GetProperties(doctest)
if(NOT doctest_POPULATED)
FetchContent_Populate(doctest)
add_subdirectory(${doctest_SOURCE_DIR} ${doctest_BINARY_DIR})
endif()
function(fast_float_add_cpp_test TEST_NAME)
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)