aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2020-04-24 11:41:34 +0100
committerRob Hughes <robert.hughes@arm.com>2020-05-19 10:54:15 +0000
commitb98032f6a46072fee9a2bfcbe631b8193ced567d (patch)
tree1de423d3271e9ecbc0d02b8f08751c9eefa29612
parented324051794a262a7694acfb0a378724d6ba8401 (diff)
downloadarmnn-b98032f6a46072fee9a2bfcbe631b8193ced567d.tar.gz
Fix some Windows build errors:
* Cast to correct datatype for Winsock API * Replace non-standard u_int32_t * Add missing link dependency of timelineDecoder on armnn * Don't try to link pthread if the platform doesn't have it * Use abstracted Socket type rather than int * Link to WinSock DLL on windows Change-Id: I9ace4af50257ce1e3da92fb4c452f36775dac973 Signed-off-by: Robert Hughes <robert.hughes@arm.com>
-rw-r--r--CMakeLists.txt2
-rw-r--r--profiling/common/include/NetworkSockets.hpp2
-rw-r--r--profiling/common/include/SocketConnectionException.hpp10
-rw-r--r--profiling/common/src/NetworkSockets.cpp4
-rw-r--r--profiling/server/src/basePipeServer/CMakeLists.txt5
-rw-r--r--src/armnn/Graph.cpp2
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.cpp2
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.hpp2
-rw-r--r--src/timelineDecoder/CMakeLists.txt2
9 files changed, 21 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9182209ff2..bf9f1e765e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1081,7 +1081,7 @@ if(BUILD_GATORD_MOCK)
${Boost_SYSTEM_LIBRARY})
if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
- target_link_libraries(GatordMock pthread)
+ target_link_libraries(GatordMock ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
diff --git a/profiling/common/include/NetworkSockets.hpp b/profiling/common/include/NetworkSockets.hpp
index b9e58aac1d..77507644e6 100644
--- a/profiling/common/include/NetworkSockets.hpp
+++ b/profiling/common/include/NetworkSockets.hpp
@@ -34,6 +34,8 @@ using PollFd = pollfd;
using Socket = SOCKET;
using PollFd = WSAPOLLFD;
+using nfds_t = int;
+using socklen_t = int;
#define SOCK_CLOEXEC 0
#endif
diff --git a/profiling/common/include/SocketConnectionException.hpp b/profiling/common/include/SocketConnectionException.hpp
index 58b8a14d6d..fceaa0f697 100644
--- a/profiling/common/include/SocketConnectionException.hpp
+++ b/profiling/common/include/SocketConnectionException.hpp
@@ -8,6 +8,8 @@
#include <stdexcept>
#include <string>
+#include "NetworkSockets.hpp"
+
namespace armnnProfiling
{
@@ -15,11 +17,11 @@ namespace armnnProfiling
class SocketConnectionException : public std::exception
{
public:
- explicit SocketConnectionException(const std::string& message, int socket)
+ explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket)
: m_Message(message), m_Socket(socket), m_ErrNo(-1)
{};
- explicit SocketConnectionException(const std::string& message, int socket, int errNo)
+ explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket, int errNo)
: m_Message(message), m_Socket(socket), m_ErrNo(errNo)
{};
@@ -31,7 +33,7 @@ public:
/// @return - Socket File Descriptor of SocketProfilingConnection
/// or '-1', an invalid file descriptor
- int GetSocketFd() const noexcept
+ armnnUtils::Sockets::Socket GetSocketFd() const noexcept
{
return m_Socket;
}
@@ -44,7 +46,7 @@ public:
private:
std::string m_Message;
- int m_Socket;
+ armnnUtils::Sockets::Socket m_Socket;
int m_ErrNo;
};
diff --git a/profiling/common/src/NetworkSockets.cpp b/profiling/common/src/NetworkSockets.cpp
index 8ce5f197c1..1e1f70112d 100644
--- a/profiling/common/src/NetworkSockets.cpp
+++ b/profiling/common/src/NetworkSockets.cpp
@@ -52,7 +52,7 @@ long Write(Socket s, const void* buf, size_t len)
#if defined(__unix__)
return write(s, buf, len);
#elif defined(_MSC_VER)
- return send(s, static_cast<const char*>(buf), len, 0);
+ return send(s, static_cast<const char*>(buf), static_cast<int>(len), 0);
#endif
}
@@ -62,7 +62,7 @@ long Read(Socket s, void* buf, size_t len)
#if defined(__unix__)
return read(s, buf, len);
#elif defined(_MSC_VER)
- return recv(s, static_cast<char*>(buf), len, 0);
+ return recv(s, static_cast<char*>(buf), static_cast<int>(len), 0);
#endif
}
diff --git a/profiling/server/src/basePipeServer/CMakeLists.txt b/profiling/server/src/basePipeServer/CMakeLists.txt
index b2cb82d816..a2567cede6 100644
--- a/profiling/server/src/basePipeServer/CMakeLists.txt
+++ b/profiling/server/src/basePipeServer/CMakeLists.txt
@@ -24,6 +24,11 @@ if(BUILD_BASE_PIPE_SERVER)
set_target_properties(armnnBasePipeServer PROPERTIES VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION})
+ target_link_libraries(armnnBasePipeServer armnn)
+ if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
+ target_link_libraries(armnnBasePipeServer Ws2_32.lib)
+ endif()
+
install(TARGETS armnnBasePipeServer
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/src/armnn/Graph.cpp b/src/armnn/Graph.cpp
index ea9930bf11..c1bf1db038 100644
--- a/src/armnn/Graph.cpp
+++ b/src/armnn/Graph.cpp
@@ -378,7 +378,7 @@ void Graph::AddCompatibilityLayers(std::map<BackendId, std::unique_ptr<IBackendI
// Recalculate the connection index on the previous layer as we have just inserted into it.
const std::vector<InputSlot*>& newSourceConnections = srcOutputSlot.GetConnections();
- long newSrcConnectionIndex = std::distance(newSourceConnections.begin(),
+ auto newSrcConnectionIndex = std::distance(newSourceConnections.begin(),
std::find(newSourceConnections.begin(),
newSourceConnections.end(),
&compLayer->GetInputSlot(0)));
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
index 4e3e6e554b..bd4fa0691c 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
@@ -166,7 +166,7 @@ void PeriodicCounterSelectionCommandHandler::operator()(const Packet& packet)
}
std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBackendCounterIds(
- const u_int32_t capturePeriod,
+ const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds)
{
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
index 8a3747fb33..ac08cc58ec 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
@@ -91,7 +91,7 @@ private:
}
}
void ParseData(const Packet& packet, CaptureData& captureData);
- std::set<armnn::BackendId> ProcessBackendCounterIds(const u_int32_t capturePeriod,
+ std::set<armnn::BackendId> ProcessBackendCounterIds(const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds);
diff --git a/src/timelineDecoder/CMakeLists.txt b/src/timelineDecoder/CMakeLists.txt
index f844325b1d..4702577197 100644
--- a/src/timelineDecoder/CMakeLists.txt
+++ b/src/timelineDecoder/CMakeLists.txt
@@ -28,6 +28,8 @@ if(BUILD_TIMELINE_DECODER)
set_target_properties(timelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(timelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
+ target_link_libraries(timelineDecoder armnn)
+
install(TARGETS timelineDecoder
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})