summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTanguy <tanguy@status.im>2023-05-11 16:50:18 +0200
committerGitHub <noreply@github.com>2023-05-11 16:50:18 +0200
commitc00448358121bbf6b5e1fcfe39bb6eb3359d6462 (patch)
treee47993297bc4833bd126a143a93f644b79c95aba
parentf7ed293fbd84bf0350fbfee78e634b5f401f5b0a (diff)
downloadNim-c00448358121bbf6b5e1fcfe39bb6eb3359d6462.tar.gz
Bootstrap: Allow to override number of CPUs (#21823)
* Allow to override number of cpu

* NCPU -> NIMCORES
-rw-r--r--ci/funs.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/ci/funs.sh b/ci/funs.sh
index 8e7f8faf7..026366198 100644
--- a/ci/funs.sh
+++ b/ci/funs.sh
@@ -58,7 +58,11 @@ _nimNumCpu(){
   # FreeBSD | macOS: $(sysctl -n hw.ncpu)
   # OpenBSD: $(sysctl -n hw.ncpuonline)
   # windows: $NUMBER_OF_PROCESSORS ?
-  echo $(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || 1)
+  if env | grep -q '^NIMCORES='; then
+    echo $NIMCORES
+  else
+    echo $(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || 1)
+  fi
 }
 
 _nimBuildCsourcesIfNeeded(){