Skip to content

Commit

Permalink
Problem: libzmq installed during build
Browse files Browse the repository at this point in the history
There is no need to install libzmq into the system.
Out of source build can be used later to build cppzmq.

Solution: remove install steps and rely more on cmake to handle
directory creation.
  • Loading branch information
kurdybacha committed May 12, 2018
1 parent f81accd commit f35cbe2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 28 deletions.
38 changes: 12 additions & 26 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,34 @@ set -x
set -e

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
# 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

install_zeromq() {
pushd .

mkdir libzmq
cd libzmq
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz >zeromq.tar.gz
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \
>zeromq.tar.gz
tar -xvzf zeromq.tar.gz
cd libzmq-${ZMQ_VERSION}

mkdir build
cd build
cmake .. ${ZEROMQ_CMAKE_FLAGS}
sudo make -j4 install

popd
cmake -Hlibzmq-${ZMQ_VERSION} -Blibzmq ${ZEROMQ_CMAKE_FLAGS}
cmake --build libzmq
}

# build zeromq first

if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi

# build cppzmq

pushd .
mkdir build
ZeroMQ_DIR=libzmq cmake -H. -Bbuild ${ZEROMQ_CMAKE_FLAGS}
cmake --build build
cd build
cmake .. ${ZEROMQ_CMAKE_FLAGS}
cmake --build .
sudo make -j4 install
make test ARGS="-V"
ctest -V
popd

# build cppzmq demo
cd demo
mkdir build
cd build
cmake ..
cmake --build .
ZeroMQ_DIR=libzmq cppzmq_DIR=build cmake -Hdemo -Bdemo/build
cmake --build demo/build
cd demo/build
ctest
6 changes: 4 additions & 2 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(cppzmq-demo CXX)

find_package(cppzmq)
find_package(cppzmq REQUIRED)

enable_testing()
add_executable(
Expand All @@ -12,9 +12,11 @@ add_executable(

target_link_libraries(
demo
libzmq
cppzmq
)

include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR})

add_test(
NAME
demo
Expand Down

0 comments on commit f35cbe2

Please sign in to comment.