mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 18:40:28 +01:00
380e39856b
cppzmq does not follow other zeromq projects where draft builds are enabled by default for git repository. Solution: revert back code where ENABLE_DRAFTS in set to ON if .git directory exists
72 lines
1.6 KiB
Bash
Executable File
72 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -x
|
|
set -e
|
|
|
|
BUILD_TYPE=${BUILD_TYPE:-cmake}
|
|
ZMQ_VERSION=${ZMQ_VERSION:-4.2.5}
|
|
ENABLE_DRAFTS=${ENABLE_DRAFTS:-OFF}
|
|
LIBZMQ=${PWD}/libzmq-build
|
|
CPPZMQ=${PWD}/cppzmq-build
|
|
# Travis machines have 2 cores
|
|
JOBS=2
|
|
|
|
libzmq_install() {
|
|
curl -L https://github.com/zeromq/libzmq/archive/v"${ZMQ_VERSION}".tar.gz \
|
|
>zeromq.tar.gz
|
|
tar -xvzf zeromq.tar.gz
|
|
if [ "${BUILD_TYPE}" = "cmake" ] ; then
|
|
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
|
|
-DZMQ_BUILD_TESTS=OFF \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DENABLE_DRAFTS=${ENABLE_DRAFTS}
|
|
cmake --build ${LIBZMQ} -- -j${JOBS}
|
|
elif [ "${BUILD_TYPE}" = "pkgconfig" ] ; then
|
|
pushd .
|
|
cd libzmq-${ZMQ_VERSION}
|
|
./autogen.sh &&
|
|
./configure &&
|
|
make VERBOSE=1 -j${JOBS}
|
|
sudo make install
|
|
popd
|
|
fi
|
|
}
|
|
|
|
|
|
# build zeromq first
|
|
cppzmq_build() {
|
|
pushd .
|
|
if [ "${BUILD_TYPE}" = "cmake" ] ; then
|
|
export ZeroMQ_DIR=${LIBZMQ}
|
|
fi
|
|
cmake -H. -B${CPPZMQ} -DENABLE_DRAFTS=${ENABLE_DRAFTS}
|
|
cmake --build ${CPPZMQ} -- -j${JOBS}
|
|
popd
|
|
}
|
|
|
|
cppzmq_tests() {
|
|
pushd .
|
|
cd ${CPPZMQ}
|
|
ctest -V -j${JOBS}
|
|
popd
|
|
}
|
|
|
|
cppzmq_demo() {
|
|
pushd .
|
|
if [ "${BUILD_TYPE}" = "cmake" ] ; then
|
|
export ZeroMQ_DIR=${LIBZMQ}
|
|
fi
|
|
cppzmq_DIR=${CPPZMQ} \
|
|
cmake -Hdemo -Bdemo/build
|
|
cmake --build demo/build
|
|
cd demo/build
|
|
ctest -V
|
|
popd
|
|
}
|
|
|
|
if [ "${ZMQ_VERSION}" != "" ] ; then libzmq_install ; fi
|
|
|
|
cppzmq_build
|
|
cppzmq_tests
|
|
cppzmq_demo
|