Skip to content

Fix clang-cl / g++ compilation #24

Fix clang-cl / g++ compilation

Fix clang-cl / g++ compilation #24

name: run gsw_check (alternative compilers)
on:
pull_request:
push:
#branches: [master]
workflow_dispatch:
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: windows / clang-cl (c++)
os: windows-latest
compiler: 'clang-cl' # /TP forces the file to be compiled as C++
make_tool: "nmake /E" #/E causes environment variables to override makefile macro definitions.
- name: linux / g++ (c++)
os: ubuntu-latest
compiler: 'g++'
extra_flags: '-x c++'
make_tool: "make"
- name: linux / clang (c)
os: ubuntu-latest
compiler: 'clang'
make_tool: "make"
- name: linux / clang (c++)
os: ubuntu-latest
compiler: 'clang'
extra_flags: '-x c++'
make_tool: "make"
- name: macos / g++ (c++)
os: macos-latest
compiler: 'g++'
extra_flags: '-x c++'
make_tool: "make"
- name: macos / clang (c)
os: macos-latest
compiler: 'clang'
make_tool: "make"
- name: macos / clang (c++)
os: macos-latest
compiler: 'clang'
extra_flags: '-x c++'
make_tool: "make"
fail-fast: false
env:
CC: ${{ matrix.compiler }}
EXTRA_FLAGS: ${{ matrix.extra_flags }}
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Check CC variable
shell: bash
run: |
compiler=$(${{ matrix.make_tool }} name_compiler)
extra_flags=$(${{ matrix.make_tool }} name_extra_flags)
echo "compile command: $compiler $extra_flags"
if [[ "$compiler" != *"${{ matrix.compiler }}"* ]]; then
echo "CC '${{ matrix.compiler }}'' variable not used by the make file!"
exit 1
fi
if [[ "${{ matrix.extra_flags }}"]]; then
if [[ "$extra_flags" != *"${{ matrix.extra_flags }}"* ]]; then
echo "CC '${{ matrix.extra_flags }}'' variable not used by the make file!"
exit 1
fi
fi
- name: Compile
shell: bash
run: ${{ matrix.make_tool }}
- name: Tests
shell: bash
run: |
./gsw_check