Warning, file /sdk/codevis/thirdparty/soci/scripts/ci/common.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/bin/sh
0002 # Common definitions used by SOCI build scripts in CI builds
0003 #
0004 # Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
0005 #
0006 # Note that this is a /bin/sh script because it is used from install.sh
0007 # which installs bash under FreeBSD and so we can't rely on bash being
0008 # available yet.
0009 
0010 # Stop on all errors.
0011 set -e
0012 
0013 if [ "$SOCI_CI" != "true" ] ; then
0014         echo "Running this script is only useful in the CI builds"
0015         exit 1
0016 fi
0017 
0018 backend_settings=${SOCI_SOURCE_DIR}/scripts/ci/${SOCI_CI_BACKEND}.sh
0019 if [ -f ${backend_settings} ]; then
0020     . ${backend_settings}
0021 fi
0022 
0023 #
0024 # Environment
0025 #
0026 case `uname` in
0027     Linux)
0028         num_cpus=`nproc`
0029         ;;
0030 
0031     Darwin | FreeBSD)
0032         num_cpus=`sysctl -n hw.ncpu`
0033         ;;
0034 
0035     *)
0036         num_cpus=1
0037 esac
0038 
0039 # Directory where the build happens.
0040 #
0041 # Note that the existing commands suppose that the build directory is an
0042 # immediate subdirectory of the source one, so don't change this.
0043 builddir="${SOCI_SOURCE_DIR}/_build"
0044 
0045 # These options are used for all builds.
0046 SOCI_COMMON_CMAKE_OPTIONS='
0047     -DCMAKE_BUILD_TYPE=Debug
0048     -DCMAKE_VERBOSE_MAKEFILE=ON
0049     -DSOCI_ENABLE_WERROR=ON
0050     -DSOCI_STATIC=OFF
0051     -DSOCI_TESTS=ON
0052 '
0053 
0054 if [ -n "${SOCI_CXXSTD}" ]; then
0055     SOCI_COMMON_CMAKE_OPTIONS="$SOCI_COMMON_CMAKE_OPTIONS -DCMAKE_CXX_STANDARD=${SOCI_CXXSTD}"
0056 fi
0057 
0058 if [ -n "${WITH_BOOST}" ]; then
0059     SOCI_COMMON_CMAKE_OPTIONS="$SOCI_COMMON_CMAKE_OPTIONS -DWITH_BOOST=${WITH_BOOST}"
0060 fi
0061 
0062 # These options are defaults and used by most builds, but not Valgrind one.
0063 SOCI_DEFAULT_CMAKE_OPTIONS="${SOCI_COMMON_CMAKE_OPTIONS}
0064     -DSOCI_ASAN=ON
0065     -DSOCI_DB2=OFF
0066     -DSOCI_EMPTY=OFF
0067     -DSOCI_FIREBIRD=OFF
0068     -DSOCI_MYSQL=OFF
0069     -DSOCI_ODBC=OFF
0070     -DSOCI_ORACLE=OFF
0071     -DSOCI_POSTGRESQL=OFF
0072     -DSOCI_SQLITE3=OFF
0073 "
0074 
0075 #
0076 # Functions
0077 #
0078 tmstamp()
0079 {
0080     echo -n "[$(date '+%H:%M:%S')]" ;
0081 }
0082 
0083 SOCI_APT_OPTIONS='-q -y -o=Dpkg::Use-Pty=0 --no-install-recommends'
0084 
0085 run_apt()
0086 {
0087     # Disable some (but not all) output.
0088     sudo apt-get $SOCI_APT_OPTIONS "$@"
0089 }
0090 
0091 run_make()
0092 {
0093     make -j $num_cpus
0094 }
0095 
0096 run_test()
0097 {
0098     # The example project doesn't have any tests, but otherwise their absence
0099     # is an error and means that something has gone wrong.
0100     if [ "$BUILD_EXAMPLES" == "YES" ]; then
0101         no_tests_action=ignore
0102     else
0103         no_tests_action=error
0104     fi
0105     ctest -V --output-on-failure --no-tests=${no_tests_action} "$@" .
0106 }