Fix MSVC build #2512
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 Build Matrix | |
on: [push, pull_request] | |
env: | |
CMAKE_VERSION: 3.18.4 | |
NINJA_VERSION: 1.10.1 | |
BUILD_TYPE: Release | |
CCACHE_VERSION: 3.7.7 | |
NINJA_STATUS: "[%f/%t %o/sec] " | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC", artifact: "Windows-MSVC.7z", | |
os: windows-2019, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
gpu_var: "Off", | |
openmp_var: "Off" | |
} | |
- { | |
name: "macOS Latest Clang", artifact: "macOS.7z", | |
os: macos-latest, | |
cc: "clang", cxx: "clang++", | |
gpu_var: "Off", | |
openmp_var: "Off" | |
} | |
- { | |
name: "macOS 11 gcc with OpenCL", artifact: "macOS-gcc-OpenCL.7z", | |
os: macos-11, # Don't upgrade to macOS 12, see Issue #4646 | |
cc: "gcc-10", cxx: "g++-10", | |
gpu_var: "OpenCL", | |
openmp_var: "On" | |
} | |
env: | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
CI_JOB_ID: ${{ github.sha }} # Tell CMake it's running in CI | |
OPENMP_VAR: ${{ matrix.config.openmp_var }} | |
GPU_VAR: ${{ matrix.config.gpu_var }} | |
ENVIRONMENT_SCRIPT: ${{ matrix.config.environment_script }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Ninja and CMake | |
run: cmake -P .github/scripts/download-ninja-cmake.cmake | |
- name: Download ccache | |
id: ccache | |
shell: cmake -P {0} | |
run: | | |
set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz") | |
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz) | |
- name: ccache cache files | |
uses: actions/cache@v3 | |
with: | |
path: .ccache | |
key: ${{ matrix.config.name }}-ccache-${{ github.sha }} | |
restore-keys: | | |
${{ matrix.config.name }}-ccache- | |
- name: Configure | |
run: cmake -P .github/scripts/configure.cmake | |
- name: Build | |
run: cmake -P .github/scripts/build.cmake | |
- name: Run tests | |
run: cmake -P .github/scripts/test.cmake | |
build-linux-aarch64: | |
name: Ubuntu 20.04 ARM64 Clang 10 | |
runs-on: ubuntu-20.04 | |
env: | |
CC: clang-10 | |
CXX: clang++-10 | |
CI_JOB_ID: ${{ github.sha }} # Tell CMake it's running in CI | |
OPENMP_VAR: Off | |
GPU_VAR: Off | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: ccache cache files | |
id: cache-ccache | |
uses: actions/cache@v3 | |
with: | |
path: .ccache | |
key: ${{ github.job }}-ccache-${{ github.sha }} | |
restore-keys: ${{ github.job }}-ccache- | |
- name: Build | |
uses: uraimo/run-on-arch-action@v2 | |
with: | |
arch: aarch64 | |
distro: ubuntu20.04 | |
githubToken: ${{ github.token }} | |
dockerRunArgs: | | |
--volume "${PWD}:/Gromacs" -e GITHUB_PATH -e RUNNER_OS -e "RUNNER_ARCH=ARM64" -e CMAKE_VERSION -e NINJA_VERSION -e GPU_VAR -e BUILD_TYPE -e OPENMP_VAR -e CC -e CXX -e CI_JOB_ID | |
install: | | |
apt-get update -q -y | |
apt-get install -q -y clang-10 cmake ninja-build ccache git | |
run: | | |
set -x | |
cd /Gromacs | |
git config --global --add safe.directory /Gromacs | |
export GITHUB_WORKSPACE=$PWD | |
export CMAKE_VERSION=3.24.2 # use a newer version that has an aarch64 archive | |
cmake -P .github/scripts/download-ninja-cmake.cmake | |
export PATH=$GITHUB_WORKSPACE/cmake-${CMAKE_VERSION}-linux-aarch64/bin:$PATH | |
cmake -P .github/scripts/configure.cmake | |
cmake -P .github/scripts/build.cmake | |
cmake -P .github/scripts/test.cmake | |