Update compiler support (#1019)

This commit is contained in:
dmitrykobets-msft 2021-12-10 11:17:47 -08:00 committed by GitHub
parent bcf008ae55
commit c412deb31e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 131 additions and 89 deletions

View File

@ -85,15 +85,21 @@ This is based on [CppCoreGuidelines semi-specification](https://github.com/isocp
[cg-concepts]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslconcept-concepts
# Quick Start
## Supported Compilers
The GSL officially supports the following versions of MSVC, GCC, Clang, and XCode's Apple-Clang.
## Supported Compilers / Toolsets
The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang.
Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by
delays between a toolchain's release and when it becomes widely available for use).
Below is a table showing the versions currently being tested.
Compiler |Toolset Versions Currently Tested
:------- |--:
XCode | 12.4 & 11.3
GCC | 9.3.0 & 7.5.0
Clang | 11.0.0 & 9.0.0
Visual Studio with MSVC | VS2017 (15.9.21) & VS2019 (16.11.2)
XCode | 13.1 & 12.5.1
GCC | 11.1.0 & 10.3.0
Clang | 11.0.0 & 10.0.0
Visual Studio with MSVC | VS2019 (16.11) & VS2022 (17.0)
Visual Studio with LLVM | VS2019 (16.11)
- Support for Visual Studio 2022 with LLVM will be added in the near future
---
If you successfully port GSL to another platform, we would love to hear from you!

View File

@ -4,71 +4,68 @@ trigger:
pr:
autoCancel: true
# GCC
stages:
- stage: GCC
dependsOn: []
variables:
- name: CC
value: gcc
- name: CXX
value: g++
jobs:
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate GCC latest'
imageName: ubuntu-20.04
CXXVersions: [ 14, 17 ]
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate GCC Previous'
imageName: ubuntu-18.04
CXXVersions: [ 14, 17 ]
compiler: gcc
image: ubuntu-20.04
compilerVersions: [ 11, 10 ]
setupfile: 'setup_gcc.yml'
# Clang
- stage: Clang
dependsOn: []
variables:
- name: CC
value: clang
- name: CXX
value: clang++
jobs:
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate Clang latest'
imageName: ubuntu-20.04
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate Clang Previous'
imageName: ubuntu-18.04
CXXVersions: [ 14, 17 ]
compiler: clang
image: ubuntu-20.04
compilerVersions: [ 11, 10 ]
setupfile: 'setup_clang.yml'
# MSVC
- stage: MSVC
- stage: Xcode
dependsOn: []
jobs:
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate MSVC latest'
imageName: windows-latest
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate MSVC Previous'
imageName: vs2017-win2016
CXXVersions: [ 14, 17 ]
compiler: 'Xcode'
image: macOS-11
compilerVersions: [ '12.5.1', '13.1' ]
setupfile: 'setup_apple.yml'
# Apple-Clang
- stage: Apple_Clang
- stage: VS_MSVC
dependsOn: []
jobs:
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate Apple-Clang latest'
imageName: macos-10.15
CXXVersions: [ 14, 17 ]
compiler: 'VS2019 (16.11)'
compilerVersions: [ 'MSVC' ]
image: windows-2019
- template: ./pipelines/jobs.yml
parameters:
jobName: 'Validate Apple-Clang Previous'
imageName: macos-10.14
CXXVersions: [ 14, 17 ]
compiler: 'VS2022 (17.0)'
compilerVersions: [ 'MSVC' ]
image: windows-2022
- stage: VS_LLVM
dependsOn: []
jobs:
- template: ./pipelines/jobs.yml
parameters:
compiler: 'VS2019 (16.11)'
compilerVersions: [ 'LLVM' ]
image: windows-2019
extraCmakeArgs: '-T ClangCL'
# The *same* config as with 2019 but on 2022 yields an error.
# Tracking issue: https://github.com/actions/virtual-environments/issues/4716
# - template: ./pipelines/jobs.yml
# parameters:
# compiler: 'VS2022 LLVM'
# compilerVersions: [ '17.0' ]
# image: windows-2022
# extraCmakeArgs: '-T ClangCL'
# CXXVersions: [ 14 ]
# buildTypes: [ Release ]

View File

@ -1,19 +1,43 @@
parameters:
jobName: ''
imageName: ''
CXXVersions: [ 14, 17, 20 ]
buildTypes: [ 'Debug', 'Release' ]
image: ''
compiler: ''
compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine.
# the text of this default value doesn't actually matter.
setupfile: ''
extraCmakeArgs: ''
jobs:
- ${{ each compilerVersion in parameters.compilerVersions }}:
- ${{ each CXXVersion in parameters.CXXVersions }}:
- ${{ each buildType in parameters.buildTypes }}:
- job:
displayName: ${{ format('{0} {1} C++{2}', parameters.imageName, buildType, CXXVersion) }}
displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
pool:
vmImage: ${{ parameters.imageName }}
vmImage: ${{ parameters.image }}
continueOnError: false
steps:
- template: ./steps.yml
- ${{ if not(eq(parameters.setupfile, '')) }}:
- template: ${{ parameters.setupfile }}
parameters:
buildType: ${{ buildType }}
CXXVersion: ${{ CXXVersion }}
version: ${{ compilerVersion }}
- task: CMake@1
name: Configure
inputs:
workingDirectory: build
cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. '
- task: CMake@1
name: Build
inputs:
workingDirectory: build
cmakeArgs: '--build . '
- script: ctest . --output-on-failure --no-compress-output
name: CTest
workingDirectory: build
failOnStderr: true

View File

@ -0,0 +1,9 @@
parameters:
version: 0
steps:
- script: |
if [ "${{ parameters.version }}" = "12.5.1" ]; then sudo xcode-select -switch /Applications/Xcode_12.5.1.app; fi
displayName: "Setup Xcode Version"
failOnStderr: true

13
pipelines/setup_clang.yml Normal file
View File

@ -0,0 +1,13 @@
parameters:
version: 0
steps:
- script: |
echo "##vso[task.setvariable variable=CXX;]${CXX}"
echo "##vso[task.setvariable variable=CC;]${CC}"
displayName: "Setup Clang Version"
failOnStderr: true
env:
CC: clang-${{ parameters.version }}
CXX: clang++-${{ parameters.version }}

14
pipelines/setup_gcc.yml Normal file
View File

@ -0,0 +1,14 @@
parameters:
version: 0
steps:
- script: |
echo "##vso[task.setvariable variable=CXX;]${CXX}"
echo "##vso[task.setvariable variable=CC;]${CC}"
if [ "${{ parameters.version }}" = "11" ]; then sudo apt-get install $CXX; fi
displayName: "Setup GCC Version"
failOnStderr: true
env:
CC: gcc-${{ parameters.version }}
CXX: g++-${{ parameters.version }}

View File

@ -1,21 +0,0 @@
parameters:
buildType: ''
CXXVersion: ''
steps:
- task: CMake@1
name: Configure
inputs:
workingDirectory: build
cmakeArgs: '-DGSL_CXX_STANDARD=${{ parameters.CXXVersion }} -DCMAKE_BUILD_TYPE=${{ parameters.buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev .. '
- task: CMake@1
name: Build
inputs:
workingDirectory: build
cmakeArgs: '--build . '
- script: ctest . --output-on-failure --no-compress-output
name: CTest
workingDirectory: build
failOnStderr: true

View File

@ -139,10 +139,10 @@ else()
$<$<AND:$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.99>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
$<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template>
>
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<CXX_COMPILER_VERSION:11.0.0>>:
-Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 11.0.0
# (operator< is being re-written by the compiler as operator<=> and
# raising the warning)
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<OR:$<CXX_COMPILER_VERSION:11.0.0>,$<CXX_COMPILER_VERSION:10.0.0>>>:
-Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 10.0.0
# and clang 11.0.0. (operator< is being re-written by the compiler
# as operator<=> and raising the warning)
>
>
$<$<CXX_COMPILER_ID:AppleClang>: