IVGCVSW-6710 Add compile of BareMetalDeserializedGraph sample

Change-Id: Ice69c2a22f589f68d302f80500dfe4e514a796d2
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
diff --git a/profiling/common/include/NetworkSockets.hpp b/profiling/common/include/NetworkSockets.hpp
index 29575cd..be94be6 100644
--- a/profiling/common/include/NetworkSockets.hpp
+++ b/profiling/common/include/NetworkSockets.hpp
@@ -8,6 +8,8 @@
 // is needed (typically just forwarding the parameters to a differently named function).
 // Some of the APIs are in fact completely identical and so no forwarding function is needed.
 
+#if !defined(ARMNN_DISABLE_SOCKETS)
+
 #pragma once
 
 #if defined(__unix__) || defined(__APPLE__)
@@ -77,3 +79,5 @@
 
 } // namespace arm
 } // namespace pipe
+
+#endif
diff --git a/profiling/common/include/SocketConnectionException.hpp b/profiling/common/include/SocketConnectionException.hpp
index 42b8d9d..f4ed2eb 100644
--- a/profiling/common/include/SocketConnectionException.hpp
+++ b/profiling/common/include/SocketConnectionException.hpp
@@ -20,24 +20,42 @@
 class SocketConnectionException : public std::exception
 {
 public:
-    explicit SocketConnectionException(const std::string &message, arm::pipe::Socket socket)
-        : m_Message(message), m_Socket(socket), m_ErrNo(-1) {};
+    explicit SocketConnectionException(const std::string& message
+#if !defined(ARMNN_DISABLE_SOCKETS)
+                                       , arm::pipe::Socket socket
+#endif
+        )
+        : m_Message(message),
+#if !defined(ARMNN_DISABLE_SOCKETS)
+          m_Socket(socket),
+#endif
+          m_ErrNo(-1) {};
 
-    explicit SocketConnectionException(const std::string &message, arm::pipe::Socket socket, int errNo)
-        : m_Message(message), m_Socket(socket), m_ErrNo(errNo) {};
+    explicit SocketConnectionException(const std::string& message,
+#if !defined(ARMNN_DISABLE_SOCKETS)
+                                       arm::pipe::Socket socket,
+#endif
+                                       int errNo)
+        : m_Message(message),
+#if !defined(ARMNN_DISABLE_SOCKETS)
+          m_Socket(socket),
+#endif
+          m_ErrNo(errNo) {};
 
     /// @return - Error message of  SocketProfilingConnection
-    virtual const char *what() const noexcept override
+    virtual const char* what() const noexcept override
     {
         return m_Message.c_str();
     }
 
     /// @return - Socket File Descriptor of SocketProfilingConnection
     ///           or '-1', an invalid file descriptor
+#if !defined(ARMNN_DISABLE_SOCKETS)
     arm::pipe::Socket GetSocketFd() const noexcept
     {
         return m_Socket;
     }
+#endif
 
     /// @return - errno of SocketProfilingConnection
     int GetErrorNo() const noexcept
@@ -47,7 +65,9 @@
 
 private:
     std::string m_Message;
+#if !defined(ARMNN_DISABLE_SOCKETS)
     arm::pipe::Socket m_Socket;
+#endif
     int m_ErrNo;
 };
 } // namespace pipe
diff --git a/profiling/common/src/CMakeLists.txt b/profiling/common/src/CMakeLists.txt
index 08d77c2..54fd914 100644
--- a/profiling/common/src/CMakeLists.txt
+++ b/profiling/common/src/CMakeLists.txt
@@ -21,12 +21,6 @@
     include_directories(${PROJECT_SOURCE_DIR}/profiling/common/include)
     include_directories(${PROJECT_SOURCE_DIR}/common/include)
 
-    if(BUILD_UNIT_TESTS)
-        include_directories(${PROJECT_SOURCE_DIR}/src/profiling
-                            ${PROJECT_SOURCE_DIR}/src/armnnUtils)
-        target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/profiling/common/include)
-    endif()
-
     # will only build a static version of this common code
     # to simplify the build. No extra .so file to deploy to boards etc.
     add_library_ex(pipeCommon STATIC ${pipeCommon_sources})
diff --git a/profiling/common/src/NetworkSockets.cpp b/profiling/common/src/NetworkSockets.cpp
index 15ad087..84711c6 100644
--- a/profiling/common/src/NetworkSockets.cpp
+++ b/profiling/common/src/NetworkSockets.cpp
@@ -3,6 +3,8 @@
 // SPDX-License-Identifier: MIT
 //
 
+#if !defined(ARMNN_DISABLE_SOCKETS)
+
 #include <common/include/NetworkSockets.hpp>
 
 #if defined(__unix__) || defined(__APPLE__)
@@ -112,3 +114,5 @@
 
 } // pipe
 } // arm
+
+#endif
diff --git a/profiling/common/src/Processes.cpp b/profiling/common/src/Processes.cpp
index 94e8095..b8c2941 100644
--- a/profiling/common/src/Processes.cpp
+++ b/profiling/common/src/Processes.cpp
@@ -18,11 +18,15 @@
 
 int GetCurrentProcessId()
 {
+#if !defined(ARMNN_DISABLE_PROCESSES)
 #if defined(__unix__) || defined(__APPLE__)
     return getpid();
 #elif defined(_MSC_VER)
     return ::GetCurrentProcessId();
 #endif
+#else
+    return 0;
+#endif
 }
 
 } // namespace pipe
diff --git a/profiling/common/src/Threads.cpp b/profiling/common/src/Threads.cpp
index 10533b7..d9e6016 100644
--- a/profiling/common/src/Threads.cpp
+++ b/profiling/common/src/Threads.cpp
@@ -26,6 +26,7 @@
 
 int GetCurrentThreadId()
 {
+#if !defined(ARMNN_DISABLE_THREADS)
 #if defined(__linux__)
     return static_cast<int>(gettid());
 #elif defined(_MSC_VER)
@@ -39,6 +40,9 @@
     }
     return static_cast<int>(threadId);
 #endif
+#else
+    return 0;
+#endif
 }
 
 } // namespace pipe