forked from zeromq/cppzmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_build.sh
executable file
·78 lines (68 loc) · 1.84 KB
/
ci_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -x
set -e
BUILD_TYPE=${BUILD_TYPE:-cmake}
LIBZMQ=${PWD}/libzmq-build
CPPZMQ=${PWD}/cppzmq-build
ZMQ_VERSION="4.2.5"
DRAFT=${DRAFT:-0}
# Travis machines have 2 cores
JOBS=2
if [ "${DRAFT}" = "1" ] ; then
# if we enable drafts during the libzmq cmake build, the pkgconfig
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
# does not appear to work (TODO)
export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON"
fi
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 \
${ZEROMQ_CMAKE_FLAGS}
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} ${ZEROMQ_CMAKE_FLAGS}
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