From 62fdf0c64834cd5e45d19528de08c5005044c858 Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Wed, 16 Feb 2022 12:57:19 +0000 Subject: IVGCVSW-6602 Put ArmnnTestUtils under abi-compliance checking. Signed-off-by: Teresa Charlin Change-Id: I82f3bd99b3c1d4d8a013b1e987a533a8071fbeea --- CMakeLists.txt | 3 ++- cmake/ArmnnTestUtilsVersion.cmake | 18 ++++++++++++++++++ include/armnnTestUtils/Version.hpp | 24 ++++++++++++++++++++++++ src/armnnTestUtils/CMakeLists.txt | 3 +++ src/armnnTestUtils/TestUtils.cpp | 2 ++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 cmake/ArmnnTestUtilsVersion.cmake create mode 100644 include/armnnTestUtils/Version.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e115719cf..7cb957ea20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,8 @@ list(APPEND additional_cmake_files cmake/ParserVersion.cmake cmake/Utils.cmake cmake/GlobalConfig.cmake - cmake/AddDllCopyCommands.cmake) + cmake/AddDllCopyCommands.cmake + cmake/ArmnnTestUtilsVersion.cmake) foreach(cmake_file ${additional_cmake_files}) include(${cmake_file}) diff --git a/cmake/ArmnnTestUtilsVersion.cmake b/cmake/ArmnnTestUtilsVersion.cmake new file mode 100644 index 0000000000..38fcb97c82 --- /dev/null +++ b/cmake/ArmnnTestUtilsVersion.cmake @@ -0,0 +1,18 @@ +# +# Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +# Read the ArmNN armnnTestUtils version components from file +file(READ ${CMAKE_CURRENT_LIST_DIR}/../include/armnnTestUtils/Version.hpp armnnTestUtilsVersion) + +# Parse the ArmNN armnnTestUtils version components +string(REGEX MATCH "#define ARMNN_TEST_UTILS_MAJOR_VERSION ([0-9]*)" _ ${armnnTestUtilsVersion}) +set(ARMNN_TEST_UTILS_MAJOR_VERSION ${CMAKE_MATCH_1}) +string(REGEX MATCH "#define ARMNN_TEST_UTILS_MINOR_VERSION ([0-9]*)" _ ${armnnTestUtilsVersion}) +set(ARMNN_TEST_UTILS_MINOR_VERSION ${CMAKE_MATCH_1}) + +# Define LIB version +set(ARMNN_TEST_UTILS_LIB_VERSION "${ARMNN_TEST_UTILS_MAJOR_VERSION}.${ARMNN_TEST_UTILS_MINOR_VERSION}") +# Define LIB soversion +set(ARMNN_TEST_UTILS_LIB_SOVERSION "${ARMNN_TEST_UTILS_MAJOR_VERSION}") \ No newline at end of file diff --git a/include/armnnTestUtils/Version.hpp b/include/armnnTestUtils/Version.hpp new file mode 100644 index 0000000000..39009d5621 --- /dev/null +++ b/include/armnnTestUtils/Version.hpp @@ -0,0 +1,24 @@ +// +// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +/// Macro utils +#define STRINGIFY_VALUE(s) STRINGIFY_MACRO(s) +#define STRINGIFY_MACRO(s) #s + +// ArmnnTestUtils version components +#define ARMNN_TEST_UTILS_MAJOR_VERSION 1 +#define ARMNN_TEST_UTILS_MINOR_VERSION 0 +#define ARMNN_TEST_UTILS_PATCH_VERSION 0 + +/// ARMNN_TEST_UTILS_VERSION: "X.Y.Z" +/// where: +/// X = Major version number +/// Y = Minor version number +/// Z = Patch version number +#define ARMNN_TEST_UTILS_VERSION STRINGIFY_VALUE(ARMNN_TEST_UTILS_MAJOR_VERSION) "." \ + STRINGIFY_VALUE(ARMNN_TEST_UTILS_MINOR_VERSION) "." \ + STRINGIFY_VALUE(ARMNN_TEST_UTILS_PATCH_VERSION) diff --git a/src/armnnTestUtils/CMakeLists.txt b/src/armnnTestUtils/CMakeLists.txt index 061dd90d3d..b90a71e66e 100755 --- a/src/armnnTestUtils/CMakeLists.txt +++ b/src/armnnTestUtils/CMakeLists.txt @@ -15,6 +15,7 @@ list(APPEND armnnTestUtils_sources ../../include/armnnTestUtils/TensorCopyUtils.hpp ../../include/armnnTestUtils/WorkloadTestUtils.hpp ../../include/armnnTestUtils/TensorHelpers.hpp + ../../include/armnnTestUtils/Version.hpp CreateWorkload.hpp CommonTestUtils.cpp CommonTestUtils.hpp @@ -57,3 +58,5 @@ install(TARGETS armnnTestUtils RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) add_library(Armnn::armnnTestUtils ALIAS armnnTestUtils) + +set_target_properties(armnnTestUtils PROPERTIES VERSION ${ARMNN_TEST_UTILS_LIB_VERSION} SOVERSION ${ARMNN_TEST_UTILS_LIB_SOVERSION}) \ No newline at end of file diff --git a/src/armnnTestUtils/TestUtils.cpp b/src/armnnTestUtils/TestUtils.cpp index 9ac0b3986e..3cba826dd2 100644 --- a/src/armnnTestUtils/TestUtils.cpp +++ b/src/armnnTestUtils/TestUtils.cpp @@ -7,6 +7,8 @@ #include +#include "armnnTestUtils/Version.hpp" + using namespace armnn; void Connect(armnn::IConnectableLayer* from, armnn::IConnectableLayer* to, const armnn::TensorInfo& tensorInfo, -- cgit v1.2.1