IVGCVSW-7330 Fix build-tool args for Docker builds

* This change requests users to supply a comma separated
  string of CMake/scons args so that they can passed
  down from Docker into the bash script correctly.
* Updated documentation to reflect this.

Signed-off-by: James Conroy <james.conroy@arm.com>
Change-Id: Icbd1d1458e11382936690ca6cc4417677e063ddb
diff --git a/build-tool/README.md b/build-tool/README.md
index b56a690..34c8998 100644
--- a/build-tool/README.md
+++ b/build-tool/README.md
@@ -168,8 +168,8 @@
 | --cl-backend        | **flag:** build Arm NN with the OpenCL backend (GPU acceleration from ACL)                                                                                                                                                                                                                                            |
 | --ref-backend       | **flag:** build Arm NN with the reference backend<br/>**Should be used for verification purposes only.<br/>Does not provide any performance acceleration.**                                                                                                                                                           |
 | --debug             | **flag:** build Arm NN (and ACL) with debug turned on (optional: defaults to off)                                                                                                                                                                                                                                     |
-| --armnn-cmake-args= | **option:** provide additional space-separated CMake arguments string for building Arm NN (optional)<br/>String should start and end with **single quotes** ```'```<br/>Please refer to **armnn/cmake/GlobalConfig.cmake**                                                                                            |
-| --acl-scons-params= | **option**: provide additional space-separated scons parameters string for building ACL (optional)<br/>String should start and end with **single quotes** ```'```<br/>ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options |
+| --armnn-cmake-args= | **option:** provide additional comma-separated CMake arguments string for building Arm NN (optional)<br/>String should start and end with **single quotes** ```'```<br/>Please refer to **armnn/cmake/GlobalConfig.cmake**                                                                                            |
+| --acl-scons-params= | **option**: provide additional comma-separated scons parameters string for building ACL (optional)<br/>String should start and end with **single quotes** ```'```<br/>ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options |
 
 
 **At least one component** (i.e. ```--tflite-delegate```, ```--tflite-parser```, ```--onnx-parser```) must be provided or else provide ```--all``` to build all Arm NN components.<br>
@@ -181,10 +181,10 @@
 ```BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend"```
 
 Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params:<br>
-```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1 benchmark_examples=1'"```
+```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'"```
 
 Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:<br>
-```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1 -DBUILD_UNIT_TESTS=0'"```
+```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0'"```
 
 **Example _valid_ combination of SETUP_ARGS and BUILD_ARGS:**<br>
 ```
diff --git a/build-tool/scripts/build-armnn.sh b/build-tool/scripts/build-armnn.sh
index c0e4f93..af66341 100755
--- a/build-tool/scripts/build-armnn.sh
+++ b/build-tool/scripts/build-armnn.sh
@@ -208,9 +208,9 @@
   --debug
     build Arm NN (and ACL) with debug turned on (optional: defaults to off)
   --armnn-cmake-args=<ARG LIST STRING>
-    provide additional space-separated CMake arguments string for building Arm NN (optional)
+    provide additional comma-separated CMake arguments string for building Arm NN (optional)
   --acl-scons-params=<PARAM LIST STRING>
-    provide additional space-separated scons parameters string for building ACL (optional)
+    provide additional comma-separated scons parameters string for building ACL (optional)
   --num-threads=<INTEGER>
     specify number of threads/cores to build dependencies with (optional: defaults to number of online CPU cores on host)
   -h, --help
@@ -232,9 +232,9 @@
 Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled:
   <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend
 Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params:
-  <PATH_TO>/build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1 benchmark_examples=1'
+  <PATH_TO>/build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'
 Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:
-  <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1 -DBUILD_UNIT_TESTS=0'
+  <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0'
 EOF
 }
 
@@ -419,6 +419,13 @@
   DEBUG_POSTFIX="_debug"
 fi
 
+# Replace commas with spaces in additional Arm NN / ACL build args
+# shellcheck disable=SC2001
+armnn_cmake_args="$(echo "$armnn_cmake_args" | sed 's/,/ /g')"
+
+# shellcheck disable=SC2001
+acl_scons_params="$(echo "$acl_scons_params" | sed 's/,/ /g')"
+
 # Directories for Arm NN and ACL build outputs
 ARMNN_BUILD_ROOT="$BUILD_DIR"/armnn
 ARMNN_BUILD_DIR_NAME="$TARGET_ARCH"_build"$DEBUG_POSTFIX"