forked from zeromq/cppzmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_build.sh
executable file
·69 lines (60 loc) · 1.64 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
#!/usr/bin/env bash
set -x
set -e
BUILD_TYPE=${BUILD_TYPE:-cmake}
ZMQ_VERSION=${ZMQ_VERSION:-4.3.1}
ENABLE_DRAFTS=${ENABLE_DRAFTS:-OFF}
COVERAGE=${COVERAGE:-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 --prefix=${LIBZMQ} &&
make -j${JOBS}
make install
popd
fi
}
# build zeromq first
cppzmq_build() {
pushd .
CMAKE_PREFIX_PATH=${LIBZMQ} \
cmake -H. -B${CPPZMQ} -DENABLE_DRAFTS=${ENABLE_DRAFTS} \
-DCOVERAGE=${COVERAGE} \
${CMAKE_CPP_STD:-}
cmake --build ${CPPZMQ} -- -j${JOBS}
popd
}
cppzmq_tests() {
pushd .
cd ${CPPZMQ}
ctest -V -j${JOBS}
popd
}
cppzmq_demo() {
pushd .
CMAKE_PREFIX_PATH=${LIBZMQ}:${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