Move version definition to its own file

 * Move the ArmNN version to a separate ArmnnVersion.txt file
 * Updated makefiles accordingly

!referencetests:206978
!armnn:2089

Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: I02b838bc71611a866b3f96335e44a33b0167134f
diff --git a/Android.mk b/Android.mk
index 098e49c..cbc093c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -37,6 +37,11 @@
 OPENCL_HEADER_PATH := $(LOCAL_PATH)/clframework/include
 NN_HEADER_PATH := $(LOCAL_PATH)/../../../frameworks/ml/nn/runtime/include
 
+# Get ArmNN's version from file
+get_version_number = $(shell sed -n 's/.*$1  *\([0-9*]\)/\1/p' $(LOCAL_PATH)/armnn/ArmnnVersion.txt)
+ARMNN_VERSION := 20$(call get_version_number,ARMNN_MAJOR_VERSION)$(call get_version_number,ARMNN_MINOR_VERSION)$(call get_version_number,ARMNN_PATCH_VERSION)
+$(info android-nn-driver ARMNN_VERSION: $(ARMNN_VERSION))
+
 # Variables to control CL/NEON/reference backend support
 # Set them to '0' to disable support for a specific backend
 ARMNN_COMPUTE_CL_ENABLED := 1
@@ -82,7 +87,8 @@
         -std=$(CPP_VERSION) \
         -fexceptions \
         -Werror \
-        -Wno-format-security
+        -Wno-format-security \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION)
 
 ifeq ($(P_OR_LATER),1)
 # Required to build with the changes made to the Android ML framework starting from Android P,
@@ -205,6 +211,7 @@
         -fexceptions \
         -Werror \
         -Wno-format-security \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_P \
         -DARMNN_ANDROID_NN_V1_1
 
@@ -314,6 +321,7 @@
         -fexceptions \
         -Werror \
         -Wno-format-security \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_Q \
         -DARMNN_ANDROID_NN_V1_2
 
@@ -421,7 +429,9 @@
 
 LOCAL_CFLAGS := \
         -std=$(CPP_VERSION) \
-        -fexceptions
+        -fexceptions \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION)
+
 ifeq ($(ARMNN_DRIVER_DEBUG),1)
 LOCAL_CFLAGS += \
         -UNDEBUG
@@ -512,7 +522,9 @@
 LOCAL_CFLAGS := \
         -std=$(CPP_VERSION) \
         -fexceptions \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_NN_V1_1
+
 ifeq ($(ARMNN_DRIVER_DEBUG),1)
 LOCAL_CFLAGS += \
         -UNDEBUG
@@ -595,8 +607,10 @@
 LOCAL_CFLAGS := \
         -std=$(CPP_VERSION) \
         -fexceptions \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_NN_V1_2 \
         -DBOOST_NO_AUTO_PTR
+
 ifeq ($(ARMNN_DRIVER_DEBUG),1)
 LOCAL_CFLAGS += \
         -UNDEBUG
diff --git a/test/Android.mk b/test/Android.mk
index 93bfa69..68e8c7d 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -12,6 +12,11 @@
 ARMNN_HEADER_PATH := $(LOCAL_PATH)/../armnn/include
 ARMNN_DRIVER_HEADER_PATH := $(LOCAL_PATH)/..
 
+# Get ArmNN's version from file
+get_version_number = $(shell sed -n 's/.*$1  *\([0-9*]\)/\1/p' $(LOCAL_PATH)/../armnn/ArmnnVersion.txt)
+ARMNN_VERSION := 20$(call get_version_number,ARMNN_MAJOR_VERSION)$(call get_version_number,ARMNN_MINOR_VERSION)$(call get_version_number,ARMNN_PATCH_VERSION)
+$(info android-nn-driver/test ARMNN_VERSION: $(ARMNN_VERSION))
+
 ##########################
 # armnn-driver-tests@1.0 #
 ##########################
@@ -40,7 +45,8 @@
         -fexceptions \
         -Werror \
         -O0 \
-        -UNDEBUG
+        -UNDEBUG \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION)
 
 ifeq ($(P_OR_LATER),1)
 # Required to build with the changes made to the Android ML framework starting from Android P,
@@ -148,6 +154,7 @@
         -Werror \
         -O0 \
         -UNDEBUG \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_P \
         -DARMNN_ANDROID_NN_V1_1
 
@@ -245,6 +252,7 @@
         -Werror \
         -O0 \
         -UNDEBUG \
+        -DARMNN_VERSION_FROM_FILE=$(ARMNN_VERSION) \
         -DARMNN_ANDROID_Q \
         -DARMNN_ANDROID_NN_V1_2