diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/armnn/DllExport.hpp | 19 | ||||
-rw-r--r-- | src/armnn/WallClockTimer.hpp | 3 | ||||
-rw-r--r-- | src/profiling/LabelsAndEventClasses.hpp | 45 |
4 files changed, 50 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 91b9909a08..4c8c3870c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,6 +364,7 @@ list(APPEND armnn_sources src/armnn/CompatibleTypes.hpp src/armnn/Descriptors.cpp src/armnn/DeviceSpec.hpp + src/armnn/DllExport.hpp src/armnn/DynamicQuantizationVisitor.cpp src/armnn/DynamicQuantizationVisitor.hpp src/armnn/Exceptions.cpp @@ -529,6 +530,8 @@ endforeach() add_library_ex(armnn SHARED ${armnn_sources}) +target_compile_definitions(armnn PRIVATE "ARMNN_COMPILING_DLL") + target_include_directories(armnn PRIVATE src/armnn) target_include_directories(armnn PRIVATE src/armnnUtils) target_include_directories(armnn PRIVATE src/backends) @@ -743,15 +746,15 @@ if(BUILD_UNIT_TESTS) src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp src/armnnTfLiteParser/test/GetInputsOutputs.cpp ) - - # Generate SchemaText.cpp file which contains the TfLite schema text as a + + # Generate SchemaText.cpp file which contains the TfLite schema text as a # static C-array of bytes. This is needed at runtime for TfLite parser tests. add_custom_command( OUTPUT SchemaText.cpp COMMAND cp ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs g_TfLiteSchemaText COMMAND xxd -i g_TfLiteSchemaText SchemaText.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs + DEPENDS ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs ) list(APPEND unittest_sources ${CMAKE_CURRENT_BINARY_DIR}/SchemaText.cpp) endif() diff --git a/src/armnn/DllExport.hpp b/src/armnn/DllExport.hpp new file mode 100644 index 0000000000..227028c9b7 --- /dev/null +++ b/src/armnn/DllExport.hpp @@ -0,0 +1,19 @@ +// +// Copyright © 2020 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// +#pragma once + +#if defined (_MSC_VER) + +#ifdef ARMNN_COMPILING_DLL +#define ARMNN_DLLEXPORT __declspec(dllexport) +#else +#define ARMNN_DLLEXPORT __declspec(dllimport) +#endif + +#else + +#define ARMNN_DLLEXPORT + +#endif
\ No newline at end of file diff --git a/src/armnn/WallClockTimer.hpp b/src/armnn/WallClockTimer.hpp index ff17d79e92..23e1bc689b 100644 --- a/src/armnn/WallClockTimer.hpp +++ b/src/armnn/WallClockTimer.hpp @@ -7,6 +7,7 @@ #include "Instrument.hpp" #include <chrono> +#include "DllExport.hpp" namespace armnn { @@ -59,7 +60,7 @@ public: using clock = std::chrono::steady_clock; #endif - static const std::string WALL_CLOCK_TIME; + ARMNN_DLLEXPORT static const std::string WALL_CLOCK_TIME; static const std::string WALL_CLOCK_TIME_START; static const std::string WALL_CLOCK_TIME_STOP; diff --git a/src/profiling/LabelsAndEventClasses.hpp b/src/profiling/LabelsAndEventClasses.hpp index 69cee9aaea..fa125490cc 100644 --- a/src/profiling/LabelsAndEventClasses.hpp +++ b/src/profiling/LabelsAndEventClasses.hpp @@ -8,6 +8,7 @@ #include "ProfilingGuidGenerator.hpp" #include <armnn/Types.hpp> +#include <DllExport.hpp> namespace armnn { @@ -19,32 +20,32 @@ class LabelsAndEventClasses { public: // Labels (string value + GUID) - static std::string NAME_LABEL; - static std::string TYPE_LABEL; - static std::string INDEX_LABEL; - static std::string BACKENDID_LABEL; - static ProfilingStaticGuid NAME_GUID; - static ProfilingStaticGuid TYPE_GUID; - static ProfilingStaticGuid INDEX_GUID; - static ProfilingStaticGuid BACKENDID_GUID; + ARMNN_DLLEXPORT static std::string NAME_LABEL; + ARMNN_DLLEXPORT static std::string TYPE_LABEL; + ARMNN_DLLEXPORT static std::string INDEX_LABEL; + ARMNN_DLLEXPORT static std::string BACKENDID_LABEL; + ARMNN_DLLEXPORT static ProfilingStaticGuid NAME_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid TYPE_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid INDEX_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid BACKENDID_GUID; // Common types - static std::string LAYER; - static std::string WORKLOAD; - static std::string NETWORK; - static std::string CONNECTION; - static std::string INFERENCE; - static std::string WORKLOAD_EXECUTION; - static ProfilingStaticGuid LAYER_GUID; - static ProfilingStaticGuid WORKLOAD_GUID; - static ProfilingStaticGuid NETWORK_GUID; - static ProfilingStaticGuid CONNECTION_GUID; - static ProfilingStaticGuid INFERENCE_GUID; - static ProfilingStaticGuid WORKLOAD_EXECUTION_GUID; + ARMNN_DLLEXPORT static std::string LAYER; + ARMNN_DLLEXPORT static std::string WORKLOAD; + ARMNN_DLLEXPORT static std::string NETWORK; + ARMNN_DLLEXPORT static std::string CONNECTION; + ARMNN_DLLEXPORT static std::string INFERENCE; + ARMNN_DLLEXPORT static std::string WORKLOAD_EXECUTION; + ARMNN_DLLEXPORT static ProfilingStaticGuid LAYER_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid WORKLOAD_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid NETWORK_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid CONNECTION_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid INFERENCE_GUID; + ARMNN_DLLEXPORT static ProfilingStaticGuid WORKLOAD_EXECUTION_GUID; // Event Class GUIDs - static ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS; - static ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS; + ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS; + ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS; private: static ProfilingGuidGenerator m_GuidGenerator; |