COMPMID-1081: Introduced test-wide instruments

Change-Id: I5831241f3fc503717cc51136453c2bf96d4b420b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128484
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
diff --git a/SConstruct b/SConstruct
index 626a302..23b9b2f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -196,8 +196,6 @@
 if env['standalone']:
     env.Append(CXXFLAGS = ['-fPIC'])
     env.Append(LINKFLAGS = ['-static-libgcc','-static-libstdc++'])
-    if env['cppthreads']:
-        env.Append(LINKFLAGS = ['-lpthread'])
 
 if env['Werror']:
     env.Append(CXXFLAGS = ['-Werror'])
@@ -222,6 +220,9 @@
         print("Cannot link OpenGLES statically, which is required for bare metal / standalone builds")
         Exit(1)
 
+if env["os"] not in ["android", "bare_metal"] and (env['opencl'] or env['cppthreads']):
+    env.Append(LIBS = ['pthread'])
+
 if env['opencl'] or env['gles_compute']:
     if env['embed_kernels']:
         env.Append(CPPDEFINES = ['EMBEDDED_KERNELS'])