2018-03-28 11:44:20 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -x
|
2018-04-03 12:35:39 +02:00
|
|
|
set -e
|
2018-03-28 11:44:20 +02:00
|
|
|
|
2018-05-15 21:57:19 +02:00
|
|
|
BUILD_TYPE=${BUILD_TYPE:-cmake}
|
2019-02-04 10:32:46 +01:00
|
|
|
ZMQ_VERSION=${ZMQ_VERSION:-4.3.1}
|
2018-05-23 19:34:44 +02:00
|
|
|
ENABLE_DRAFTS=${ENABLE_DRAFTS:-OFF}
|
2018-06-02 18:25:37 +02:00
|
|
|
COVERAGE=${COVERAGE:-OFF}
|
2018-05-13 16:21:06 +02:00
|
|
|
LIBZMQ=${PWD}/libzmq-build
|
|
|
|
CPPZMQ=${PWD}/cppzmq-build
|
2018-05-13 17:32:01 +02:00
|
|
|
# Travis machines have 2 cores
|
|
|
|
JOBS=2
|
2018-05-13 16:21:06 +02:00
|
|
|
|
2018-05-16 21:30:35 +02:00
|
|
|
libzmq_install() {
|
2018-05-16 21:52:27 +02:00
|
|
|
curl -L https://github.com/zeromq/libzmq/archive/v"${ZMQ_VERSION}".tar.gz \
|
2018-05-12 19:27:42 +02:00
|
|
|
>zeromq.tar.gz
|
2018-03-28 11:44:20 +02:00
|
|
|
tar -xvzf zeromq.tar.gz
|
2018-05-16 21:52:27 +02:00
|
|
|
if [ "${BUILD_TYPE}" = "cmake" ] ; then
|
2018-05-15 21:57:19 +02:00
|
|
|
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
|
|
|
|
-DZMQ_BUILD_TESTS=OFF \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2018-05-23 19:34:44 +02:00
|
|
|
-DENABLE_DRAFTS=${ENABLE_DRAFTS}
|
2018-05-15 21:57:19 +02:00
|
|
|
cmake --build ${LIBZMQ} -- -j${JOBS}
|
2018-05-16 21:52:27 +02:00
|
|
|
elif [ "${BUILD_TYPE}" = "pkgconfig" ] ; then
|
2018-05-15 21:57:19 +02:00
|
|
|
pushd .
|
|
|
|
cd libzmq-${ZMQ_VERSION}
|
|
|
|
./autogen.sh &&
|
2018-05-23 20:31:07 +02:00
|
|
|
./configure --prefix=${LIBZMQ} &&
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
2018-05-15 21:57:19 +02:00
|
|
|
popd
|
|
|
|
fi
|
2018-03-28 11:44:20 +02:00
|
|
|
}
|
|
|
|
|
2018-05-16 21:30:35 +02:00
|
|
|
|
2018-03-28 11:44:20 +02:00
|
|
|
# build zeromq first
|
2018-05-16 21:30:35 +02:00
|
|
|
cppzmq_build() {
|
|
|
|
pushd .
|
2018-05-23 20:31:07 +02:00
|
|
|
CMAKE_PREFIX_PATH=${LIBZMQ} \
|
2018-06-02 18:25:37 +02:00
|
|
|
cmake -H. -B${CPPZMQ} -DENABLE_DRAFTS=${ENABLE_DRAFTS} \
|
2019-08-31 00:23:52 +02:00
|
|
|
-DCOVERAGE=${COVERAGE} \
|
|
|
|
${CMAKE_CPP_STD:-}
|
2018-05-16 21:30:35 +02:00
|
|
|
cmake --build ${CPPZMQ} -- -j${JOBS}
|
|
|
|
popd
|
|
|
|
}
|
2018-03-28 11:44:20 +02:00
|
|
|
|
2018-05-16 21:30:35 +02:00
|
|
|
cppzmq_tests() {
|
|
|
|
pushd .
|
|
|
|
cd ${CPPZMQ}
|
|
|
|
ctest -V -j${JOBS}
|
|
|
|
popd
|
|
|
|
}
|
2018-03-28 11:44:20 +02:00
|
|
|
|
2018-05-16 21:30:35 +02:00
|
|
|
cppzmq_demo() {
|
2018-05-15 22:36:04 +02:00
|
|
|
pushd .
|
2018-05-23 20:31:07 +02:00
|
|
|
CMAKE_PREFIX_PATH=${LIBZMQ}:${CPPZMQ} \
|
2018-05-16 21:30:35 +02:00
|
|
|
cmake -Hdemo -Bdemo/build
|
|
|
|
cmake --build demo/build
|
|
|
|
cd demo/build
|
|
|
|
ctest -V
|
2018-05-15 22:36:04 +02:00
|
|
|
popd
|
2018-05-16 21:30:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "${ZMQ_VERSION}" != "" ] ; then libzmq_install ; fi
|
|
|
|
|
|
|
|
cppzmq_build
|
|
|
|
cppzmq_tests
|
|
|
|
cppzmq_demo
|