File tree Expand file tree Collapse file tree 10 files changed +117
-20
lines changed Expand file tree Collapse file tree 10 files changed +117
-20
lines changed Original file line number Diff line number Diff line change 19
19
matrix :
20
20
# - BUILD_TYPE=cmake DRAFT=enabled
21
21
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
22
+ - BUILD_TYPE=cmake ZMQ_VERSION=4.2.0
22
23
23
24
matrix :
24
25
include :
@@ -30,15 +31,25 @@ matrix:
30
31
# - llvm-toolchain-trusty-5.0
31
32
# packages:
32
33
# - clang-5.0
34
+ - os : linux
35
+ addons :
36
+ apt :
37
+ sources :
38
+ - ubuntu-toolchain-r-test
39
+ packages :
40
+ - g++-7
41
+ env :
42
+ - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
33
43
34
44
sudo : required
35
45
36
46
before_install :
37
47
- pip install --user cpp-coveralls
38
48
39
49
# Build and check this project according to the BUILD_TYPE
40
- script :
50
+ script :
51
+ - eval "${MATRIX_EVAL}"
41
52
- ./ci_build.sh
42
53
43
54
after_success :
44
- - coveralls --root . -E ".*external.*" -E ".*CMakeFiles.*" -E ".*tests/" -E ".*libzmq/"
55
+ - coveralls --root . -E ".*external.*" -E ".*CMakeFiles.*" -E ".*tests/" -E ".*demo/" -E ".* libzmq/"
Original file line number Diff line number Diff line change @@ -19,6 +19,18 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
19
19
message (FATAL_ERROR "ZeroMQ version not supported!" )
20
20
endif ()
21
21
22
+ if (EXISTS "${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 ()
27
+ IF (ENABLE_DRAFTS )
28
+ ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API )
29
+ set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1" )
30
+ ELSE (ENABLE_DRAFTS )
31
+ set (pkg_config_defines "" )
32
+ ENDIF (ENABLE_DRAFTS )
33
+
22
34
message (STATUS "cppzmq v${CPPZMQ_VERSION} " )
23
35
24
36
set (CPPZMQ_HEADERS
@@ -63,3 +75,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
63
75
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR} )
64
76
install (FILES ${CMAKE_CURRENT_SOURCE_DIR} /libzmq-pkg-config/FindZeroMQ.cmake
65
77
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR} /libzmq-pkg-config )
78
+
79
+ enable_testing ()
80
+ add_subdirectory (tests )
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
set -x
4
+ set -e
5
+
6
+ if [ " $DRAFT " = " 1" ] ; then
7
+ # if we enable drafts during the libzmq cmake build, the pkgconfig
8
+ # data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
9
+ # does not appear to work (TODO)
10
+ export ZEROMQ_CMAKE_FLAGS=" -DENABLE_DRAFTS=ON"
11
+ fi
4
12
5
13
install_zeromq () {
6
14
pushd .
@@ -13,7 +21,7 @@ install_zeromq() {
13
21
14
22
mkdir build
15
23
cd build
16
- cmake ..
24
+ cmake .. ${ZEROMQ_CMAKE_FLAGS}
17
25
sudo make -j4 install
18
26
19
27
popd
@@ -28,12 +36,14 @@ if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi
28
36
pushd .
29
37
mkdir build
30
38
cd build
31
- cmake ..
39
+ cmake .. ${ZEROMQ_CMAKE_FLAGS}
40
+ cmake --build .
32
41
sudo make -j4 install
42
+ make test ARGS=" -V"
33
43
popd
34
44
35
- # build cppzmq tests
36
- cd tests
45
+ # build cppzmq demo
46
+ cd demo
37
47
mkdir build
38
48
cd build
39
49
cmake ..
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.0 FATAL_ERROR )
2
+
3
+ project (cppzmq-demo CXX )
4
+
5
+ find_package (cppzmq )
6
+
7
+ enable_testing ()
8
+ add_executable (
9
+ demo
10
+ main.cpp
11
+ )
12
+
13
+ target_link_libraries (
14
+ demo
15
+ libzmq
16
+ )
17
+
18
+ add_test (
19
+ NAME
20
+ demo
21
+ COMMAND
22
+ ${CMAKE_BINARY_DIR} /${CMAKE_INSTALL_BINDIR}/demo
23
+ )
Original file line number Diff line number Diff line change 1
- #include " gtest/gtest.h"
2
1
#include < zmq.hpp>
3
2
4
- TEST (create_context, add )
3
+ int main ( int argc, char ** argv )
5
4
{
6
5
zmq::context_t context;
7
6
8
-
7
+ return 0 ;
9
8
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ pkg_check_modules(PC_LIBZMQ QUIET libzmq)
4
4
set (ZeroMQ_VERSION ${PC_LIBZMQ_VERSION} )
5
5
find_library (ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
6
6
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} )
7
- find_library (ZeroMQ_STATIC_LIBRARY NAMES libzmq.a libzmq.dll.a
7
+ find_library (ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq .a libzmq.dll.a
8
8
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} )
9
9
10
10
if (ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY )
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
3
3
project (cppzmq-test CXX )
4
4
5
5
# place binaries and libraries according to GNU standards
6
- # TODO check if we should do this
7
6
8
- # include(GNUInstallDirs)
9
- # set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
10
- # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
11
- # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
7
+ include (GNUInstallDirs )
8
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /${CMAKE_INSTALL_LIBDIR} )
9
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /${CMAKE_INSTALL_LIBDIR} )
10
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /${CMAKE_INSTALL_BINDIR} )
12
11
13
12
# we use this to get code coverage
14
13
if (CMAKE_CXX_COMPILER_ID MATCHES GNU )
@@ -20,14 +19,12 @@ fetch_googletest(
20
19
${PROJECT_SOURCE_DIR} /cmake
21
20
${PROJECT_BINARY_DIR} /googletest
22
21
)
23
-
24
- find_package (cppzmq )
25
-
26
- enable_testing ()
27
22
28
23
add_executable (
29
24
unit_tests
30
- example_add.cpp
25
+ context.cpp
26
+ socket.cpp
27
+ poller.cpp
31
28
)
32
29
33
30
target_link_libraries (
@@ -36,6 +33,8 @@ target_link_libraries(
36
33
libzmq
37
34
)
38
35
36
+ target_include_directories (unit_tests PRIVATE .. )
37
+
39
38
add_test (
40
39
NAME
41
40
unit
Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+ #include < zmq.hpp>
3
+
4
+ TEST (context, create_default_destroy)
5
+ {
6
+ zmq::context_t context;
7
+ }
8
+
9
+ TEST (context, create_close)
10
+ {
11
+ zmq::context_t context;
12
+ context.close ();
13
+
14
+ ASSERT_EQ (NULL , (void *)context);
15
+ }
Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+ #include < zmq.hpp>
3
+
4
+ #if defined(ZMQ_CPP11) && defined(ZMQ_BUILD_DRAFT_API)
5
+ TEST (poller, create_destroy)
6
+ {
7
+ zmq::poller_t context;
8
+ }
9
+ #endif
Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+ #include < zmq.hpp>
3
+
4
+ TEST (socket, create_destroy)
5
+ {
6
+ zmq::context_t context;
7
+ zmq::socket_t socket (context, ZMQ_ROUTER);
8
+ }
9
+
10
+ #ifdef ZMQ_CPP11
11
+ TEST (socket, create_by_enum_destroy)
12
+ {
13
+ zmq::context_t context;
14
+ zmq::socket_t socket (context, zmq::socket_type::router);
15
+ }
16
+ #endif
You can’t perform that action at this time.
0 commit comments