build.sh 1.81 KB
Newer Older
1 2 3 4
#!/usr/bin/env bash
# Part of Vagrant virtual development environments for SOCI

# Builds and tests SOCI from git master branch
5
source /vagrant/scripts/vagrant/common.env
6

7 8
# Build SOCI in /home/vagrant on Linux filesystem,
# outside /vagrant which is VM shared directory.
9 10 11 12 13
# Otherwise, CMake will fail:
# CMake Error: cmake_symlink_library: System Error: Protocol error
# Explanation from https://github.com/mitchellh/vagrant/issues/713
# The VirtualBox shared folder filesystem doesn't allow symlinks, unfortunately.
# Your only option is to deploy outside of the shared folders.
14 15
if [[ ! -d "${SOCI_BUILD}" ]] ; then
  mkdir -p ${SOCI_BUILD}
16 17
fi

18 19
echo "Build: building SOCI from sources in ${SOCI_HOME} to build in ${SOCI_BUILD}"
cd ${SOCI_BUILD} && \
20
cmake \
21
    -DSOCI_CXX_C11=ON \
22 23
    -DSOCI_TESTS=ON \
    -DSOCI_STATIC=OFF \
24
    -DSOCI_DB2=ON \
25 26 27
    -DSOCI_ODBC=OFF \
    -DSOCI_ORACLE=OFF \
    -DSOCI_EMPTY=ON \
28
    -DSOCI_FIREBIRD=ON \
29 30 31
    -DSOCI_MYSQL=ON \
    -DSOCI_POSTGRESQL=ON \
    -DSOCI_SQLITE3=ON \
32 33 34 35
    -DSOCI_DB2_TEST_CONNSTR:STRING="DATABASE=${SOCI_USER}\\;hostname=${SOCI_DB2_HOST}\\;UID=${SOCI_DB2_USER}\\;PWD=${SOCI_DB2_PASS}\\;ServiceName=50000\\;Protocol=TCPIP\\;" \
    -DSOCI_FIREBIRD_TEST_CONNSTR:STRING="service=LOCALHOST:/tmp/soci.fdb user=${SOCI_USER} password=${SOCI_PASS}" \
    -DSOCI_MYSQL_TEST_CONNSTR:STRING="host=localhost db=${SOCI_USER} user=${SOCI_USER} password=${SOCI_PASS}" \
    -DSOCI_POSTGRESQL_TEST_CONNSTR:STRING="host=localhost port=5432 dbname=${SOCI_USER} user=${SOCI_USER} password=${SOCI_PASS}" \
36
    ${SOCI_HOME} && \
37
make
38
echo "Build: building DONE"
39

40 41
# Do not run tests during provisioning, thay may fail terribly, so just build
# and let to run them manually after developer vagrant ssh'ed to the VM.
42
echo "Build: ready to test SOCI by running: cd ${SOCI_BUILD}; ctest -V --output-on-failure ."