MLECO-3575: Add option to manually set PARALLEL_JOBS for build
* Check CMAKE_BUILD_PARALLEL_LEVEL and use this option to set the value
of PARALLEL_JOBS
Signed-off-by: Conor Kennedy <conor.kennedy@arm.com>
Change-Id: I039d88a1099932978e00a711fe58d31a85d2cd06
diff --git a/scripts/cmake/tensorflow.cmake b/scripts/cmake/tensorflow.cmake
index 24227d9..c63556d 100644
--- a/scripts/cmake/tensorflow.cmake
+++ b/scripts/cmake/tensorflow.cmake
@@ -15,8 +15,12 @@
# limitations under the License.
#----------------------------------------------------------------------------
-include(ProcessorCount)
-ProcessorCount(J)
+if (DEFINED ENV{CMAKE_BUILD_PARALLEL_LEVEL})
+ set(PARALLEL_JOBS $ENV{CMAKE_BUILD_PARALLEL_LEVEL})
+else()
+ include(ProcessorCount)
+ ProcessorCount(PARALLEL_JOBS)
+endif()
if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(TENSORFLOW_LITE_MICRO_CORE_OPTIMIZATION_LEVEL "-O0")
@@ -89,7 +93,7 @@
# Command to build the TensorFlow Lite Micro library
COMMAND ${CMAKE_COMMAND} -E env PATH=${ENV_PATH}
- make -j${J} -f ${TENSORFLOW_LITE_MICRO_PATH}/tools/make/Makefile ${MAKE_TARGETS_LIST}
+ make -j${PARALLEL_JOBS} -f ${TENSORFLOW_LITE_MICRO_PATH}/tools/make/Makefile ${MAKE_TARGETS_LIST}
TARGET_TOOLCHAIN_ROOT=${TENSORFLOW_LITE_MICRO_TARGET_TOOLCHAIN_ROOT}
TOOLCHAIN=${TENSORFLOW_LITE_MICRO_TOOLCHAIN}
GENDIR=${TENSORFLOW_LITE_MICRO_GENDIR}