提交 668a8486 编写于 作者: M Megvii Engine Team

fix(cmake/windows): fix low probability build failed on Windows

GitOrigin-RevId: 21fe964bbb03e5eedaf07ed51d136e436fc73748
上级 26ac2b00
...@@ -119,6 +119,18 @@ function show_cmakelist_options() { ...@@ -119,6 +119,18 @@ function show_cmakelist_options() {
} }
function config_ninja_default_max_jobs() { function config_ninja_default_max_jobs() {
((NINJA_MAX_JOBS = ${cpu_number} + 2)) # plus 2 is ninja default behavior, you can run ninja -h to verify
echo "config default NINJA_MAX_JOBS to ${NINJA_MAX_JOBS}" # but at Windows env, default max jobs will take 100% cpu, which may lead
# to some Windows OS issue sometimes, eg, OpenSSH server lost respond or vcvarsall.bat
# setenv failed etc(especially enable CUDA). I have no idea about this Windows OS issue.
# as a workaround: config default NINJA_MAX_JOBS to cpu_number - 1
if [[ $OS =~ "NT" ]]; then
((NINJA_MAX_JOBS = ${cpu_number} - 1))
if [[ ${NINJA_MAX_JOBS} -le 0 ]]; then
NINJA_MAX_JOBS=1
fi
else
((NINJA_MAX_JOBS = ${cpu_number} + 2))
fi
echo "config default NINJA_MAX_JOBS to ${NINJA_MAX_JOBS} [cpu number is:${cpu_number}]"
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册