Avoid redefining WIN32_LEAN_AND_MEAN
on Windows
#291
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Linux g++ 10.2 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-10", | |
cxxver: 17, | |
} | |
- { | |
name: "Linux g++ 10.2 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-10", | |
cxxver: 20, | |
} | |
- { | |
name: "Linux g++ 11 C++17 Debug", | |
os: ubuntu-20.04, | |
buildtype: Debug, | |
cxx: "g++-11", | |
cxxver: 17, | |
} | |
- { | |
name: "Linux g++ 11 C++20 Debug", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "g++-11", | |
cxxver: 20, | |
} | |
- { | |
name: "Linux g++ 11 C++17", | |
os: ubuntu-22.04, | |
buildtype: Debug, | |
cxx: "g++-11", | |
cxxver: 17, | |
} | |
- { | |
name: "Linux g++ 11 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-11", | |
cxxver: 20, | |
} | |
- { | |
name: "Linux g++ 12 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-12", | |
cxxver: 17, | |
} | |
- { | |
name: "Linux g++ 12 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-12", | |
cxxver: 20, | |
} | |
- { | |
name: "Linux g++ 13 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-13", | |
cxxver: 17, | |
} | |
- { | |
name: "Linux g++ 13 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "g++-13", | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-10 C++17", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-10", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-10 C++20", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-10", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-11 C++17", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-11", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-11 C++20", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-11", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-12 C++17", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-12", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-12 C++20", | |
os: ubuntu-20.04, | |
buildtype: Release, | |
cxx: "clang++-12", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-13 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-13", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-13 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-13", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-14 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-14", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-14 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-14", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-15 C++17 Debug", | |
os: ubuntu-22.04, | |
buildtype: Debug, | |
cxx: "clang++-15", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-15 C++20 Debug", | |
os: ubuntu-22.04, | |
buildtype: Debug, | |
cxx: "clang++-15", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-15 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-15", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-15 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-15", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Linux clang-16 C++17", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-16", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 17, | |
} | |
- { | |
name: "Linux clang-16 C++20", | |
os: ubuntu-22.04, | |
buildtype: Release, | |
cxx: "clang++-16", | |
cxx_flags: -stdlib=libc++, | |
exe_linker_flags: -lc++, | |
cxxver: 20, | |
} | |
- { | |
name: "Windows MSVC 2017 (x64) C++17", | |
os: windows-2019, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 17, | |
msvcver: 2017, | |
} | |
- { | |
name: "Windows MSVC 2017 (x64) C++20", | |
os: windows-2019, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 20, | |
msvcver: 2017, | |
} | |
- { | |
name: "Windows MSVC 2019 (x64) C++17", | |
os: windows-2019, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 17, | |
} | |
- { | |
name: "Windows MSVC 2019 (x64) C++20", | |
os: windows-2019, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 20, | |
} | |
- { | |
name: "Windows MSVC 2022 (x64) C++17", | |
os: windows-2022, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 17, | |
} | |
- { | |
name: "Windows MSVC 2022 (x64) C++20", | |
os: windows-2022, | |
buildtype: Release, | |
cxx: "cl", | |
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxxver: 20, | |
} | |
- { | |
name: "Msys2/CLANG", | |
os: windows-2019, | |
buildtype: Release, | |
mingw: MINGW64, | |
mingw-arch: x86_64, | |
cxx: "clang", | |
cxxver: 20, | |
} | |
- { | |
name: "Msys2/GCC", | |
os: windows-2019, | |
buildtype: Release, | |
mingw: MINGW64, | |
mingw-arch: x86_64, | |
cxx: "gcc", | |
cxxver: 20, | |
} | |
- { | |
name: "Msys2/debugCLANG", | |
os: windows-2019, | |
buildtype: Debug, | |
mingw: MINGW64, | |
mingw-arch: x86_64, | |
cxx: "clang", | |
cxxver: 17, | |
} | |
- { | |
name: "Msys2/debugGCC", | |
os: windows-2019, | |
buildtype: Debug, | |
mingw: MINGW64, | |
mingw-arch: x86_64, | |
cxx: "gcc", | |
cxxver: 17, | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install Msys2" | |
if: (startsWith(matrix.config.os, 'windows-2019') && contains(matrix.config.mingw, 'MINGW')) | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.config.mingw }} | |
install: >- | |
git | |
mingw-w64-${{ matrix.config.mingw-arch }}-cmake | |
mingw-w64-${{ matrix.config.mingw-arch }}-ninja | |
mingw-w64-${{ matrix.config.mingw-arch }}-${{ matrix.config.cxx }} | |
mingw-w64-${{ matrix.config.mingw-arch }}-toolchain | |
update: true | |
- name: Install Clang 10 | |
id: install_clang_10 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 10 | |
sudo apt-get install libc++-10-dev libc++abi-10-dev | |
- name: Install Clang 11 | |
id: install_clang_11 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 11 | |
sudo apt-get install libc++-11-dev libc++abi-11-dev | |
- name: Install Clang 12 | |
id: install_clang_12 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-12' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 12 | |
sudo apt-get install libc++-12-dev libc++abi-12-dev libunwind-12-dev | |
- name: Install Clang 13 | |
id: install_clang_13 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-13' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 13 | |
sudo apt-get install libc++-13-dev libc++abi-13-dev libunwind-13-dev | |
- name: Install Clang 14 | |
id: install_clang_14 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-14' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 14 | |
sudo apt-get install libc++-14-dev libc++abi-14-dev libunwind-14-dev | |
- name: Install Clang 15 | |
id: install_clang_15 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-15' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 15 | |
sudo apt-get install libc++-15-dev libc++abi-15-dev libunwind-15-dev | |
- name: Install Clang 16 | |
id: install_clang_16 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-16' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 16 | |
sudo apt-get install libc++-16-dev libc++abi-16-dev libunwind-16-dev | |
- name: Install g++ 10 | |
id: install_gcc_10 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-10' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt-get install g++-10 | |
- name: Install g++ 11 | |
id: install_gcc_11 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-11' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt-get install g++-11 | |
- name: Install g++ 12 | |
id: install_gcc_12 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-12' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo apt-get install g++-12 | |
- name: Install g++ 13 | |
id: install_gcc_13 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-13' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt-get install g++-13 | |
- name: Install MSVC 2017 | |
id: install_msvc_2017 | |
if: startsWith(matrix.config.os, 'windows-2019') && ( matrix.config.cxx == 'cl' ) && ( matrix.config.msvcver == 2017 ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
choco install visualstudio2017community | |
choco install visualstudio2017-workload-nativedesktop | |
choco install visualstudio2017-workload-vctools | |
- name: MSYS2 - Configure, Build & Test | |
id: install_msys2 | |
if: (startsWith(matrix.config.os, 'windows-2019') && contains(matrix.config.mingw, 'MINGW')) | |
shell: msys2 {0} | |
working-directory: ${{ env.HOME }} | |
run: | | |
cmake $GITHUB_WORKSPACE \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} \ | |
-DCMAKE_CXX_STANDARD=${{ matrix.config.cxxver }} \ | |
-DBUILD_TESTING=ON \ | |
-DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ | |
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON | |
cmake --build . --config ${{ matrix.config.buildtype }} | |
ctest --output-on-failure -C ${{ matrix.config.buildtype }} | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Configure CMake | |
if: (!contains(matrix.config.mingw, 'MINGW')) | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
working-directory: ${{runner.workspace}}/build | |
env: | |
CXX: ${{ matrix.config.cxx }} | |
# Note the current convention is to use the -S and -B options here to specify source | |
# and build directories, but this is only available with CMake 3.13 and higher. | |
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | |
run: | | |
# run environment setup script if any | |
[ -n "${{ matrix.config.environment_script }}" ] && "${{ matrix.config.environment_script }}" | |
cmake $GITHUB_WORKSPACE \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} \ | |
-DCMAKE_CXX_STANDARD=${{ matrix.config.cxxver }} \ | |
-DBUILD_TESTING=ON \ | |
-DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ | |
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON | |
- name: Build | |
if: (!contains(matrix.config.mingw, 'MINGW')) | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: cmake --build . --config ${{ matrix.config.buildtype }} | |
- name: Test | |
if: (!contains(matrix.config.mingw, 'MINGW')) | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest --output-on-failure -C ${{ matrix.config.buildtype }} |