Automatically detect clang version.

This commit is contained in:
Marcel Pi 2022-04-19 17:30:45 +02:00 committed by bernat
parent eb2bb75f58
commit 54d6116d57
4 changed files with 23 additions and 11 deletions

View File

@ -88,9 +88,13 @@ if ${BUILD_OSM2ODR} ; then
mkdir -p ${OSM2ODR_BUILD_FOLDER}
cd ${OSM2ODR_BUILD_FOLDER}
# define clang compiler
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
if [[ -z "${CARLA_CLANG_VERSION_MAJOR}" ]]; then
fatal_error "Missing clang version variable."
fi
export CC=/usr/bin/clang-$CARLA_CLANG_VERSION_MAJOR
export CXX=/usr/bin/clang++-$CARLA_CLANG_VERSION_MAJOR
cmake ${OSM2ODR_SOURCE_FOLDER} \
-G "Eclipse CDT4 - Ninja" \

View File

@ -50,8 +50,12 @@ done
source $(dirname "$0")/Environment.sh
export CC=clang
export CXX=clang++
if [[ -z "${CARLA_CLANG_VERSION_MAJOR}" ]]; then
fatal_error "Missing clang version variable."
fi
export CC=clang-$CARLA_CLANG_VERSION_MAJOR
export CXX=clang++-$CARLA_CLANG_VERSION_MAJOR
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_PYTHONAPI} ; }; then
fatal_error "Nothing selected to be done."

View File

@ -37,14 +37,16 @@ done
# -- Set up environment --------------------------------------------------------
# ==============================================================================
command -v /usr/bin/clang++ >/dev/null 2>&1 || {
echo >&2 "clang1is required, but it's not installed.";
source $(dirname "$0")/Environment.sh
command -v /usr/bin/clang++-$CARLA_CLANG_VERSION_MAJOR >/dev/null 2>&1 || {
echo >&2 "clang-$CARLA_CLANG_VERSION_MAJOR is required, but it's not installed.";
exit 1;
}
CXX_TAG=c10
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
CXX_TAG=c$CARLA_CLANG_VERSION_MAJOR
export CC=/usr/bin/clang-$CARLA_CLANG_VERSION_MAJOR
export CXX=/usr/bin/clang++-$CARLA_CLANG_VERSION_MAJOR
source $(dirname "$0")/Environment.sh
@ -148,7 +150,7 @@ for PY_VERSION in ${PY_VERSION_LIST[@]} ; do
pushd ${BOOST_BASENAME}-source >/dev/null
BOOST_TOOLSET="clang"
BOOST_TOOLSET="clang-$CARLA_CLANG_VERSION_MAJOR.0"
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY"
py3="/usr/bin/env python${PY_VERSION}"

View File

@ -1,5 +1,7 @@
# Here CURDIR is assumed to be the root folder of the project.
export CARLA_CLANG_VERSION_MAJOR=$(cut -d'.' -f1 <<<"$(clang -dumpversion)")
CARLA_ROOT_FOLDER=${CURDIR}
CARLA_BUILD_FOLDER=${CURDIR}/Build
CARLA_DIST_FOLDER=${CURDIR}/Dist