Skip to content

Commit ad9c8b5

Browse files
committed
Windows build fixes
1 parent 1e66ee3 commit ad9c8b5

File tree

6 files changed

+25
-17
lines changed

6 files changed

+25
-17
lines changed

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ if(Boost_VERSION GREATER 105799)
4444
add_subproject(cppnetlib ${PROJECT_SOURCE_DIR}/cppnetlib) # from .gitmodules
4545
common_find_package(cppnetlib SYSTEM NO_DEFAULT_PATH)
4646
endif()
47-
common_find_package(ZeroMQ) # new-ish CMake-based build
48-
if(NOT ZeroMQ_FOUND)
49-
common_find_package(libzmq 4 REQUIRED) # old-ish autopain/pkgconfig build
50-
set(ZeroMQ_LIBRARY ${libzmq_LIBRARIES})
47+
if(TARGET libzmq)
48+
set(ZeroMQ_LIBRARY libzmq)
49+
else()
50+
common_find_package(ZeroMQ) # new-ish CMake-based build
51+
if(NOT ZeroMQ_FOUND)
52+
common_find_package(libzmq 4 REQUIRED) # old-ish autopain/pkgconfig build
53+
set(ZeroMQ_LIBRARY ${libzmq_LIBRARIES})
54+
endif()
5155
endif()
5256
common_find_package(Servus REQUIRED)
5357
common_find_package(Threads REQUIRED)

zeroeq/detail/context.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#pragma once
77

8+
#include <zeroeq/api.h>
89
#include <zeroeq/types.h>
910

1011
#include <memory>
@@ -16,6 +17,6 @@ namespace detail
1617
/** @return the current ZeroMQ context. Users need to hold onto this context to
1718
* extend its lifetime to all sockets created from the context.
1819
*/
19-
zmq::ContextPtr getContext();
20+
ZEROEQ_API zmq::ContextPtr getContext();
2021
}
2122
}

zeroeq/detail/sender.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class Sender
2020
zmq::ContextPtr _context; // must be private before socket
2121

2222
public:
23-
Sender(const URI& uri_, const int type);
24-
Sender(const URI& uri_, const int type, const std::string service,
25-
const std::string& session);
26-
~Sender();
23+
ZEROEQ_API Sender(const URI& uri_, const int type);
24+
ZEROEQ_API Sender(const URI& uri_, const int type,
25+
const std::string service, const std::string& session);
26+
ZEROEQ_API ~Sender();
2727

2828
std::string getAddress() const;
2929

3030
void initURI();
31-
void announce();
31+
ZEROEQ_API void announce();
3232
void addSockets(std::vector<zeroeq::detail::Socket>& entries);
3333

3434
const std::string& getSession() const { return _session; }

zeroeq/http/request.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
* Raphael.Dumusc@epfl.ch
44
*/
55

6-
#ifndef ZEROEQ_HTTP_REQUEST_H
7-
#define ZEROEQ_HTTP_REQUEST_H
6+
#pragma once
87

9-
#include <string>
8+
#include <zeroeq/types.h>
9+
10+
#include <string> // member
1011

1112
namespace zeroeq
1213
{
@@ -56,5 +57,3 @@ struct Request
5657
};
5758
}
5859
}
59-
60-
#endif

zeroeq/http/requestHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
#include <zeroeq/log.h>
1111
#include <zeroeq/uri.h>
1212

13+
#include <zmq.h>
14+
1315
#include <future>
1416
#include <memory> // shared_from_this
1517
#include <stdexcept>
16-
#include <zmq.h>
1718

1819
namespace zeroeq
1920
{
@@ -137,7 +138,7 @@ struct ConnectionHandler : std::enable_shared_from_this<ConnectionHandler>
137138
return;
138139
}
139140

140-
_body.append(std::begin(range), size);
141+
_body.append(&range[0], size);
141142
_size -= size;
142143
if (_size > 0)
143144
_readChunk(connection, method_);

zeroeq/types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#ifdef _WIN32
1818
#define NOMINMAX
1919
#include <winsock2.h> // SOCKET
20+
#ifdef DELETE
21+
#undef DELETE
22+
#endif
2023
#endif
2124

2225
/**

0 commit comments

Comments
 (0)