Skip to content

Commit c412deb

Browse files
Update compiler support (#1019)
1 parent bcf008a commit c412deb

File tree

8 files changed

+129
-87
lines changed

8 files changed

+129
-87
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,21 @@ This is based on [CppCoreGuidelines semi-specification](https://github.com/isocp
8585
[cg-concepts]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslconcept-concepts
8686

8787
# Quick Start
88-
## Supported Compilers
89-
The GSL officially supports the following versions of MSVC, GCC, Clang, and XCode's Apple-Clang.
88+
## Supported Compilers / Toolsets
89+
The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang.
90+
Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by
91+
delays between a toolchain's release and when it becomes widely available for use).
92+
Below is a table showing the versions currently being tested.
9093

9194
Compiler |Toolset Versions Currently Tested
9295
:------- |--:
93-
XCode | 12.4 & 11.3
94-
GCC | 9.3.0 & 7.5.0
95-
Clang | 11.0.0 & 9.0.0
96-
Visual Studio with MSVC | VS2017 (15.9.21) & VS2019 (16.11.2)
96+
XCode | 13.1 & 12.5.1
97+
GCC | 11.1.0 & 10.3.0
98+
Clang | 11.0.0 & 10.0.0
99+
Visual Studio with MSVC | VS2019 (16.11) & VS2022 (17.0)
100+
Visual Studio with LLVM | VS2019 (16.11)
101+
102+
- Support for Visual Studio 2022 with LLVM will be added in the near future
97103

98104
---
99105
If you successfully port GSL to another platform, we would love to hear from you!

azure-pipelines.yml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,68 @@ trigger:
44
pr:
55
autoCancel: true
66

7-
# GCC
87
stages:
98
- stage: GCC
109
dependsOn: []
11-
variables:
12-
- name: CC
13-
value: gcc
14-
- name: CXX
15-
value: g++
1610
jobs:
1711
- template: ./pipelines/jobs.yml
1812
parameters:
19-
jobName: 'Validate GCC latest'
20-
imageName: ubuntu-20.04
21-
CXXVersions: [ 14, 17 ]
22-
- template: ./pipelines/jobs.yml
23-
parameters:
24-
jobName: 'Validate GCC Previous'
25-
imageName: ubuntu-18.04
26-
CXXVersions: [ 14, 17 ]
13+
compiler: gcc
14+
image: ubuntu-20.04
15+
compilerVersions: [ 11, 10 ]
16+
setupfile: 'setup_gcc.yml'
2717

28-
# Clang
2918
- stage: Clang
3019
dependsOn: []
31-
variables:
32-
- name: CC
33-
value: clang
34-
- name: CXX
35-
value: clang++
3620
jobs:
3721
- template: ./pipelines/jobs.yml
3822
parameters:
39-
jobName: 'Validate Clang latest'
40-
imageName: ubuntu-20.04
23+
compiler: clang
24+
image: ubuntu-20.04
25+
compilerVersions: [ 11, 10 ]
26+
setupfile: 'setup_clang.yml'
27+
28+
- stage: Xcode
29+
dependsOn: []
30+
jobs:
4131
- template: ./pipelines/jobs.yml
4232
parameters:
43-
jobName: 'Validate Clang Previous'
44-
imageName: ubuntu-18.04
45-
CXXVersions: [ 14, 17 ]
33+
compiler: 'Xcode'
34+
image: macOS-11
35+
compilerVersions: [ '12.5.1', '13.1' ]
36+
setupfile: 'setup_apple.yml'
4637

47-
# MSVC
48-
- stage: MSVC
38+
- stage: VS_MSVC
4939
dependsOn: []
5040
jobs:
5141
- template: ./pipelines/jobs.yml
5242
parameters:
53-
jobName: 'Validate MSVC latest'
54-
imageName: windows-latest
43+
compiler: 'VS2019 (16.11)'
44+
compilerVersions: [ 'MSVC' ]
45+
image: windows-2019
5546
- template: ./pipelines/jobs.yml
5647
parameters:
57-
jobName: 'Validate MSVC Previous'
58-
imageName: vs2017-win2016
59-
CXXVersions: [ 14, 17 ]
48+
compiler: 'VS2022 (17.0)'
49+
compilerVersions: [ 'MSVC' ]
50+
image: windows-2022
6051

61-
# Apple-Clang
62-
- stage: Apple_Clang
52+
- stage: VS_LLVM
6353
dependsOn: []
6454
jobs:
6555
- template: ./pipelines/jobs.yml
6656
parameters:
67-
jobName: 'Validate Apple-Clang latest'
68-
imageName: macos-10.15
69-
CXXVersions: [ 14, 17 ]
70-
- template: ./pipelines/jobs.yml
71-
parameters:
72-
jobName: 'Validate Apple-Clang Previous'
73-
imageName: macos-10.14
74-
CXXVersions: [ 14, 17 ]
57+
compiler: 'VS2019 (16.11)'
58+
compilerVersions: [ 'LLVM' ]
59+
image: windows-2019
60+
extraCmakeArgs: '-T ClangCL'
61+
62+
# The *same* config as with 2019 but on 2022 yields an error.
63+
# Tracking issue: https://github.com/actions/virtual-environments/issues/4716
64+
# - template: ./pipelines/jobs.yml
65+
# parameters:
66+
# compiler: 'VS2022 LLVM'
67+
# compilerVersions: [ '17.0' ]
68+
# image: windows-2022
69+
# extraCmakeArgs: '-T ClangCL'
70+
# CXXVersions: [ 14 ]
71+
# buildTypes: [ Release ]

pipelines/jobs.yml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
11
parameters:
2-
jobName: ''
3-
imageName: ''
42
CXXVersions: [ 14, 17, 20 ]
53
buildTypes: [ 'Debug', 'Release' ]
4+
image: ''
5+
6+
compiler: ''
7+
compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine.
8+
# the text of this default value doesn't actually matter.
9+
setupfile: ''
10+
extraCmakeArgs: ''
611

712
jobs:
8-
- ${{ each CXXVersion in parameters.CXXVersions }}:
9-
- ${{ each buildType in parameters.buildTypes }}:
10-
- job:
11-
displayName: ${{ format('{0} {1} C++{2}', parameters.imageName, buildType, CXXVersion) }}
12-
pool:
13-
vmImage: ${{ parameters.imageName }}
14-
continueOnError: false
15-
steps:
16-
- template: ./steps.yml
17-
parameters:
18-
buildType: ${{ buildType }}
19-
CXXVersion: ${{ CXXVersion }}
13+
- ${{ each compilerVersion in parameters.compilerVersions }}:
14+
- ${{ each CXXVersion in parameters.CXXVersions }}:
15+
- ${{ each buildType in parameters.buildTypes }}:
16+
- job:
17+
displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
18+
pool:
19+
vmImage: ${{ parameters.image }}
20+
continueOnError: false
21+
22+
steps:
23+
- ${{ if not(eq(parameters.setupfile, '')) }}:
24+
- template: ${{ parameters.setupfile }}
25+
parameters:
26+
version: ${{ compilerVersion }}
27+
28+
- task: CMake@1
29+
name: Configure
30+
inputs:
31+
workingDirectory: build
32+
cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. '
33+
34+
- task: CMake@1
35+
name: Build
36+
inputs:
37+
workingDirectory: build
38+
cmakeArgs: '--build . '
39+
40+
- script: ctest . --output-on-failure --no-compress-output
41+
name: CTest
42+
workingDirectory: build
43+
failOnStderr: true

pipelines/setup_apple.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
version: 0
3+
4+
steps:
5+
- script: |
6+
if [ "${{ parameters.version }}" = "12.5.1" ]; then sudo xcode-select -switch /Applications/Xcode_12.5.1.app; fi
7+
8+
displayName: "Setup Xcode Version"
9+
failOnStderr: true

pipelines/setup_clang.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
parameters:
2+
version: 0
3+
4+
steps:
5+
- script: |
6+
echo "##vso[task.setvariable variable=CXX;]${CXX}"
7+
echo "##vso[task.setvariable variable=CC;]${CC}"
8+
9+
displayName: "Setup Clang Version"
10+
failOnStderr: true
11+
env:
12+
CC: clang-${{ parameters.version }}
13+
CXX: clang++-${{ parameters.version }}

pipelines/setup_gcc.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
parameters:
2+
version: 0
3+
4+
steps:
5+
- script: |
6+
echo "##vso[task.setvariable variable=CXX;]${CXX}"
7+
echo "##vso[task.setvariable variable=CC;]${CC}"
8+
if [ "${{ parameters.version }}" = "11" ]; then sudo apt-get install $CXX; fi
9+
10+
displayName: "Setup GCC Version"
11+
failOnStderr: true
12+
env:
13+
CC: gcc-${{ parameters.version }}
14+
CXX: g++-${{ parameters.version }}

pipelines/steps.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
parameters:
2-
buildType: ''
3-
CXXVersion: ''
4-
5-
steps:
6-
- task: CMake@1
7-
name: Configure
8-
inputs:
9-
workingDirectory: build
10-
cmakeArgs: '-DGSL_CXX_STANDARD=${{ parameters.CXXVersion }} -DCMAKE_BUILD_TYPE=${{ parameters.buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev .. '
11-
12-
- task: CMake@1
13-
name: Build
14-
inputs:
15-
workingDirectory: build
16-
cmakeArgs: '--build . '
17-
18-
- script: ctest . --output-on-failure --no-compress-output
19-
name: CTest
20-
workingDirectory: build
21-
failOnStderr: true

tests/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ else()
139139
$<$<AND:$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.99>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
140140
$<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template>
141141
>
142-
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<CXX_COMPILER_VERSION:11.0.0>>:
143-
-Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 11.0.0
144-
# (operator< is being re-written by the compiler as operator<=> and
145-
# raising the warning)
142+
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<OR:$<CXX_COMPILER_VERSION:11.0.0>,$<CXX_COMPILER_VERSION:10.0.0>>>:
143+
-Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 10.0.0
144+
# and clang 11.0.0. (operator< is being re-written by the compiler
145+
# as operator<=> and raising the warning)
146146
>
147147
>
148148
$<$<CXX_COMPILER_ID:AppleClang>:

0 commit comments

Comments
 (0)