aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGuillaume Gardet <guillaume.gardet@arm.com>2019-10-15 08:47:26 +0200
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-17 13:46:03 +0100
commit5ae78299f117a61c48a67c5381341501571a0b03 (patch)
treead0b4f11ee1f97e59a0f7317ba6c7801b0a64d67 /cmake
parent6598427f7dc68f2c9ef6d683e80ec4627df52d58 (diff)
downloadarmnn-5ae78299f117a61c48a67c5381341501571a0b03.tar.gz
Move version definition to its own file
* Move the ArmNN version to a separate ArmnnVersion.txt file * Updated makefiles accordingly !referencetests:206978 !android-nn-driver:2110 Signed-off-by: Guillaume Gardet <guillaume.gardet@arm.com> Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: Ib1a34d38b5f4c7490108ea91d930cf5417d1ca94
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ArmnnVersion.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmake/ArmnnVersion.cmake b/cmake/ArmnnVersion.cmake
new file mode 100644
index 0000000000..239b2cc69e
--- /dev/null
+++ b/cmake/ArmnnVersion.cmake
@@ -0,0 +1,25 @@
+#
+# Copyright © 2019 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+# Read the ArmNN version components from file
+file(READ ${CMAKE_CURRENT_LIST_DIR}/../ArmnnVersion.txt armnnVersion)
+
+# Parse the ArmNN version components
+string(REGEX MATCH "ARMNN_MAJOR_VERSION ([0-9]*)" _ ${armnnVersion})
+set(ARMNN_MAJOR_VERSION ${CMAKE_MATCH_1})
+string(REGEX MATCH "ARMNN_MINOR_VERSION ([0-9]*)" _ ${armnnVersion})
+set(ARMNN_MINOR_VERSION ${CMAKE_MATCH_1})
+string(REGEX MATCH "ARMNN_PATCH_VERSION ([0-9]*)" _ ${armnnVersion})
+set(ARMNN_PATCH_VERSION ${CMAKE_MATCH_1})
+
+# Put together the ArmNN version (YYYYMMPP)
+set(ARMNN_VERSION "20${ARMNN_MAJOR_VERSION}${ARMNN_MINOR_VERSION}${ARMNN_PATCH_VERSION}")
+
+# Pass the ArmNN version to the build
+if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
+ add_definitions(-DARMNN_VERSION_FROM_FILE=${ARMNN_VERSION})
+else()
+ add_compile_definitions(ARMNN_VERSION_FROM_FILE=${ARMNN_VERSION})
+endif()