Make it build on MACOSX
Still need to explicitly defined
-DCMAKE_CXX_FLAGS=--std=c++14
which that flags should goes into CMakefile.txt
JF: Fixed merge failure by removing Filesystem.cpp
and updated the copyright headers to new standard
Change-Id: I6d0886bd86bc1ddb593028194852551d43c77745
Signed-off-by: Keith Mok <ek9852@gmail.com>
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
diff --git a/src/armnnUtils/Filesystem.cpp b/src/armnnUtils/Filesystem.cpp
index ac9a414..59d0523 100644
--- a/src/armnnUtils/Filesystem.cpp
+++ b/src/armnnUtils/Filesystem.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/armnnUtils/Filesystem.hpp b/src/armnnUtils/Filesystem.hpp
index 869b0c1..3d93ce6 100644
--- a/src/armnnUtils/Filesystem.hpp
+++ b/src/armnnUtils/Filesystem.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/armnnUtils/Processes.cpp b/src/armnnUtils/Processes.cpp
index 86593aa..41b035b 100644
--- a/src/armnnUtils/Processes.cpp
+++ b/src/armnnUtils/Processes.cpp
@@ -1,11 +1,11 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "Processes.hpp"
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
#include <unistd.h>
#elif defined(_MSC_VER)
#include "WindowsWrapper.hpp"
@@ -18,7 +18,7 @@
int GetCurrentId()
{
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
return getpid();
#elif defined(_MSC_VER)
return ::GetCurrentProcessId();
diff --git a/src/armnnUtils/Processes.hpp b/src/armnnUtils/Processes.hpp
index 4e5e94b..8970423 100644
--- a/src/armnnUtils/Processes.hpp
+++ b/src/armnnUtils/Processes.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/backends/backendsCommon/DynamicBackendUtils.cpp b/src/backends/backendsCommon/DynamicBackendUtils.cpp
index 1abea11..46b5a52 100644
--- a/src/backends/backendsCommon/DynamicBackendUtils.cpp
+++ b/src/backends/backendsCommon/DynamicBackendUtils.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -15,7 +15,7 @@
void* DynamicBackendUtils::OpenHandle(const std::string& sharedObjectPath)
{
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
if (sharedObjectPath.empty())
{
throw RuntimeException("OpenHandle error: shared object path must not be empty");
@@ -35,7 +35,7 @@
void DynamicBackendUtils::CloseHandle(const void* sharedObjectHandle)
{
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
if (!sharedObjectHandle)
{
return;
@@ -63,7 +63,7 @@
std::string DynamicBackendUtils::GetDlError()
{
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
const char* errorMessage = dlerror();
if (!errorMessage)
{
diff --git a/src/backends/backendsCommon/DynamicBackendUtils.hpp b/src/backends/backendsCommon/DynamicBackendUtils.hpp
index f4cdd4d..63ee611 100644
--- a/src/backends/backendsCommon/DynamicBackendUtils.hpp
+++ b/src/backends/backendsCommon/DynamicBackendUtils.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -14,7 +14,7 @@
#include <string>
#include <vector>
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
#include <dlfcn.h>
#endif
@@ -61,7 +61,7 @@
template<typename EntryPointType>
EntryPointType DynamicBackendUtils::GetEntryPoint(const void* sharedObjectHandle, const char* symbolName)
{
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
if (sharedObjectHandle == nullptr)
{
throw RuntimeException("GetEntryPoint error: invalid handle");
diff --git a/src/profiling/SocketProfilingConnection.cpp b/src/profiling/SocketProfilingConnection.cpp
index 31f930b..c231045 100644
--- a/src/profiling/SocketProfilingConnection.cpp
+++ b/src/profiling/SocketProfilingConnection.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/profiling/SocketProfilingConnection.hpp b/src/profiling/SocketProfilingConnection.hpp
index 259ee13..a646c03 100644
--- a/src/profiling/SocketProfilingConnection.hpp
+++ b/src/profiling/SocketProfilingConnection.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -29,8 +29,13 @@
// Read a full packet from the socket.
Packet ReceivePacket();
+#ifndef __APPLE__
// To indicate we want to use an abstract UDS ensure the first character of the address is 0.
const char* m_GatorNamespace = "\0gatord_namespace";
+#else
+ // MACOSX does not support abstract UDS
+ const char* m_GatorNamespace = "/tmp/gatord_namespace";
+#endif
armnnUtils::Sockets::PollFd m_Socket[1]{};
};