2018-07-04 17:59:59 +08:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Set up environment --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
command -v /usr/bin/clang++-7 >/dev/null 2>&1 || {
|
|
|
|
echo >&2 "clang 7 is required, but it's not installed.";
|
2018-07-04 17:59:59 +08:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
CXX_TAG=c7
|
|
|
|
export CC=/usr/bin/clang-7
|
|
|
|
export CXX=/usr/bin/clang++-7
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
source $(dirname "$0")/Environment.sh
|
|
|
|
|
|
|
|
mkdir -p ${CARLA_BUILD_FOLDER}
|
|
|
|
pushd ${CARLA_BUILD_FOLDER} >/dev/null
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Get and compile libc++ ----------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
LLVM_BASENAME=llvm-7.0
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
LLVM_INCLUDE=${PWD}/${LLVM_BASENAME}-install/include/c++/v1
|
|
|
|
LLVM_LIBPATH=${PWD}/${LLVM_BASENAME}-install/lib
|
|
|
|
|
|
|
|
if [[ -d "${LLVM_BASENAME}-install" ]] ; then
|
|
|
|
log "${LLVM_BASENAME} already installed."
|
|
|
|
else
|
|
|
|
rm -Rf ${LLVM_BASENAME}-source ${LLVM_BASENAME}-build
|
|
|
|
|
|
|
|
log "Retrieving libc++."
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/llvm.git ${LLVM_BASENAME}-source
|
|
|
|
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/libcxx.git ${LLVM_BASENAME}-source/projects/libcxx
|
|
|
|
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/libcxxabi.git ${LLVM_BASENAME}-source/projects/libcxxabi
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
log "Compiling libc++."
|
|
|
|
|
|
|
|
mkdir -p ${LLVM_BASENAME}-build
|
|
|
|
|
|
|
|
pushd ${LLVM_BASENAME}-build >/dev/null
|
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
2019-01-27 00:27:14 +08:00
|
|
|
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
|
|
|
|
-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
|
|
|
|
-DLLVM_ENABLE_EH=OFF \
|
2018-07-04 17:59:59 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../${LLVM_BASENAME}-install" \
|
|
|
|
../${LLVM_BASENAME}-source
|
|
|
|
|
|
|
|
ninja cxx
|
|
|
|
|
|
|
|
ninja install-libcxx
|
|
|
|
|
|
|
|
ninja install-libcxxabi
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
rm -Rf ${LLVM_BASENAME}-source ${LLVM_BASENAME}-build
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset LLVM_BASENAME
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Get boost includes --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-01-10 02:50:27 +08:00
|
|
|
BOOST_VERSION=1.69.0
|
2019-04-30 19:41:13 +08:00
|
|
|
BOOST_BASENAME="boost-${BOOST_VERSION}-${CXX_TAG}"
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
BOOST_INCLUDE=${PWD}/${BOOST_BASENAME}-install/include
|
2018-07-26 23:51:33 +08:00
|
|
|
BOOST_LIBPATH=${PWD}/${BOOST_BASENAME}-install/lib
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
if [[ -d "${BOOST_BASENAME}-install" ]] ; then
|
|
|
|
log "${BOOST_BASENAME} already installed."
|
|
|
|
else
|
|
|
|
|
2018-07-26 23:51:33 +08:00
|
|
|
rm -Rf ${BOOST_BASENAME}-source
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
BOOST_PACKAGE_BASENAME=boost_${BOOST_VERSION//./_}
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Retrieving boost."
|
2019-04-30 19:41:13 +08:00
|
|
|
wget "https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/${BOOST_PACKAGE_BASENAME}.tar.gz"
|
|
|
|
|
|
|
|
log "Extracting boost for Python 2."
|
|
|
|
tar -xzf ${BOOST_PACKAGE_BASENAME}.tar.gz
|
2018-07-04 17:59:59 +08:00
|
|
|
mkdir -p ${BOOST_BASENAME}-install/include
|
2019-04-30 19:41:13 +08:00
|
|
|
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
|
2018-07-26 23:51:33 +08:00
|
|
|
|
|
|
|
pushd ${BOOST_BASENAME}-source >/dev/null
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
BOOST_TOOLSET="clang-7.1"
|
2018-07-26 23:51:33 +08:00
|
|
|
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY"
|
|
|
|
|
2018-11-08 02:45:59 +08:00
|
|
|
py2="/usr/bin/env python2"
|
|
|
|
py2_root=`${py2} -c "import sys; print(sys.prefix)"`
|
2018-11-10 07:52:33 +08:00
|
|
|
pyv=`$py2 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";`
|
2018-07-26 23:51:33 +08:00
|
|
|
./bootstrap.sh \
|
|
|
|
--with-toolset=clang \
|
|
|
|
--prefix=../boost-install \
|
2018-10-16 01:41:51 +08:00
|
|
|
--with-libraries=python,filesystem \
|
2018-11-08 02:45:59 +08:00
|
|
|
--with-python=${py2} --with-python-root=${py2_root}
|
2018-12-05 01:57:57 +08:00
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
if ${TRAVIS} ; then
|
2018-12-05 01:57:57 +08:00
|
|
|
echo "using python : ${pyv} : ${py2_root}/bin/python2 ;" > ${HOME}/user-config.jam
|
|
|
|
else
|
|
|
|
echo "using python : ${pyv} : ${py2_root}/bin/python2 ;" > project-config.jam
|
|
|
|
fi
|
|
|
|
|
2018-10-16 01:41:51 +08:00
|
|
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
|
|
|
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install
|
|
|
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} --clean-all
|
2018-11-08 01:44:28 +08:00
|
|
|
|
2018-11-10 07:52:33 +08:00
|
|
|
# Get rid of python2 build artifacts completely & do a clean build for python3
|
|
|
|
popd >/dev/null
|
|
|
|
rm -Rf ${BOOST_BASENAME}-source
|
2019-04-30 19:41:13 +08:00
|
|
|
|
|
|
|
log "Extracting boost for Python 3."
|
|
|
|
tar -xzf ${BOOST_PACKAGE_BASENAME}.tar.gz
|
2018-11-10 07:52:33 +08:00
|
|
|
mkdir -p ${BOOST_BASENAME}-install/include
|
2019-04-30 19:41:13 +08:00
|
|
|
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
|
|
|
|
|
2018-11-10 07:52:33 +08:00
|
|
|
pushd ${BOOST_BASENAME}-source >/dev/null
|
2018-10-16 01:41:51 +08:00
|
|
|
|
2018-11-08 02:45:59 +08:00
|
|
|
py3="/usr/bin/env python3"
|
|
|
|
py3_root=`${py3} -c "import sys; print(sys.prefix)"`
|
2018-11-10 07:52:33 +08:00
|
|
|
pyv=`$py3 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";`
|
2018-10-16 01:41:51 +08:00
|
|
|
./bootstrap.sh \
|
|
|
|
--with-toolset=clang \
|
|
|
|
--prefix=../boost-install \
|
|
|
|
--with-libraries=python \
|
2018-11-08 02:45:59 +08:00
|
|
|
--with-python=${py3} --with-python-root=${py3_root}
|
2018-12-05 01:57:57 +08:00
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
if ${TRAVIS} ; then
|
2018-12-05 01:57:57 +08:00
|
|
|
echo "using python : ${pyv} : ${py3_root}/bin/python3 ;" > ${HOME}/user-config.jam
|
|
|
|
else
|
|
|
|
echo "using python : ${pyv} : ${py3_root}/bin/python3 ;" > project-config.jam
|
|
|
|
fi
|
|
|
|
|
2018-10-16 01:41:51 +08:00
|
|
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
|
|
|
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install
|
2018-07-26 23:51:33 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
rm -Rf ${BOOST_BASENAME}-source
|
2019-04-30 19:41:13 +08:00
|
|
|
rm ${BOOST_PACKAGE_BASENAME}.tar.gz
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset BOOST_BASENAME
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Get rpclib and compile it with libc++ and libstdc++ -----------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-07-04 01:19:57 +08:00
|
|
|
RPCLIB_PATCH=v2.2.1_c2
|
2019-04-30 19:41:13 +08:00
|
|
|
RPCLIB_BASENAME=rpclib-${RPCLIB_PATCH}-${CXX_TAG}
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
RPCLIB_LIBCXX_INCLUDE=${PWD}/${RPCLIB_BASENAME}-libcxx-install/include
|
|
|
|
RPCLIB_LIBCXX_LIBPATH=${PWD}/${RPCLIB_BASENAME}-libcxx-install/lib
|
|
|
|
RPCLIB_LIBSTDCXX_INCLUDE=${PWD}/${RPCLIB_BASENAME}-libstdcxx-install/include
|
|
|
|
RPCLIB_LIBSTDCXX_LIBPATH=${PWD}/${RPCLIB_BASENAME}-libstdcxx-install/lib
|
|
|
|
|
|
|
|
if [[ -d "${RPCLIB_BASENAME}-libcxx-install" && -d "${RPCLIB_BASENAME}-libstdcxx-install" ]] ; then
|
|
|
|
log "${RPCLIB_BASENAME} already installed."
|
|
|
|
else
|
|
|
|
rm -Rf \
|
|
|
|
${RPCLIB_BASENAME}-source \
|
|
|
|
${RPCLIB_BASENAME}-libcxx-build ${RPCLIB_BASENAME}-libstdcxx-build \
|
|
|
|
${RPCLIB_BASENAME}-libcxx-install ${RPCLIB_BASENAME}-libstdcxx-install
|
|
|
|
|
|
|
|
log "Retrieving rpclib."
|
|
|
|
|
2019-01-30 21:17:17 +08:00
|
|
|
git clone -b ${RPCLIB_PATCH} https://github.com/carla-simulator/rpclib.git ${RPCLIB_BASENAME}-source
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
log "Building rpclib with libc++."
|
|
|
|
|
2018-11-08 01:44:28 +08:00
|
|
|
# rpclib does not use any cmake 3.9 feature.
|
2018-11-20 21:18:40 +08:00
|
|
|
# As cmake 3.9 is not standard in Ubuntu 16.04, change cmake version to 3.5
|
|
|
|
sed -i s/"3.9.0"/"3.5.0"/g ${RPCLIB_BASENAME}-source/CMakeLists.txt
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
mkdir -p ${RPCLIB_BASENAME}-libcxx-build
|
|
|
|
|
|
|
|
pushd ${RPCLIB_BASENAME}-libcxx-build >/dev/null
|
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
2019-01-26 20:23:52 +08:00
|
|
|
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -Wl,-L${LLVM_LIBPATH} -DBOOST_NO_EXCEPTIONS -DASIO_NO_EXCEPTIONS" \
|
2018-07-04 17:59:59 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX="../${RPCLIB_BASENAME}-libcxx-install" \
|
|
|
|
../${RPCLIB_BASENAME}-source
|
|
|
|
|
|
|
|
ninja
|
|
|
|
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
log "Building rpclib with libstdc++."
|
|
|
|
|
|
|
|
mkdir -p ${RPCLIB_BASENAME}-libstdcxx-build
|
|
|
|
|
|
|
|
pushd ${RPCLIB_BASENAME}-libstdcxx-build >/dev/null
|
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
2018-07-13 18:39:23 +08:00
|
|
|
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14" \
|
2018-07-04 17:59:59 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX="../${RPCLIB_BASENAME}-libstdcxx-install" \
|
|
|
|
../${RPCLIB_BASENAME}-source
|
|
|
|
|
|
|
|
ninja
|
|
|
|
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
rm -Rf ${RPCLIB_BASENAME}-source ${RPCLIB_BASENAME}-libcxx-build ${RPCLIB_BASENAME}-libstdcxx-build
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset RPCLIB_BASENAME
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Get GTest and compile it with libc++ --------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-04-30 23:13:10 +08:00
|
|
|
GTEST_VERSION=1.8.1
|
2019-04-30 19:41:13 +08:00
|
|
|
GTEST_BASENAME=gtest-${GTEST_VERSION}-${CXX_TAG}
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
GTEST_LIBCXX_INCLUDE=${PWD}/${GTEST_BASENAME}-libcxx-install/include
|
|
|
|
GTEST_LIBCXX_LIBPATH=${PWD}/${GTEST_BASENAME}-libcxx-install/lib
|
|
|
|
GTEST_LIBSTDCXX_INCLUDE=${PWD}/${GTEST_BASENAME}-libstdcxx-install/include
|
|
|
|
GTEST_LIBSTDCXX_LIBPATH=${PWD}/${GTEST_BASENAME}-libstdcxx-install/lib
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
if [[ -d "${GTEST_BASENAME}-libcxx-install" && -d "${GTEST_BASENAME}-libstdcxx-install" ]] ; then
|
2018-07-04 17:59:59 +08:00
|
|
|
log "${GTEST_BASENAME} already installed."
|
|
|
|
else
|
2019-01-27 00:27:14 +08:00
|
|
|
rm -Rf \
|
|
|
|
${GTEST_BASENAME}-source \
|
|
|
|
${GTEST_BASENAME}-libcxx-build ${GTEST_BASENAME}-libstdcxx-build \
|
|
|
|
${GTEST_BASENAME}-libcxx-install ${GTEST_BASENAME}-libstdcxx-install
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
log "Retrieving Google Test."
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
git clone --depth=1 -b release-${GTEST_VERSION} https://github.com/google/googletest.git ${GTEST_BASENAME}-source
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
log "Building Google Test with libc++."
|
|
|
|
|
|
|
|
mkdir -p ${GTEST_BASENAME}-libcxx-build
|
|
|
|
|
|
|
|
pushd ${GTEST_BASENAME}-libcxx-build >/dev/null
|
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -Wl,-L${LLVM_LIBPATH} -DBOOST_NO_EXCEPTIONS -fno-exceptions" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="../${GTEST_BASENAME}-libcxx-install" \
|
|
|
|
../${GTEST_BASENAME}-source
|
|
|
|
|
|
|
|
ninja
|
|
|
|
|
|
|
|
ninja install
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
popd >/dev/null
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
log "Building Google Test with libstdc++."
|
|
|
|
|
|
|
|
mkdir -p ${GTEST_BASENAME}-libstdcxx-build
|
|
|
|
|
|
|
|
pushd ${GTEST_BASENAME}-libstdcxx-build >/dev/null
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
2019-01-27 00:27:14 +08:00
|
|
|
-DCMAKE_CXX_FLAGS="-std=c++14" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="../${GTEST_BASENAME}-libstdcxx-install" \
|
2018-07-04 17:59:59 +08:00
|
|
|
../${GTEST_BASENAME}-source
|
|
|
|
|
|
|
|
ninja
|
|
|
|
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
rm -Rf ${GTEST_BASENAME}-source ${GTEST_BASENAME}-libcxx-build ${GTEST_BASENAME}-libstdcxx-build
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2019-01-27 00:27:14 +08:00
|
|
|
unset GTEST_BASENAME
|
|
|
|
|
2019-05-28 00:17:37 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Get Recast&Detour and compile it with libc++ ------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-12-02 21:54:56 +08:00
|
|
|
RECAST_HASH=32ee67
|
|
|
|
RECAST_COMMIT=32ee6788793651f815413bf8bed326a15110dff9
|
2019-11-21 21:33:08 +08:00
|
|
|
RECAST_BASENAME=recast-${RECAST_HASH}-${CXX_TAG}
|
2019-05-28 00:17:37 +08:00
|
|
|
|
|
|
|
RECAST_INCLUDE=${PWD}/${RECAST_BASENAME}-install/include
|
|
|
|
RECAST_LIBPATH=${PWD}/${RECAST_BASENAME}-install/lib
|
|
|
|
|
|
|
|
if [[ -d "${RECAST_BASENAME}-install" ]] ; then
|
|
|
|
log "${RECAST_BASENAME} already installed."
|
|
|
|
else
|
|
|
|
rm -Rf \
|
|
|
|
${RECAST_BASENAME}-source \
|
|
|
|
${RECAST_BASENAME}-build \
|
|
|
|
${RECAST_BASENAME}-install
|
|
|
|
|
|
|
|
log "Retrieving Recast & Detour"
|
|
|
|
|
2019-09-20 21:33:09 +08:00
|
|
|
git clone https://github.com/carla-simulator/recastnavigation.git ${RECAST_BASENAME}-source
|
2019-05-28 00:17:37 +08:00
|
|
|
|
|
|
|
pushd ${RECAST_BASENAME}-source >/dev/null
|
|
|
|
|
|
|
|
git reset --hard ${RECAST_COMMIT}
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
log "Building Recast & Detour with libc++."
|
|
|
|
|
|
|
|
mkdir -p ${RECAST_BASENAME}-build
|
|
|
|
|
|
|
|
pushd ${RECAST_BASENAME}-build >/dev/null
|
|
|
|
|
|
|
|
cmake -G "Ninja" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-std=c++14 -fPIC" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="../${RECAST_BASENAME}-install" \
|
2019-06-14 20:08:40 +08:00
|
|
|
-DRECASTNAVIGATION_DEMO=False \
|
|
|
|
-DRECASTNAVIGATION_TEST=False \
|
2019-05-28 00:17:37 +08:00
|
|
|
../${RECAST_BASENAME}-source
|
|
|
|
|
|
|
|
ninja
|
|
|
|
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
rm -Rf ${RECAST_BASENAME}-source ${RECAST_BASENAME}-build
|
|
|
|
|
2019-06-13 23:40:17 +08:00
|
|
|
# move headers inside 'recast' folder
|
|
|
|
mkdir -p "${PWD}/${RECAST_BASENAME}-install/include/recast"
|
|
|
|
mv "${PWD}/${RECAST_BASENAME}-install/include/"*h "${PWD}/${RECAST_BASENAME}-install/include/recast/"
|
|
|
|
|
2019-05-28 00:17:37 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
unset RECAST_BASENAME
|
|
|
|
|
2019-03-12 22:09:32 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Generate Version.h --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-03-20 05:41:42 +08:00
|
|
|
CARLA_VERSION=$(get_git_repository_version)
|
2019-03-12 22:09:32 +08:00
|
|
|
|
|
|
|
log "CARLA version ${CARLA_VERSION}."
|
|
|
|
|
|
|
|
VERSION_H_FILE=${LIBCARLA_ROOT_FOLDER}/source/carla/Version.h
|
|
|
|
VERSION_H_FILE_GEN=${CARLA_BUILD_FOLDER}/Version.h
|
|
|
|
|
|
|
|
sed -e "s|\${CARLA_VERSION}|${CARLA_VERSION}|g" ${VERSION_H_FILE}.in > ${VERSION_H_FILE_GEN}
|
|
|
|
|
|
|
|
move_if_changed "${VERSION_H_FILE_GEN}" "${VERSION_H_FILE}"
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Generate CMake toolchains and config --------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
log "Generating CMake configuration files."
|
|
|
|
|
|
|
|
# -- LIBSTDCPP_TOOLCHAIN_FILE --------------------------------------------------
|
|
|
|
|
|
|
|
cat >${LIBSTDCPP_TOOLCHAIN_FILE}.gen <<EOL
|
|
|
|
# Automatically generated by `basename "$0"`
|
|
|
|
|
|
|
|
set(CMAKE_C_COMPILER ${CC})
|
|
|
|
set(CMAKE_CXX_COMPILER ${CXX})
|
|
|
|
|
2018-07-13 18:39:23 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fPIC" CACHE STRING "" FORCE)
|
2019-04-23 18:13:34 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Wdeprecated -Wshadow -Wuninitialized -Wunreachable-code" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Wpessimizing-move -Wold-style-cast -Wnull-dereference" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Wduplicate-enum -Wnon-virtual-dtor -Wheader-hygiene" CACHE STRING "" FORCE)
|
2019-04-24 02:29:12 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Wconversion -Wfloat-overflow-conversion" CACHE STRING "" FORCE)
|
2018-10-19 18:16:04 +08:00
|
|
|
|
|
|
|
# @todo These flags need to be compatible with setup.py compilation.
|
2019-03-12 22:54:37 +08:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE_CLIENT "\${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -std=c++14 -Wno-missing-braces -DBOOST_ERROR_CODE_HEADER_ONLY -DLIBCARLA_WITH_PYTHON_SUPPORT" CACHE STRING "" FORCE)
|
2018-07-04 17:59:59 +08:00
|
|
|
EOL
|
|
|
|
|
|
|
|
# -- LIBCPP_TOOLCHAIN_FILE -----------------------------------------------------
|
|
|
|
|
|
|
|
# We can reuse the previous toolchain.
|
|
|
|
cp ${LIBSTDCPP_TOOLCHAIN_FILE}.gen ${LIBCPP_TOOLCHAIN_FILE}.gen
|
|
|
|
|
|
|
|
cat >>${LIBCPP_TOOLCHAIN_FILE}.gen <<EOL
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -stdlib=libc++" CACHE STRING "" FORCE)
|
2019-04-23 18:04:56 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -isystem ${LLVM_INCLUDE}" CACHE STRING "" FORCE)
|
2019-03-26 18:45:23 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti" CACHE STRING "" FORCE)
|
2018-07-04 17:59:59 +08:00
|
|
|
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -L${LLVM_LIBPATH}" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -lc++ -lc++abi" CACHE STRING "" FORCE)
|
|
|
|
EOL
|
|
|
|
|
|
|
|
# -- CMAKE_CONFIG_FILE ---------------------------------------------------------
|
|
|
|
|
|
|
|
cat >${CMAKE_CONFIG_FILE}.gen <<EOL
|
|
|
|
# Automatically generated by `basename "$0"`
|
|
|
|
|
|
|
|
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
|
2018-10-05 02:56:19 +08:00
|
|
|
|
2019-01-26 20:23:52 +08:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Server")
|
|
|
|
add_definitions(-DASIO_NO_EXCEPTIONS)
|
|
|
|
add_definitions(-DBOOST_NO_EXCEPTIONS)
|
|
|
|
add_definitions(-DLIBCARLA_NO_EXCEPTIONS)
|
|
|
|
add_definitions(-DPUGIXML_NO_EXCEPTIONS)
|
|
|
|
endif ()
|
|
|
|
|
2018-10-08 00:46:02 +08:00
|
|
|
# Uncomment to force support for an specific image format (require their
|
|
|
|
# respective libraries installed).
|
|
|
|
# add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT)
|
2018-10-05 02:56:19 +08:00
|
|
|
# add_definitions(-DLIBCARLA_IMAGE_WITH_JPEG_SUPPORT)
|
|
|
|
# add_definitions(-DLIBCARLA_IMAGE_WITH_TIFF_SUPPORT)
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-03-20 05:41:42 +08:00
|
|
|
add_definitions(-DLIBCARLA_TEST_CONTENT_FOLDER="${LIBCARLA_TEST_CONTENT_FOLDER}")
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
set(BOOST_INCLUDE_PATH "${BOOST_INCLUDE}")
|
|
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Server")
|
|
|
|
# Here libraries linking libc++.
|
|
|
|
set(LLVM_INCLUDE_PATH "${LLVM_INCLUDE}")
|
|
|
|
set(LLVM_LIB_PATH "${LLVM_LIBPATH}")
|
|
|
|
set(RPCLIB_INCLUDE_PATH "${RPCLIB_LIBCXX_INCLUDE}")
|
|
|
|
set(RPCLIB_LIB_PATH "${RPCLIB_LIBCXX_LIBPATH}")
|
2019-01-27 00:27:14 +08:00
|
|
|
set(GTEST_INCLUDE_PATH "${GTEST_LIBCXX_INCLUDE}")
|
|
|
|
set(GTEST_LIB_PATH "${GTEST_LIBCXX_LIBPATH}")
|
2018-07-04 17:59:59 +08:00
|
|
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Client")
|
|
|
|
# Here libraries linking libstdc++.
|
|
|
|
set(RPCLIB_INCLUDE_PATH "${RPCLIB_LIBSTDCXX_INCLUDE}")
|
|
|
|
set(RPCLIB_LIB_PATH "${RPCLIB_LIBSTDCXX_LIBPATH}")
|
2019-01-27 00:27:14 +08:00
|
|
|
set(GTEST_INCLUDE_PATH "${GTEST_LIBSTDCXX_INCLUDE}")
|
|
|
|
set(GTEST_LIB_PATH "${GTEST_LIBSTDCXX_LIBPATH}")
|
2018-07-26 23:51:33 +08:00
|
|
|
set(BOOST_LIB_PATH "${BOOST_LIBPATH}")
|
2019-05-28 00:17:37 +08:00
|
|
|
set(RECAST_INCLUDE_PATH "${RECAST_INCLUDE}")
|
|
|
|
set(RECAST_LIB_PATH "${RECAST_LIBPATH}")
|
2018-07-04 17:59:59 +08:00
|
|
|
endif ()
|
2018-10-08 00:46:02 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
EOL
|
|
|
|
|
2018-10-09 20:07:11 +08:00
|
|
|
if [ "${TRAVIS}" == "true" ] ; then
|
2018-10-08 00:46:02 +08:00
|
|
|
log "Travis CI build detected: disabling PNG support."
|
|
|
|
echo "add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=false)" >> ${CMAKE_CONFIG_FILE}.gen
|
|
|
|
else
|
|
|
|
echo "add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=true)" >> ${CMAKE_CONFIG_FILE}.gen
|
|
|
|
fi
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
# -- Move files ----------------------------------------------------------------
|
|
|
|
|
|
|
|
move_if_changed "${LIBSTDCPP_TOOLCHAIN_FILE}.gen" "${LIBSTDCPP_TOOLCHAIN_FILE}"
|
|
|
|
move_if_changed "${LIBCPP_TOOLCHAIN_FILE}.gen" "${LIBCPP_TOOLCHAIN_FILE}"
|
|
|
|
move_if_changed "${CMAKE_CONFIG_FILE}.gen" "${CMAKE_CONFIG_FILE}"
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- ...and we are done --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
log "Success!"
|