Speed up setup script
This commit is contained in:
parent
c7093b58ad
commit
998e2421c9
|
@ -47,7 +47,8 @@ Note that the `master` branch contains the latest fixes and features, for the
|
||||||
latest stable code may be best to switch to the latest release tag.
|
latest stable code may be best to switch to the latest release tag.
|
||||||
|
|
||||||
Run the setup script to download the content and build all dependencies. It
|
Run the setup script to download the content and build all dependencies. It
|
||||||
takes a while
|
takes a while (you can speed up the process by parallelizing the script with the
|
||||||
|
`--jobs=8` flag)
|
||||||
|
|
||||||
$ ./Setup.sh
|
$ ./Setup.sh
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ pipeline {
|
||||||
|
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
steps {
|
steps {
|
||||||
sh './Setup.sh'
|
sh './Setup.sh --jobs=12'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
61
Setup.sh
61
Setup.sh
|
@ -16,6 +16,43 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
DOC_STRING="Download and compile CARLA content and dependencies."
|
||||||
|
|
||||||
|
USAGE_STRING="Usage: $0 [-h|--help] [-s|--skip-download] [--jobs=N]"
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# -- Parse arguments -----------------------------------------------------------
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
UPDATE_SCRIPT_FLAGS=
|
||||||
|
NUMBER_OF_ASYNC_JOBS=1
|
||||||
|
|
||||||
|
OPTS=`getopt -o hs --long help,skip-download,jobs:: -n 'parse-options' -- "$@"`
|
||||||
|
|
||||||
|
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||||
|
|
||||||
|
eval set -- "$OPTS"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-s | --skip-download )
|
||||||
|
UPDATE_SCRIPT_FLAGS=--skip-download;
|
||||||
|
shift ;;
|
||||||
|
--jobs)
|
||||||
|
case "$2" in
|
||||||
|
"") NUMBER_OF_ASYNC_JOBS=4 ; shift 2 ;;
|
||||||
|
*) NUMBER_OF_ASYNC_JOBS=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
-h | --help )
|
||||||
|
echo "$DOC_STRING"
|
||||||
|
echo "$USAGE_STRING"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# -- Set up environment --------------------------------------------------------
|
# -- Set up environment --------------------------------------------------------
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
@ -61,10 +98,10 @@ cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../llvm-install" \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../llvm-install" \
|
||||||
../llvm-source
|
../llvm-source
|
||||||
|
|
||||||
make cxx
|
make -j $NUMBER_OF_ASYNC_JOBS cxx
|
||||||
|
|
||||||
#install libc++ locally in llvm-install folder
|
#install libc++ locally in llvm-install folder
|
||||||
make install-libcxx install-libcxxabi
|
make -j $NUMBER_OF_ASYNC_JOBS install-libcxx install-libcxxabi
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
|
@ -89,10 +126,13 @@ BOOST_TOOLSET="clang-3.9"
|
||||||
BOOST_CFLAGS="-fPIC -std=c++1y -stdlib=libc++ -I../llvm-install/include/c++/v1"
|
BOOST_CFLAGS="-fPIC -std=c++1y -stdlib=libc++ -I../llvm-install/include/c++/v1"
|
||||||
BOOST_LFLAGS="-stdlib=libc++ -L../llvm-install/lib"
|
BOOST_LFLAGS="-stdlib=libc++ -L../llvm-install/lib"
|
||||||
|
|
||||||
./bootstrap.sh --with-toolset=clang --prefix=../boost-install
|
./bootstrap.sh \
|
||||||
|
--with-toolset=clang \
|
||||||
|
--prefix=../boost-install \
|
||||||
|
--with-libraries=system
|
||||||
./b2 clean
|
./b2 clean
|
||||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install" -j 4 stage release
|
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install" -j $NUMBER_OF_ASYNC_JOBS stage release
|
||||||
./b2 install toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install"
|
./b2 install toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install" -j $NUMBER_OF_ASYNC_JOBS
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
|
@ -103,7 +143,7 @@ popd >/dev/null
|
||||||
# Get protobuf source
|
# Get protobuf source
|
||||||
if [[ ! -d "protobuf-source" ]]; then
|
if [[ ! -d "protobuf-source" ]]; then
|
||||||
echo "Retrieving protobuf..."
|
echo "Retrieving protobuf..."
|
||||||
git clone --depth=1 -b v3.3.0 https://github.com/google/protobuf.git protobuf-source
|
git clone --depth=1 -b v3.3.0 --recurse-submodules https://github.com/google/protobuf.git protobuf-source
|
||||||
else
|
else
|
||||||
echo "Folder protobuf-source already exists, skipping git clone..."
|
echo "Folder protobuf-source already exists, skipping git clone..."
|
||||||
fi
|
fi
|
||||||
|
@ -118,9 +158,10 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/../llvm-install/lib/"
|
||||||
CXX="clang++-3.9" \
|
CXX="clang++-3.9" \
|
||||||
CXXFLAGS="-fPIC -stdlib=libc++ -I$PWD/../llvm-install/include/c++/v1" \
|
CXXFLAGS="-fPIC -stdlib=libc++ -I$PWD/../llvm-install/include/c++/v1" \
|
||||||
LDFLAGS="-stdlib=libc++ -L$PWD/../llvm-install/lib/" \
|
LDFLAGS="-stdlib=libc++ -L$PWD/../llvm-install/lib/" \
|
||||||
--prefix="$PWD/../protobuf-install"
|
--prefix="$PWD/../protobuf-install" \
|
||||||
make
|
--disable-shared
|
||||||
make install
|
make -j $NUMBER_OF_ASYNC_JOBS
|
||||||
|
make -j $NUMBER_OF_ASYNC_JOBS install
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
|
@ -171,7 +212,7 @@ fi
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
echo
|
echo
|
||||||
./Update.sh $@
|
./Update.sh $UPDATE_SCRIPT_FLAGS
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# -- ...and we are done --------------------------------------------------------
|
# -- ...and we are done --------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue