Add support of compile/link jobs pooling

This commit is contained in:
Maxim Moskalets
2025-03-03 22:30:38 +03:00
committed by Chris Hennes
parent 855ad6c709
commit b59cd79427

View File

@@ -13,6 +13,8 @@ macro(InitializeFreeCADBuildOptions)
option(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON)
option(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
option(FREECAD_CHECK_PIVY "Check for pivy version using Python at build time" ON)
option(FREECAD_PARALLEL_COMPILE_JOBS "Compilation jobs pool size to fit memory limitations.")
option(FREECAD_PARALLEL_LINK_JOBS "Linkage jobs pool size to fit memory limitations.")
option(BUILD_WITH_CONDA "Set ON if you build FreeCAD with conda" OFF)
option(BUILD_DYNAMIC_LINK_PYTHON "If OFF extension-modules do not link against python-libraries" ON)
option(INSTALL_TO_SITEPACKAGES "If ON the freecad root namespace (python) is installed into python's site-packages" ON)
@@ -206,4 +208,22 @@ macro(InitializeFreeCADBuildOptions)
"Please choose another build directory! Or disable the option BUILD_FORCE_DIRECTORY.")
endif()
endif()
if(FREECAD_PARALLEL_COMPILE_JOBS)
if(CMAKE_GENERATOR MATCHES "Ninja")
set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${FREECAD_PARALLEL_COMPILE_JOBS})
set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
else()
message(WARNING "Job pooling is only available with Ninja generators.")
endif()
endif()
if(FREECAD_PARALLEL_LINK_JOBS)
if(CMAKE_GENERATOR MATCHES "Ninja")
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${FREECAD_PARALLEL_LINK_JOBS})
set(CMAKE_JOB_POOL_LINK link_job_pool)
else()
message(WARNING "Job pooling is only available with Ninja generators.")
endif()
endif()
endmacro(InitializeFreeCADBuildOptions)