Skip to content

Commit

Permalink
Merge pull request zeromq#240 from kurdybacha/draft-git
Browse files Browse the repository at this point in the history
Problem: Travis requires sudo and draft not enabled for git repo
  • Loading branch information
bluca authored May 23, 2018
2 parents 7023764 + 115bfff commit 1f14f9a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ language: cpp

dist: trusty
cache: ccache
sudo: false

matrix:
include:
Expand All @@ -16,15 +17,14 @@ matrix:
- os: osx
osx_image: xcode9.1
compiler: clang
env: DRAFT=1
env: ENABLE_DRAFTS=ON

##########################################################
# GCC on Linux
##########################################################

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

# GCC default, draft disabled, default libzmq (defined in ci_build.sh)
Expand All @@ -50,7 +50,7 @@ matrix:
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" DRAFT=1
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" ENABLE_DRAFTS=ON
# - env: BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
# os: linux
# addons:
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
message(FATAL_ERROR "ZeroMQ version not supported!")
endif()

OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
else ()
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif ()
if (ENABLE_DRAFTS)
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ before_build:
7z x v%ZMQ_VER%.zip >NUL &&
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% &&
cmake --build libzmq-%ZMQ_VER%/build --target install)
- cmake -H. -BBuild -DCMAKE_PREFIX_PATH=./libzmq -A%PLATFORM%
- cmake -H. -BBuild -DENABLE_DRAFTS=ON -DCMAKE_PREFIX_PATH=./libzmq -A%PLATFORM%

build:
project: Build/cppzmq.sln
Expand Down
30 changes: 9 additions & 21 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ 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
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
Expand All @@ -26,15 +19,15 @@ libzmq_install() {
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
-DZMQ_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
${ZEROMQ_CMAKE_FLAGS}
-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
./configure --prefix=${LIBZMQ} &&
make -j${JOBS}
make install
popd
fi
}
Expand All @@ -43,10 +36,8 @@ libzmq_install() {
# build zeromq first
cppzmq_build() {
pushd .
if [ "${BUILD_TYPE}" = "cmake" ] ; then
export ZeroMQ_DIR=${LIBZMQ}
fi
cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS}
CMAKE_PREFIX_PATH=${LIBZMQ} \
cmake -H. -B${CPPZMQ} -DENABLE_DRAFTS=${ENABLE_DRAFTS}
cmake --build ${CPPZMQ} -- -j${JOBS}
popd
}
Expand All @@ -60,10 +51,7 @@ cppzmq_tests() {

cppzmq_demo() {
pushd .
if [ "${BUILD_TYPE}" = "cmake" ] ; then
export ZeroMQ_DIR=${LIBZMQ}
fi
cppzmq_DIR=${CPPZMQ} \
CMAKE_PREFIX_PATH=${LIBZMQ}:${CPPZMQ} \
cmake -Hdemo -Bdemo/build
cmake --build demo/build
cd demo/build
Expand Down
1 change: 1 addition & 0 deletions libzmq-pkg-config/FindZeroMQ.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
find_package(PkgConfig)
pkg_check_modules(PC_LIBZMQ QUIET libzmq)

Expand Down

0 comments on commit 1f14f9a

Please sign in to comment.