diff options
author | dmitrykobets-msft <89153909+dmitrykobets-msft@users.noreply.github.com> | 2021-12-10 22:17:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 22:17:47 +0300 |
commit | c412deb31e73c9b824abeb6619e11511b279222f (patch) | |
tree | 7fa050d182c6ddf048b37ea82e81887a0b5db9ab | |
parent | bcf008ae5578fab638e6d30b7ca000f306b14d3b (diff) |
Update compiler support (#1019)
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | azure-pipelines.yml | 81 | ||||
-rw-r--r-- | pipelines/jobs.yml | 52 | ||||
-rw-r--r-- | pipelines/setup_apple.yml | 9 | ||||
-rw-r--r-- | pipelines/setup_clang.yml | 13 | ||||
-rw-r--r-- | pipelines/setup_gcc.yml | 14 | ||||
-rw-r--r-- | pipelines/steps.yml | 21 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 8 |
8 files changed, 129 insertions, 87 deletions
@@ -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! diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8ab761e..a82e3c4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 + compiler: clang + image: ubuntu-20.04 + compilerVersions: [ 11, 10 ] + setupfile: 'setup_clang.yml' + +- stage: Xcode + dependsOn: [] + jobs: - template: ./pipelines/jobs.yml parameters: - jobName: 'Validate Clang Previous' - imageName: ubuntu-18.04 - CXXVersions: [ 14, 17 ] + compiler: 'Xcode' + image: macOS-11 + compilerVersions: [ '12.5.1', '13.1' ] + setupfile: 'setup_apple.yml' -# MSVC -- stage: MSVC +- stage: VS_MSVC dependsOn: [] jobs: - template: ./pipelines/jobs.yml parameters: - jobName: 'Validate MSVC latest' - imageName: windows-latest + compiler: 'VS2019 (16.11)' + compilerVersions: [ 'MSVC' ] + image: windows-2019 - template: ./pipelines/jobs.yml parameters: - jobName: 'Validate MSVC Previous' - imageName: vs2017-win2016 - CXXVersions: [ 14, 17 ] + compiler: 'VS2022 (17.0)' + compilerVersions: [ 'MSVC' ] + image: windows-2022 -# Apple-Clang -- stage: Apple_Clang +- stage: VS_LLVM dependsOn: [] jobs: - template: ./pipelines/jobs.yml parameters: - jobName: 'Validate Apple-Clang latest' - imageName: macos-10.15 - CXXVersions: [ 14, 17 ] - - template: ./pipelines/jobs.yml - parameters: - jobName: 'Validate Apple-Clang Previous' - imageName: macos-10.14 - CXXVersions: [ 14, 17 ] + 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 ] diff --git a/pipelines/jobs.yml b/pipelines/jobs.yml index 783c46d..aabd3db 100644 --- a/pipelines/jobs.yml +++ b/pipelines/jobs.yml @@ -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 CXXVersion in parameters.CXXVersions }}:
- - ${{ each buildType in parameters.buildTypes }}:
- - job:
- displayName: ${{ format('{0} {1} C++{2}', parameters.imageName, buildType, CXXVersion) }}
- pool:
- vmImage: ${{ parameters.imageName }}
- continueOnError: false
- steps:
- - template: ./steps.yml
- parameters:
- buildType: ${{ buildType }}
- CXXVersion: ${{ CXXVersion }}
+- ${{ each compilerVersion in parameters.compilerVersions }}:
+ - ${{ each CXXVersion in parameters.CXXVersions }}:
+ - ${{ each buildType in parameters.buildTypes }}:
+ - job:
+ displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
+ pool:
+ vmImage: ${{ parameters.image }}
+ continueOnError: false
+
+ steps:
+ - ${{ if not(eq(parameters.setupfile, '')) }}:
+ - 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
diff --git a/pipelines/setup_apple.yml b/pipelines/setup_apple.yml new file mode 100644 index 0000000..a424efa --- /dev/null +++ b/pipelines/setup_apple.yml @@ -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 diff --git a/pipelines/setup_clang.yml b/pipelines/setup_clang.yml new file mode 100644 index 0000000..58403b4 --- /dev/null +++ b/pipelines/setup_clang.yml @@ -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 }} diff --git a/pipelines/setup_gcc.yml b/pipelines/setup_gcc.yml new file mode 100644 index 0000000..6480f67 --- /dev/null +++ b/pipelines/setup_gcc.yml @@ -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 }} diff --git a/pipelines/steps.yml b/pipelines/steps.yml index 2e80713..e69de29 100644 --- a/pipelines/steps.yml +++ b/pipelines/steps.yml @@ -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
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dd71105..cab4e56 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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>: |