aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/armnn/Logging.cpp6
-rw-r--r--src/armnn/test/UnitTests.cpp2
-rw-r--r--src/armnnUtils/Filesystem.cpp3
-rw-r--r--src/armnnUtils/Processes.cpp3
-rw-r--r--src/armnnUtils/WindowsWrapper.hpp17
5 files changed, 21 insertions, 10 deletions
diff --git a/src/armnn/Logging.cpp b/src/armnn/Logging.cpp
index a3ca7ce118..6db4afaf49 100644
--- a/src/armnn/Logging.cpp
+++ b/src/armnn/Logging.cpp
@@ -9,11 +9,7 @@
#include <armnn/utility/Assert.hpp>
#if defined(_MSC_VER)
-#ifndef NOMINMAX
-#define NOMINMAX // Prevent definition of min/max macros that interfere with std::min/max
-#endif
-#include <Windows.h>
-#undef TIME_MS // Windows.h defines this but we don't need it and it interferes with our definition in Instrument.hpp
+#include <WindowsWrapper.hpp>
#endif
#if defined(__ANDROID__)
diff --git a/src/armnn/test/UnitTests.cpp b/src/armnn/test/UnitTests.cpp
index 071bff0ed8..d66a847512 100644
--- a/src/armnn/test/UnitTests.cpp
+++ b/src/armnn/test/UnitTests.cpp
@@ -24,7 +24,7 @@ BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture);
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/tee.hpp>
#include <iostream>
-#include <Windows.h>
+#include <WindowsWrapper.hpp>
using namespace boost::iostreams;
using namespace std;
diff --git a/src/armnnUtils/Filesystem.cpp b/src/armnnUtils/Filesystem.cpp
index 6c8175b202..886d7dad30 100644
--- a/src/armnnUtils/Filesystem.cpp
+++ b/src/armnnUtils/Filesystem.cpp
@@ -9,8 +9,7 @@
#include <sys/stat.h>
#include <stdio.h>
#elif defined(_MSC_VER)
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include "WindowsWrapper.hpp"
#endif
namespace armnnUtils
diff --git a/src/armnnUtils/Processes.cpp b/src/armnnUtils/Processes.cpp
index 0e43e8cecd..6c216cf440 100644
--- a/src/armnnUtils/Processes.cpp
+++ b/src/armnnUtils/Processes.cpp
@@ -8,8 +8,7 @@
#if defined(__unix__)
#include <unistd.h>
#elif defined(_MSC_VER)
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include "WindowsWrapper.hpp"
#endif
namespace armnnUtils
diff --git a/src/armnnUtils/WindowsWrapper.hpp b/src/armnnUtils/WindowsWrapper.hpp
new file mode 100644
index 0000000000..7f02cb1a16
--- /dev/null
+++ b/src/armnnUtils/WindowsWrapper.hpp
@@ -0,0 +1,17 @@
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+// This header brings in the Win32 API header, with some small modifications applied to prevent clashes with our code.
+
+#if defined(_MSC_VER)
+
+#define NOMINMAX // Prevent definition of min/max macros that interfere with std::min/max
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+// Windows.h defines some names that we don't need and interfere with some of our definition
+#undef TIME_MS // Instrument.hpp
+#undef CreateEvent // ITimelineDecoder.hpp
+
+#endif