Skip to content

Commit fdc145a

Browse files
kurdybachabluca
authored andcommitted
Problem: Windows build broken because of multiple issues (#204)
* Problem: Windows build broken because of multiple issues Windows issues: * missing includes files Solution: added missing <memory> and <unordered_map> Here <map> was replaced with <unordered_map> as there is no need for sorted map. * googletest fails because deprecation warning causing errors. Solution: D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING option added. * googletest fails because by default, new Visual Studio projects link the C runtimes dynamically but Google Test links them statically. Solution: gtest_force_shared_crt=ON option added. Besides that adding appveyor.yml configuration to add Windows build to CI in order to prevent accidental Windows build breakage. For now only Debug configuration as Release requires more time to figure out. * Problem: Windows build takes too long Solution: disabling tests and perf tools * Problem: Windows unit_tests executable not finding lizmq dll. Solution: copy libzmq dll to build bin directory. * Problem: Windows build fails because wrong test path provided
1 parent 19da7a4 commit fdc145a

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

appveyor.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: build-{build}
2+
3+
os:
4+
- Visual Studio 2017
5+
- Visual Studio 2015
6+
7+
init:
8+
- cmake --version
9+
- msbuild /version
10+
11+
platform:
12+
- Win32
13+
- x64
14+
15+
configuration:
16+
- Debug
17+
18+
environment:
19+
ZMQ_VERSION: 4.2.5
20+
21+
before_build:
22+
- appveyor DownloadFile https://github.com/zeromq/libzmq/archive/v%ZMQ_VERSION%.zip
23+
- 7z x v%ZMQ_VERSION%.zip >NUL
24+
- cmake -H./libzmq-%ZMQ_VERSION% -BBuild-libzmq -DENABLE_DRAFTS=ON -DWITH_PERF_TOOL=OFF -DZMQ_BUILD_TESTS=OFF -DENABLE_CPACK=OFF -A%PLATFORM%
25+
- cmake --build Build-libzmq
26+
- cmake -H. -BBuild -DCMAKE_PREFIX_PATH=./Build-libzmq -A%PLATFORM%
27+
28+
build:
29+
project: Build/cppzmq.sln
30+
verbosity: normal
31+
32+
test_script:
33+
- cp Build-libzmq/bin/%configuration%/libzmq*.dll Build/bin/%configuration%/
34+
- cd Build
35+
- ctest -V -C %configuration%

tests/cmake/googletest.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ macro(fetch_googletest _download_module_path _download_root)
2424
${_download_root}
2525
)
2626

27+
if (MSVC)
28+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
29+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
30+
endif()
31+
2732
# adds the targers: gtest, gtest_main, gmock, gmock_main
2833
add_subdirectory(
2934
${_download_root}/googletest-src

tests/poller.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#if defined(ZMQ_CPP11) && defined(ZMQ_BUILD_DRAFT_API)
55

66
#include <array>
7+
#include <memory>
78

89
TEST(poller, create_destroy)
910
{

zmq.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#include <chrono>
7474
#include <tuple>
7575
#include <functional>
76+
#include <unordered_map>
7677
#endif
7778

7879
// Detect whether the compiler supports C++11 rvalue references.
@@ -1107,7 +1108,7 @@ namespace zmq
11071108
private:
11081109
void *poller_ptr;
11091110
std::vector<zmq_poller_event_t> poller_events;
1110-
std::map<socket_t*, handler_t> handlers;
1111+
std::unordered_map<socket_t*, handler_t> handlers;
11111112
}; // class poller_t
11121113
#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER)
11131114

0 commit comments

Comments
 (0)