mirror of
https://github.com/microsoft/GSL.git
synced 2025-02-22 09:22:52 -05:00
Compare commits
No commits in common. "d610d788291898e1f0400fc5bec08c4cab77cd48" and "a0550c7d81a4ea19320ac08f5516de7ff10298c2" have entirely different histories.
d610d78829
...
a0550c7d81
56
.github/workflows/cmake/action.yml
vendored
56
.github/workflows/cmake/action.yml
vendored
@ -1,56 +0,0 @@
|
|||||||
name: Composite CMake
|
|
||||||
inputs:
|
|
||||||
cmake_generator:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'Unix Makefiles'
|
|
||||||
cmake_build_type:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
cmake_cxx_compiler:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
gsl_cxx_standard:
|
|
||||||
required: true
|
|
||||||
type: number
|
|
||||||
extra_cmake_args:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
build_cmd:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
default: 'make'
|
|
||||||
test_cmd:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'make test'
|
|
||||||
shell:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'bash'
|
|
||||||
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Create build directory
|
|
||||||
run: mkdir build
|
|
||||||
shell: ${{ inputs.shell }}
|
|
||||||
|
|
||||||
- name: Configure CMake
|
|
||||||
working-directory: build
|
|
||||||
run: cmake -G "${{ inputs.cmake_generator }}" -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DCMAKE_CXX_COMPILER=${{ inputs.cmake_cxx_compiler }} -DGSL_CXX_STANDARD=${{ inputs.gsl_cxx_standard }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ inputs.extra_cmake_args }} ..
|
|
||||||
shell: ${{ inputs.shell }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
working-directory: build
|
|
||||||
run: ${{ inputs.build_cmd }}
|
|
||||||
shell: ${{ inputs.shell }}
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
working-directory: build
|
|
||||||
run: ${{ inputs.test_cmd }}
|
|
||||||
shell: ${{ inputs.shell }}
|
|
||||||
|
|
111
.github/workflows/compilers.yml
vendored
111
.github/workflows/compilers.yml
vendored
@ -10,95 +10,38 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
# These jobs are correlated with the officially supported compilers
|
|
||||||
# and toolsets. If you change any versions, please update README.md.
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gcc:
|
VS_MSVC:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
gcc_version: [ 10, 11, 12 ]
|
image: [ windows-2022 ]
|
||||||
build_type: [ Debug, Release ]
|
generator: [ "Visual Studio 17 2022" ]
|
||||||
cxx_version: [ 14, 17, 20, 23 ]
|
cxx_version: [ 20 ]
|
||||||
exclude:
|
build_type: [ 'Debug', 'Release' ]
|
||||||
- gcc_version: 10
|
|
||||||
cxx_version: 23
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Run CMake (configure, build, test)
|
|
||||||
uses: ./.github/workflows/cmake
|
|
||||||
with:
|
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
|
||||||
cmake_cxx_compiler: g++-${{ matrix.gcc_version }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
|
|
||||||
clang:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
clang_version: [ 13, 14, 15 ]
|
|
||||||
build_type: [ Debug, Release ]
|
|
||||||
cxx_version: [ 14, 17, 20, 23 ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Run CMake (configure, build, test)
|
|
||||||
uses: ./.github/workflows/cmake
|
|
||||||
with:
|
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
|
||||||
cmake_cxx_compiler: clang++-${{ matrix.clang_version }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
|
|
||||||
xcode:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
xcode_version: [ '14.3.1', '15.4' ]
|
|
||||||
build_type: [ Debug, Release ]
|
|
||||||
cxx_version: [ 14, 17, 20, 23 ]
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: select xcode version
|
|
||||||
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app
|
|
||||||
|
|
||||||
- name: Run CMake (configure, build, test)
|
|
||||||
uses: ./.github/workflows/cmake
|
|
||||||
with:
|
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
|
||||||
cmake_cxx_compiler: clang++
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
|
|
||||||
VisualStudio:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
generator: [ 'Visual Studio 16 2019', 'Visual Studio 17 2022' ]
|
|
||||||
image: [ windows-2019, windows-2022 ]
|
|
||||||
build_type: [ Debug, Release ]
|
|
||||||
extra_args: [ '', '-T ClangCL' ]
|
|
||||||
cxx_version: [ 14, 17, 20, 23 ]
|
|
||||||
exclude:
|
|
||||||
- generator: 'Visual Studio 17 2022'
|
|
||||||
image: windows-2019
|
|
||||||
- generator: 'Visual Studio 16 2019'
|
|
||||||
image: windows-2022
|
|
||||||
- generator: 'Visual Studio 16 2019'
|
|
||||||
cxx_version: 23
|
|
||||||
runs-on: ${{ matrix.image }}
|
runs-on: ${{ matrix.image }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: microsoft/setup-msbuild@v2
|
- uses: microsoft/setup-msbuild@v1
|
||||||
|
|
||||||
- name: Run CMake (configure, build, test)
|
- name: create build directory
|
||||||
uses: ./.github/workflows/cmake
|
run: mkdir build
|
||||||
with:
|
|
||||||
cmake_generator: ${{ matrix.generator }}
|
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
extra_cmake_args: ${{ matrix.extra_args }}
|
|
||||||
build_cmd: msbuild GSL.sln
|
|
||||||
test_cmd: ctest . --output-on-failure --no-compress-output
|
|
||||||
shell: pwsh
|
|
||||||
|
|
||||||
|
- name: cmake configure
|
||||||
|
working-directory: build
|
||||||
|
run: cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DGSL_CXX_STANDARD=${{ matrix.cxx_version }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ..
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
working-directory: build
|
||||||
|
run: msbuild GSL.sln
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
working-directory: build
|
||||||
|
run: ctest . --output-on-failure --no-compress-output
|
||||||
|
|
||||||
|
# TODO (@carsonradtke)
|
||||||
|
# - [ ] GCC
|
||||||
|
# - [ ] Clang
|
||||||
|
# - [ ] Xcode
|
||||||
|
# - [ ] VS_LLVM
|
||||||
|
# - [ ] delete azure-pipelines.yml
|
||||||
|
# - [ ] delete pipelines/
|
||||||
|
23
README.md
23
README.md
@ -86,17 +86,24 @@ This is based on [CppCoreGuidelines semi-specification](https://github.com/isocp
|
|||||||
|
|
||||||
# Quick Start
|
# Quick Start
|
||||||
## Supported Compilers / Toolsets
|
## Supported Compilers / Toolsets
|
||||||
The GSL officially supports recent major versions of Visual Studio with both MSVC and LLVM, GCC, Clang, and XCode with Apple-Clang.
|
The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang.
|
||||||
For each of these major versions, the GSL officially supports C++14, C++17, C++20, and C++23 (when supported by the compiler).
|
Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by
|
||||||
Below is a table showing the versions currently being tested (also see [.github/workflows/compilers.yml](the workflow).)
|
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
|
||||||
:------- |--:
|
:------- |--:
|
||||||
GCC | 10, 11, 12
|
XCode | 13.2.1 & 12.5.1
|
||||||
XCode | 14.3.1, 15.4
|
GCC | 11[^1] & 10[^2]
|
||||||
Clang | 13, 14, 15
|
Clang | 12[^2] & 11[^2]
|
||||||
Visual Studio with MSVC | VS2019, VS2022
|
Visual Studio with MSVC | VS2022[^3] & VS2019[^4]
|
||||||
Visual Studio with LLVM | VS2019, VS2022
|
Visual Studio with LLVM | VS2022[^3] & VS2019[^4]
|
||||||
|
|
||||||
|
|
||||||
|
[^1]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26).
|
||||||
|
[^2]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime).
|
||||||
|
[^3]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022).
|
||||||
|
[^4]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019).
|
||||||
|
|
||||||
---
|
---
|
||||||
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!
|
||||||
|
66
azure-pipelines.yml
Normal file
66
azure-pipelines.yml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
trigger:
|
||||||
|
- main
|
||||||
|
|
||||||
|
pr:
|
||||||
|
autoCancel: true
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: GCC
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: gcc
|
||||||
|
image: ubuntu-20.04
|
||||||
|
compilerVersions: [ 11, 10 ]
|
||||||
|
setupfile: 'setup_gcc.yml'
|
||||||
|
|
||||||
|
- stage: Clang
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: clang
|
||||||
|
image: ubuntu-20.04
|
||||||
|
compilerVersions: [ 12, 11 ]
|
||||||
|
setupfile: 'setup_clang.yml'
|
||||||
|
|
||||||
|
- stage: Xcode
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'Xcode'
|
||||||
|
image: macOS-11
|
||||||
|
compilerVersions: [ '12.5.1', '13.2.1' ]
|
||||||
|
setupfile: 'setup_apple.yml'
|
||||||
|
|
||||||
|
- stage: VS_MSVC
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2019 (MSVC)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2019
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2022 (MSVC)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2022
|
||||||
|
|
||||||
|
- stage: VS_LLVM
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2019 (LLVM)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2019
|
||||||
|
extraCmakeArgs: '-T ClangCL'
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2022 (LLVM)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2022
|
||||||
|
extraCmakeArgs: '-T ClangCL'
|
43
pipelines/jobs.yml
Normal file
43
pipelines/jobs.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
parameters:
|
||||||
|
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} {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
|
9
pipelines/setup_apple.yml
Normal file
9
pipelines/setup_apple.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
parameters:
|
||||||
|
version: 0
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
if [ "${{ parameters.version }}" != "default" ]; then sudo xcode-select -switch /Applications/Xcode_${{ parameters.version }}.app; fi
|
||||||
|
|
||||||
|
displayName: "Setup Xcode Version"
|
||||||
|
failOnStderr: true
|
13
pipelines/setup_clang.yml
Normal file
13
pipelines/setup_clang.yml
Normal 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
14
pipelines/setup_gcc.yml
Normal 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 }}
|
0
pipelines/steps.yml
Normal file
0
pipelines/steps.yml
Normal file
Loading…
x
Reference in New Issue
Block a user