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 [cg-concepts]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslconcept-concepts
# Quick Start # Quick Start
## Supported Compilers ## Supported Compilers / Toolsets
The GSL officially supports the following versions of MSVC, GCC, Clang, and XCode's Apple-Clang. 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 Compiler |Toolset Versions Currently Tested
:------- |--: :------- |--:
XCode | 12.4 & 11.3 XCode | 13.1 & 12.5.1
GCC | 9.3.0 & 7.5.0 GCC | 11.1.0 & 10.3.0
Clang | 11.0.0 & 9.0.0 Clang | 11.0.0 & 10.0.0
Visual Studio with MSVC | VS2017 (15.9.21) & VS2019 (16.11.2) 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! If you successfully port GSL to another platform, we would love to hear from you!

View File

@ -4,71 +4,68 @@ trigger:
pr: pr:
autoCancel: true autoCancel: true
# GCC
stages: stages:
- stage: GCC - stage: GCC
dependsOn: [] dependsOn: []
variables:
- name: CC
value: gcc
- name: CXX
value: g++
jobs: jobs:
- template: ./pipelines/jobs.yml - template: ./pipelines/jobs.yml
parameters: parameters:
jobName: 'Validate GCC latest' compiler: gcc
imageName: ubuntu-20.04 image: ubuntu-20.04
CXXVersions: [ 14, 17 ] compilerVersions: [ 11, 10 ]
- template: ./pipelines/jobs.yml setupfile: 'setup_gcc.yml'
parameters:
jobName: 'Validate GCC Previous'
imageName: ubuntu-18.04
CXXVersions: [ 14, 17 ]
# Clang
- stage: Clang - stage: Clang
dependsOn: [] dependsOn: []
variables:
- name: CC
value: clang
- name: CXX
value: clang++
jobs: jobs:
- template: ./pipelines/jobs.yml - template: ./pipelines/jobs.yml
parameters: parameters:
jobName: 'Validate Clang latest' compiler: clang
imageName: ubuntu-20.04 image: ubuntu-20.04
- template: ./pipelines/jobs.yml compilerVersions: [ 11, 10 ]
parameters: setupfile: 'setup_clang.yml'
jobName: 'Validate Clang Previous'
imageName: ubuntu-18.04
CXXVersions: [ 14, 17 ]
# MSVC - stage: Xcode
- stage: MSVC
dependsOn: [] dependsOn: []
jobs: jobs:
- template: ./pipelines/jobs.yml - template: ./pipelines/jobs.yml
parameters: parameters:
jobName: 'Validate MSVC latest' compiler: 'Xcode'
imageName: windows-latest image: macOS-11
- template: ./pipelines/jobs.yml compilerVersions: [ '12.5.1', '13.1' ]
parameters: setupfile: 'setup_apple.yml'
jobName: 'Validate MSVC Previous'
imageName: vs2017-win2016
CXXVersions: [ 14, 17 ]
# Apple-Clang - stage: VS_MSVC
- stage: Apple_Clang
dependsOn: [] dependsOn: []
jobs: jobs:
- template: ./pipelines/jobs.yml - template: ./pipelines/jobs.yml
parameters: parameters:
jobName: 'Validate Apple-Clang latest' compiler: 'VS2019 (16.11)'
imageName: macos-10.15 compilerVersions: [ 'MSVC' ]
CXXVersions: [ 14, 17 ] image: windows-2019
- template: ./pipelines/jobs.yml - template: ./pipelines/jobs.yml
parameters: parameters:
jobName: 'Validate Apple-Clang Previous' compiler: 'VS2022 (17.0)'
imageName: macos-10.14 compilerVersions: [ 'MSVC' ]
CXXVersions: [ 14, 17 ] 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: parameters:
jobName: ''
imageName: ''
CXXVersions: [ 14, 17, 20 ] CXXVersions: [ 14, 17, 20 ]
buildTypes: [ 'Debug', 'Release' ] 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: jobs:
- ${{ each CXXVersion in parameters.CXXVersions }}: - ${{ each compilerVersion in parameters.compilerVersions }}:
- ${{ each buildType in parameters.buildTypes }}: - ${{ each CXXVersion in parameters.CXXVersions }}:
- job: - ${{ each buildType in parameters.buildTypes }}:
displayName: ${{ format('{0} {1} C++{2}', parameters.imageName, buildType, CXXVersion) }} - job:
pool: displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
vmImage: ${{ parameters.imageName }} pool:
continueOnError: false vmImage: ${{ parameters.image }}
steps: continueOnError: false
- template: ./steps.yml
parameters: steps:
buildType: ${{ buildType }} - ${{ if not(eq(parameters.setupfile, '')) }}:
CXXVersion: ${{ CXXVersion }} - template: ${{ parameters.setupfile }}
parameters:
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>>: $<$<AND:$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.99>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
$<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template> $<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template>
> >
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<CXX_COMPILER_VERSION:11.0.0>>: $<$<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 11.0.0 -Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 10.0.0
# (operator< is being re-written by the compiler as operator<=> and # and clang 11.0.0. (operator< is being re-written by the compiler
# raising the warning) # as operator<=> and raising the warning)
> >
> >
$<$<CXX_COMPILER_ID:AppleClang>: $<$<CXX_COMPILER_ID:AppleClang>: