A previous version of this was submitted and rolled back due to breakage -- an attempt to accommodate Visual Studio resulted in compiler errors on GCC/Clang with -mavx2 but without -mbmi2. This version makes the BMI2 support check more strict, to avoid the errors. A previous CL introduced _bzhi_u32 (part of Intel's BMI2 instruction set, released in Haswell) gated by a check for the __BMI2__ preprocessor macro. This works for Clang and GCC, but does not work on Visual Studio, and may not work on other compilers. This CL plumbs the BMI2 support checks through the CMake configuration used by the open source build. It also replaces the <x86intrin.h> header, which does not exist on Visual Studio, with the more scoped headers <tmmintrin.h> (for SSSE3) and <immintrin.h> (for BMI2/AVX2). Asides from fixing the open source build, the more scoped headers make it slightly less likely that newer intrinsics will creep in without proper gating.
79 lines
2.0 KiB
YAML
79 lines
2.0 KiB
YAML
# Build matrix / environment variables are explained on:
|
|
# http://about.travis-ci.org/docs/user/build-configuration/
|
|
# This file can be validated on: http://lint.travis-ci.org/
|
|
|
|
dist: xenial
|
|
language: cpp
|
|
|
|
compiler:
|
|
- gcc
|
|
- clang
|
|
os:
|
|
- linux
|
|
- osx
|
|
|
|
env:
|
|
- BUILD_TYPE=Debug CPU_LEVEL=AVX
|
|
- BUILD_TYPE=Debug CPU_LEVEL=AVX2
|
|
- BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX
|
|
- BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2
|
|
|
|
matrix:
|
|
exclude:
|
|
# GCC fails on recent Travis OSX images.
|
|
# https://github.com/travis-ci/travis-ci/issues/9640
|
|
- compiler: gcc
|
|
os: osx
|
|
# Travis OSX servers seem to run on pre-Haswell CPUs. Attempting to use AVX2
|
|
# results in crashes.
|
|
- env: BUILD_TYPE=Debug CPU_LEVEL=AVX2
|
|
os: osx
|
|
- env: BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2
|
|
os: osx
|
|
|
|
addons:
|
|
apt:
|
|
# List of whitelisted in travis packages for ubuntu-trusty can be found here:
|
|
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-trusty
|
|
# List of whitelisted in travis apt-sources:
|
|
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
|
|
sources:
|
|
- llvm-toolchain-xenial-7
|
|
- ubuntu-toolchain-r-test
|
|
packages:
|
|
- clang-7
|
|
- cmake
|
|
- gcc-8
|
|
- g++-8
|
|
- ninja-build
|
|
homebrew:
|
|
packages:
|
|
- cmake
|
|
- gcc@8
|
|
- ninja
|
|
|
|
before_install:
|
|
# The Travis VM image for Mac already has a link at /usr/local/include/c++,
|
|
# causing Homebrew's gcc installation to error out. This was reported to
|
|
# Homebrew maintainers at https://github.com/Homebrew/brew/issues/1742 and
|
|
# removing the link emerged as a workaround.
|
|
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then rm -f /usr/local/include/c++ ; fi
|
|
|
|
install:
|
|
# /usr/bin/gcc is stuck to old versions on both Linux and OSX.
|
|
- if [ "$CXX" = "g++" ]; then export CXX="g++-8" CC="gcc-8"; fi
|
|
- echo ${CC}
|
|
- echo ${CXX}
|
|
- ${CXX} --version
|
|
- cmake --version
|
|
|
|
before_script:
|
|
- mkdir -p build && cd build
|
|
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
-DSNAPPY_REQUIRE_${CPU_LEVEL}=ON
|
|
- cmake --build .
|
|
- cd ..
|
|
|
|
script:
|
|
- build/snappy_unittest
|