IVGCVSW-4160 Make the ARM Developer Studio code a self contained build entity

!armnn:2773

Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I246cf0de04a1d29dd135cb0fc7e55bc5f0d4b854
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3b794a..5da8133 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -864,7 +864,7 @@
     if(BUILD_GATORD_MOCK)
         list(APPEND unittest_sources
             tests/profiling/gatordmock/tests/GatordMockTests.cpp
-            tests/profiling/timelineDecoder/tests/TimelineTests.cpp
+            src/timelineDecoder/tests/TimelineTests.cpp
             )
     endif()
 
@@ -900,6 +900,7 @@
 
     if(BUILD_GATORD_MOCK)
         target_link_libraries(UnitTests gatordMockService)
+        target_link_libraries(UnitTests timelineDecoder)
     endif()
 
     if(BUILD_TF_LITE_PARSER)
@@ -967,6 +968,8 @@
 endif()
 
 if(BUILD_GATORD_MOCK)
+    add_subdirectory(src/timelineDecoder)
+
     set(gatord_mock_sources)
     list(APPEND gatord_mock_sources
         tests/profiling/gatordmock/CommandFileParser.hpp
@@ -981,19 +984,9 @@
         tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
         tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
         tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
-        tests/profiling/timelineDecoder/ITimelineDecoder.hpp
-        tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp
-        tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
-        tests/profiling/timelineDecoder/TimelineDecoder.cpp
-        tests/profiling/timelineDecoder/TimelineDecoder.hpp
-        tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
-        tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
         )
 
-    include_directories(${Boost_INCLUDE_DIRS} src/profiling)
-    include_directories(${Boost_INCLUDE_DIRS} tests/profiling)
-    include_directories(${Boost_INCLUDE_DIRS} tests/profiling/gatordmock)
-    include_directories(${Boost_INCLUDE_DIRS} tests/profiling/timelineDecoder)
+    include_directories(src/timelineDecoder src/profiling tests/profiling tests/profiling/gatordmock)
 
     add_library_ex(gatordMockService STATIC ${gatord_mock_sources})
     target_include_directories(gatordMockService PRIVATE src/armnnUtils)
