deps builld: Try to honour CMAKE_BUILD_PARALLEL_LEVEL (#13158)

* deps: Use CMAKE_BUILD_PARALLEL_LEVEL for dependency builds.

If set when initial CMake is run, don't hard-code the number of CPUs for all the
recursive child builds.

* build_linux: Pass -j1 for dependency build.

This is recommended by the comment at the top of deps/CMakeLists.txt, and makes
sense as the recursive build steps will pick up
CMAKE_BUILD_PARALLEL_LEVEL (otherwise the number of parallel jobs is squared).
This commit is contained in:
Angus Gratton
2026-04-17 14:34:35 +10:00
committed by GitHub
parent a394ba696c
commit b88a314763
2 changed files with 12 additions and 5 deletions

15
deps/CMakeLists.txt vendored
View File

@@ -166,11 +166,18 @@ function(orcaslicer_add_cmake_project projectname)
endif ()
endif ()
set(_gen "")
set(_build_j "-j${NPROC}")
if (MSVC)
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
set(_build_j "/m")
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
else()
set(_gen "")
endif()
if ($ENV{CMAKE_BUILD_PARALLEL_LEVEL})
set(_build_j "") # assume environment will control --build parallel setting
elseif(MSVC)
set(_build_j "/m")
else()
set(_build_j "-j${NPROC}")
endif ()
if (NOT IS_CROSS_COMPILE OR NOT APPLE)