Define CC and CXX environment variables correctly

They are supposed to be set to gcc-$GCC and g++-$GCC respectively, if
the suffix is defined, so do it.

Also use "compiler", rather than "CC", in the matrix for consistency
with .travis.yml and to avoid confusion between this property, which may
be empty, and CC environment variable, which is supposed to be always
defined.

Finally, show the path and the version of the compiler being used: this
was also done under Travis CI and there doesn't seem to be any reason
not to do it here.
This commit is contained in:
Vadim Zeitlin 2021-09-30 18:11:44 +02:00
commit 55dfa99e49

View file

@ -40,7 +40,7 @@ jobs:
GCC: 10
desc: gcc10
- SWIGLANG: ""
CC: clang
compiler: clang
desc: clang
- CPP11: 1
SWIGLANG: python
@ -56,7 +56,6 @@ jobs:
SWIGLANG: ${{ matrix.SWIGLANG }}
SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }}
CONFIGOPTS: ${{ matrix.CONFIGOPTS }}
CC: ${{ matrix.CC }}
CSTD: ${{ matrix.CSTD }}
CPP11: ${{ matrix.CPP11 }}
CPP14: ${{ matrix.CPP14 }}
@ -71,7 +70,7 @@ jobs:
- name: Install CCache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.CC || 'gcc' }}${{ matrix.GCC }}
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }}
- name: Configure
run: |
@ -80,6 +79,28 @@ jobs:
echo PATH="$PATH" >> $GITHUB_ENV
source Tools/GHA-linux-install.sh
if test '${{ matrix.compiler }}' = 'clang'; then
CC="clang"
CXX="clang++"
elif test -n "$GCC"; then
CC="gcc-$GCC"
CXX="g++-$GCC"
else
CC="gcc"
CXX="g++"
fi
export CC CXX
echo CC="$CC" >> $GITHUB_ENV
echo CXX="$CXX" >> $GITHUB_ENV
echo "Compiler used:"
ls -la $(which $CC) $(which $CXX)
$CC --version
$CXX --version
if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++11 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++11; fi
if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++14 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++14; fi
if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++17 $CXXFLAGS" "CFLAGS=-std=c17 $CFLAGS") && export CSTD=c17 && export CPPSTD=c++17; fi