Skip to content

Commit 1f14f9a

Browse files
authored
Merge pull request #240 from kurdybacha/draft-git
Problem: Travis requires sudo and draft not enabled for git repo
2 parents 7023764 + 115bfff commit 1f14f9a

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ language: cpp
44

55
dist: trusty
66
cache: ccache
7+
sudo: false
78

89
matrix:
910
include:
@@ -16,15 +17,14 @@ matrix:
1617
- os: osx
1718
osx_image: xcode9.1
1819
compiler: clang
19-
env: DRAFT=1
20+
env: ENABLE_DRAFTS=ON
2021

2122
##########################################################
2223
# GCC on Linux
2324
##########################################################
2425

2526
# GCC default, draft disabled, older libzmq with pkg-config
2627
- os: linux
27-
sudo: true
2828
env: ZMQ_VERSION=4.2.0 BUILD_TYPE=pkgconfig
2929

3030
# GCC default, draft disabled, default libzmq (defined in ci_build.sh)
@@ -50,7 +50,7 @@ matrix:
5050
packages:
5151
- g++-7
5252
env:
53-
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" DRAFT=1
53+
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" ENABLE_DRAFTS=ON
5454
# - env: BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
5555
# os: linux
5656
# addons:

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
1919
message(FATAL_ERROR "ZeroMQ version not supported!")
2020
endif()
2121

22-
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
22+
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
23+
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
24+
else ()
25+
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
26+
endif ()
2327
if (ENABLE_DRAFTS)
2428
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
2529
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ before_build:
2828
7z x v%ZMQ_VER%.zip >NUL &&
2929
cmake -H./libzmq-%ZMQ_VER% -Blibzmq-%ZMQ_VER%/build -DCMAKE_INSTALL_PREFIX=libzmq -DENABLE_DRAFTS=ON -DWITH_PERF_TOOL=OFF -DZMQ_BUILD_TESTS=OFF -DENABLE_CPACK=OFF -A%PLATFORM% &&
3030
cmake --build libzmq-%ZMQ_VER%/build --target install)
31-
- cmake -H. -BBuild -DCMAKE_PREFIX_PATH=./libzmq -A%PLATFORM%
31+
- cmake -H. -BBuild -DENABLE_DRAFTS=ON -DCMAKE_PREFIX_PATH=./libzmq -A%PLATFORM%
3232

3333
build:
3434
project: Build/cppzmq.sln

ci_build.sh

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@ set -x
44
set -e
55

66
BUILD_TYPE=${BUILD_TYPE:-cmake}
7+
ZMQ_VERSION=${ZMQ_VERSION:-4.2.5}
8+
ENABLE_DRAFTS=${ENABLE_DRAFTS:-OFF}
79
LIBZMQ=${PWD}/libzmq-build
810
CPPZMQ=${PWD}/cppzmq-build
9-
ZMQ_VERSION="4.2.5"
10-
DRAFT=${DRAFT:-0}
1111
# Travis machines have 2 cores
1212
JOBS=2
1313

14-
if [ "${DRAFT}" = "1" ] ; then
15-
# if we enable drafts during the libzmq cmake build, the pkgconfig
16-
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
17-
# does not appear to work (TODO)
18-
export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON"
19-
fi
20-
2114
libzmq_install() {
2215
curl -L https://github.com/zeromq/libzmq/archive/v"${ZMQ_VERSION}".tar.gz \
2316
>zeromq.tar.gz
@@ -26,15 +19,15 @@ libzmq_install() {
2619
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
2720
-DZMQ_BUILD_TESTS=OFF \
2821
-DCMAKE_BUILD_TYPE=Release \
29-
${ZEROMQ_CMAKE_FLAGS}
22+
-DENABLE_DRAFTS=${ENABLE_DRAFTS}
3023
cmake --build ${LIBZMQ} -- -j${JOBS}
3124
elif [ "${BUILD_TYPE}" = "pkgconfig" ] ; then
3225
pushd .
3326
cd libzmq-${ZMQ_VERSION}
3427
./autogen.sh &&
35-
./configure &&
36-
make VERBOSE=1 -j${JOBS}
37-
sudo make install
28+
./configure --prefix=${LIBZMQ} &&
29+
make -j${JOBS}
30+
make install
3831
popd
3932
fi
4033
}
@@ -43,10 +36,8 @@ libzmq_install() {
4336
# build zeromq first
4437
cppzmq_build() {
4538
pushd .
46-
if [ "${BUILD_TYPE}" = "cmake" ] ; then
47-
export ZeroMQ_DIR=${LIBZMQ}
48-
fi
49-
cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS}
39+
CMAKE_PREFIX_PATH=${LIBZMQ} \
40+
cmake -H. -B${CPPZMQ} -DENABLE_DRAFTS=${ENABLE_DRAFTS}
5041
cmake --build ${CPPZMQ} -- -j${JOBS}
5142
popd
5243
}
@@ -60,10 +51,7 @@ cppzmq_tests() {
6051

6152
cppzmq_demo() {
6253
pushd .
63-
if [ "${BUILD_TYPE}" = "cmake" ] ; then
64-
export ZeroMQ_DIR=${LIBZMQ}
65-
fi
66-
cppzmq_DIR=${CPPZMQ} \
54+
CMAKE_PREFIX_PATH=${LIBZMQ}:${CPPZMQ} \
6755
cmake -Hdemo -Bdemo/build
6856
cmake --build demo/build
6957
cd demo/build

libzmq-pkg-config/FindZeroMQ.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
12
find_package(PkgConfig)
23
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
34

0 commit comments

Comments
 (0)