Extending meson build system to support fast compilation during development stage

Tested compilation against 3 build configurations
- with lto for src and tests/src (for release sw):
  all: ~3 min; change in cpp file: ~2 min
- with lto for src and no_lto for tests/src (for release sw):
  all: ~2 min; change in cpp file:~ 40 sec
- after using scripts/configure_fast_compilation.sh (for development only):
  all: ~1.75 min; change in cpp file: ~20 sec

Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
Change-Id: Idf435d8455260d2d988cb7286d71401f21fd03e2
diff --git a/scripts/configure_fast_compilation.sh b/scripts/configure_fast_compilation.sh
new file mode 100755
index 0000000..b737615
--- /dev/null
+++ b/scripts/configure_fast_compilation.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+PARAMNAME=b_lto
+PARAMVAL=false
+FLAGTOMOD="-D${PARAMNAME}=$PARAMVAL"
+
+function _apply_mod()
+{
+  local BUILDDIR=$1
+  local RETCODE=1
+
+  if [ -n "$BUILDDIR" ]; then
+    if [ -d $BUILDDIR ]; then
+      meson configure $FLAGTOMOD $BUILDDIR
+      if [ $? -eq 0 ]; then
+        meson --reconfigure $BUILDDIR
+        RETCODE=$?
+      fi
+    else
+      meson $FLAGTOMOD $BUILDDIR
+      RETCODE=$?
+    fi
+  fi
+  return $RETCODE
+}
+
+function _help()
+{
+  local SCRIPTDIR=scripts
+  local SCRIPT="$SCRIPTDIR/$(basename $0)"
+
+  echo "##################### SCRIPT USAGE #####################"
+  echo "Please call this script from telemetry main directory"
+  echo "with parameter specifying name of your build directory"
+  echo "example:"
+  echo "./$SCRIPT BUILDDIRNAME"
+  echo "./$SCRIPT build"
+  echo "########################################################"
+}
+trap _help ERR
+
+### main ###
+
+_apply_mod $@
+exit $?
+
+### end ###
+