diff --git a/tests/profiling/timelineDecoder/ITimelineDecoder.hpp b/include/armnn/profiling/ITimelineDecoder.hpp
similarity index 100%
rename from tests/profiling/timelineDecoder/ITimelineDecoder.hpp
rename to include/armnn/profiling/ITimelineDecoder.hpp
diff --git a/src/timelineDecoder/CMakeLists.txt b/src/timelineDecoder/CMakeLists.txt
new file mode 100644
index 0000000..6b8517a
--- /dev/null
+++ b/src/timelineDecoder/CMakeLists.txt
@@ -0,0 +1,21 @@
+#
+# Copyright © 2020 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+set(timelineDecoder_sources)
+list(APPEND timelineDecoder_sources
+        ../../include/armnn/profiling/ITimelineDecoder.hpp
+        TimelineCaptureCommandHandler.cpp
+        TimelineCaptureCommandHandler.hpp
+        TimelineDecoder.cpp
+        TimelineDecoder.hpp
+        TimelineDirectoryCaptureCommandHandler.cpp
+        TimelineDirectoryCaptureCommandHandler.hpp
+        )
+
+include_directories(../timelineDecoder ../profiling)
+
+add_library_ex(timelineDecoder SHARED ${timelineDecoder_sources})
+
+set_target_properties(timelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
\ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp b/src/timelineDecoder/TimelineCaptureCommandHandler.cpp
similarity index 97%
rename from tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp
rename to src/timelineDecoder/TimelineCaptureCommandHandler.cpp
index 1fd0d47..01f55bd 100644
--- a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp
+++ b/src/timelineDecoder/TimelineCaptureCommandHandler.cpp
@@ -5,17 +5,16 @@
 
 #include "TimelineCaptureCommandHandler.hpp"
 
-#include <iostream>
 #include <string>
 
 namespace armnn
 {
 
-namespace gatordmock
+namespace timelinedecoder
 {
 
 //Array of member functions, the array index matches the decl_id
-const TimelineCaptureCommandHandler::ReadFunction TimelineCaptureCommandHandler::m_ReadFunctions[5]
+const TimelineCaptureCommandHandler::ReadFunction TimelineCaptureCommandHandler::m_ReadFunctions[]
 {
     &TimelineCaptureCommandHandler::ReadLabel,              // Label decl_id = 0
     &TimelineCaptureCommandHandler::ReadEntity,             // Entity decl_id = 1
diff --git a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineCaptureCommandHandler.hpp
similarity index 95%
rename from tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
rename to src/timelineDecoder/TimelineCaptureCommandHandler.hpp
index 9cdbbdc..d95adc0 100644
--- a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
+++ b/src/timelineDecoder/TimelineCaptureCommandHandler.hpp
@@ -5,16 +5,16 @@
 
 #pragma once
 
-#include "ITimelineDecoder.hpp"
-
 #include <CommandHandlerFunctor.hpp>
+#include "armnn/profiling/ITimelineDecoder.hpp"
+
 #include <Packet.hpp>
 #include <ProfilingUtils.hpp>
 
 namespace armnn
 {
 
-namespace gatordmock
+namespace timelinedecoder
 {
 
 class TimelineCaptureCommandHandler : public profiling::CommandHandlerFunctor
diff --git a/tests/profiling/timelineDecoder/TimelineDecoder.cpp b/src/timelineDecoder/TimelineDecoder.cpp
similarity index 98%
rename from tests/profiling/timelineDecoder/TimelineDecoder.cpp
rename to src/timelineDecoder/TimelineDecoder.cpp
index 2924b7a..fcf40b4 100644
--- a/tests/profiling/timelineDecoder/TimelineDecoder.cpp
+++ b/src/timelineDecoder/TimelineDecoder.cpp
@@ -4,12 +4,13 @@
 //
 
 #include "TimelineDecoder.hpp"
-
-#include <ProfilingUtils.hpp>
+#include "../profiling/ProfilingUtils.hpp"
 
 #include <iostream>
 namespace armnn
 {
+namespace timelinedecoder
+{
 TimelineDecoder::ErrorCode TimelineDecoder::CreateEntity(const Entity &entity)
 {
     if (m_OnNewEntityCallback == nullptr)
@@ -282,4 +283,5 @@
         std::cout << body;
     }
 }
+}
 }
\ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/TimelineDecoder.hpp b/src/timelineDecoder/TimelineDecoder.hpp
similarity index 95%
rename from tests/profiling/timelineDecoder/TimelineDecoder.hpp
rename to src/timelineDecoder/TimelineDecoder.hpp
index 81e6a95..fc14603 100644
--- a/tests/profiling/timelineDecoder/TimelineDecoder.hpp
+++ b/src/timelineDecoder/TimelineDecoder.hpp
@@ -4,10 +4,13 @@
 //
 #pragma once
 
-#include "ITimelineDecoder.hpp"
+#include "armnn/profiling/ITimelineDecoder.hpp"
 #include <vector>
+
 namespace armnn
 {
+namespace timelinedecoder
+{
 class TimelineDecoder : public ITimelineDecoder
 {
 
@@ -60,4 +63,6 @@
     void printRelationships();
     void printEvents();
 };
+
+}
 }
\ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
similarity index 97%
rename from tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
rename to src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
index f28c7b5..655e461 100644
--- a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
+++ b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
@@ -5,8 +5,6 @@
 
 #include "TimelineDirectoryCaptureCommandHandler.hpp"
 
-#include <ProfilingUtils.hpp>
-
 #include <iostream>
 #include <string>
 
@@ -15,7 +13,7 @@
 namespace armnn
 {
 
-namespace gatordmock
+namespace timelinedecoder
 {
 
 void TimelineDirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
diff --git a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
similarity index 97%
rename from tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
rename to src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
index 36a82b5..b4e0fd2 100644
--- a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
+++ b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
@@ -5,7 +5,6 @@
 
 #pragma once
 
-
 #include <CommandHandlerFunctor.hpp>
 #include <Packet.hpp>
 #include <PacketBuffer.hpp>
@@ -14,7 +13,7 @@
 namespace armnn
 {
 
-namespace gatordmock
+namespace timelinedecoder
 {
 
 class TimelineDirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
diff --git a/tests/profiling/timelineDecoder/tests/TimelineTests.cpp b/src/timelineDecoder/tests/TimelineTests.cpp
similarity index 95%
rename from tests/profiling/timelineDecoder/tests/TimelineTests.cpp
rename to src/timelineDecoder/tests/TimelineTests.cpp
index 5d3c3ea..052a3f1 100644
--- a/tests/profiling/timelineDecoder/tests/TimelineTests.cpp
+++ b/src/timelineDecoder/tests/TimelineTests.cpp
@@ -3,9 +3,9 @@
 // SPDX-License-Identifier: MIT
 //
 
-#include "../TimelineCaptureCommandHandler.hpp"
-#include "../TimelineDirectoryCaptureCommandHandler.hpp"
-#include "timelineDecoder/TimelineDecoder.hpp"
+#include <TimelineCaptureCommandHandler.hpp>
+#include <TimelineDirectoryCaptureCommandHandler.hpp>
+#include <TimelineDecoder.hpp>
 
 #include <CommandHandlerFunctor.hpp>
 #include <ProfilingService.hpp>
@@ -18,6 +18,7 @@
 BOOST_AUTO_TEST_SUITE(TimelineDecoderTests)
 
 using namespace armnn;
+using namespace timelinedecoder;
 
 void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer,
                                         profiling::CommandHandlerFunctor &CommandHandler)
@@ -83,7 +84,7 @@
 
     profiling::PacketVersionResolver packetVersionResolver;
 
-    gatordmock::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
+    TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
             1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(), true);
 
     sendTimelinePacket->SendTimelineMessageDirectoryPackage();
@@ -151,12 +152,12 @@
     TimelineDecoder timelineDecoder;
     const TimelineDecoder::Model& model = timelineDecoder.GetModel();
 
-    gatordmock::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
+    TimelineCaptureCommandHandler timelineCaptureCommandHandler(
         1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, threadIdSize);
 
     BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
     BOOST_CHECK(
-        timelineDecoder.SetEventClassCallback(PushEventClass )== ITimelineDecoder::ErrorCode::ErrorCode_Success);
+        timelineDecoder.SetEventClassCallback(PushEventClass) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
     BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
     BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
     BOOST_CHECK(
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
index fecfce4..78c6f11 100644
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
@@ -9,6 +9,7 @@
 #include <GatordMockService.hpp>
 #include <PeriodicCounterCaptureCommandHandler.hpp>
 #include <StreamMetadataCommandHandler.hpp>
+
 #include <TimelineDirectoryCaptureCommandHandler.hpp>
 
 #include <test/ProfilingMocks.hpp>
@@ -127,7 +128,7 @@
     profiling::DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
         0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), true);
 
-    gatordmock::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
+    timelinedecoder::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
         1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(), true);
 
     // Register different derived functors