gtsam/.travis.sh

96 lines
2.0 KiB
Bash
Raw Normal View History

2019-05-31 15:48:51 +08:00
#!/bin/bash
2020-03-27 04:03:51 +08:00
# install TBB with _debug.so files
function install_tbb()
{
2020-03-27 04:32:05 +08:00
if [ $(uname -s) == "Linux" ]; then
wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz
tar -xvf tbb44_20151115oss_lin.tgz
elif [ $(uname -s) == "Darwin" ]; then
wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz
tar -xvf tbb44_20151115oss_osx.tgz
2020-03-27 04:03:51 +08:00
fi
2020-03-27 04:32:05 +08:00
source tbb44_20151115oss/bin/tbbvars.sh intel64 linux auto_tbbroot
2020-03-27 04:03:51 +08:00
}
# common tasks before either build or test
2019-12-11 23:31:43 +08:00
function configure()
{
set -e # Make sure any error makes the script to return an error code
set -x # echo
2019-05-31 15:48:51 +08:00
SOURCE_DIR=`pwd`
BUILD_DIR=build
2019-05-31 15:48:51 +08:00
#env
git clean -fd || true
rm -fr $BUILD_DIR || true
mkdir $BUILD_DIR && cd $BUILD_DIR
if [ ! -z "$GCC_VERSION" ]; then
2019-12-11 23:31:43 +08:00
export CC=gcc-$GCC_VERSION
export CXX=g++-$GCC_VERSION
2019-05-31 15:48:51 +08:00
fi
2019-12-11 23:31:43 +08:00
2020-03-27 04:03:51 +08:00
install_tbb
2019-12-11 23:31:43 +08:00
# GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs
cmake $SOURCE_DIR \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
-DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \
2020-03-27 01:38:17 +08:00
-DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \
2019-12-24 01:21:34 +08:00
-DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \
2019-12-11 23:31:43 +08:00
-DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \
-DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
}
2019-12-11 23:31:43 +08:00
# common tasks after either build or test
function finish ()
{
# Print ccache stats
ccache -s
cd $SOURCE_DIR
}
# compile the code with the intent of populating the cache
function build ()
{
2019-12-11 23:31:43 +08:00
export GTSAM_BUILD_EXAMPLES_ALWAYS=ON
export GTSAM_BUILD_TESTS=OFF
2019-05-31 15:48:51 +08:00
2019-12-11 23:31:43 +08:00
configure
2019-05-31 15:48:51 +08:00
2019-12-11 23:31:43 +08:00
make -j2
2019-05-31 15:48:51 +08:00
finish
}
2019-05-31 15:48:51 +08:00
# run the tests
function test ()
{
2019-12-11 23:31:43 +08:00
export GTSAM_BUILD_EXAMPLES_ALWAYS=OFF
export GTSAM_BUILD_TESTS=ON
2019-06-03 06:12:08 +08:00
2019-12-11 23:31:43 +08:00
configure
# Actual build:
make -j2 check
finish
2019-05-31 15:48:51 +08:00
}
# select between build or test
case $1 in
-b)
build
;;
2019-12-11 23:31:43 +08:00
-t)
test
;;
esac