From 7194b3a107dae3fc32943300d37c178274518db5 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sun, 4 Aug 2013 11:07:52 +0300 Subject: [PATCH] Control number of CPUs used for building --- OsmAnd/ndk-build.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OsmAnd/ndk-build.sh b/OsmAnd/ndk-build.sh index 9a91a5367b..00378164cc 100755 --- a/OsmAnd/ndk-build.sh +++ b/OsmAnd/ndk-build.sh @@ -16,8 +16,19 @@ if [ -z "$OSMAND_ARCHITECTURES_SET" ]; then export OSMAND_ARCHITECTURES_SET fi +if [[ "$(uname -a)" =~ Linux ]]; then + if [[ -z "$OSMAND_BUILD_CPU_CORES_NUM" ]]; then + OSMAND_BUILD_CPU_CORES_NUM=`nproc` + fi +fi +if [[ "$(uname -a)" =~ Darwin ]]; then + if [[ -z "$OSMAND_BUILD_CPU_CORES_NUM" ]]; then + OSMAND_BUILD_CPU_CORES_NUM=`sysctl hw.ncpu | awk '{print $2}'` + fi +fi + OSMAND_ANDROID_EXTERNAL_DEPENDENCIES=(expat freetype gdal giflib glm glsl-optimizer harfbuzz jpeg libpng protobuf qtbase-android skia) "$SCRIPT_LOC/../../core/externals/configure.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$SCRIPT_LOC/../../core/externals/build.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$SCRIPT_LOC/../../jni/generate.sh" -(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j`nproc`) +(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j$OSMAND_BUILD_CPU_CORES_NUM)