Cleanup: format CMake files
Wrap long lines, correct typos, simpler line wrapping for messages.
This commit is contained in:
@@ -124,25 +124,29 @@ enable_testing()
|
|||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
||||||
message(FATAL_ERROR "\
|
message(FATAL_ERROR
|
||||||
The minimum supported version of GCC is 11.0.0, found C compiler: ${CMAKE_C_COMPILER_VERSION}"
|
"The minimum supported version of GCC is 11.0.0, found C compiler: "
|
||||||
|
"${CMAKE_C_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
||||||
message(FATAL_ERROR "\
|
message(FATAL_ERROR
|
||||||
The minimum supported version of GCC is 11.0.0, found C++ compiler${CMAKE_CXX_COMPILER_VERSION}"
|
"The minimum supported version of GCC is 11.0.0, found C++ compiler: "
|
||||||
|
"${CMAKE_CXX_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0")
|
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0")
|
||||||
message(FATAL_ERROR "\
|
message(FATAL_ERROR
|
||||||
The minimum supported version of CLANG is 8.0, found C compiler ${CMAKE_C_COMPILER_VERSION}"
|
"The minimum supported version of CLANG is 8.0, found C compiler: "
|
||||||
|
"${CMAKE_C_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0")
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0")
|
||||||
message(FATAL_ERROR "\
|
message(FATAL_ERROR
|
||||||
The minimum supported version of CLANG is 8.0, found C++ compiler ${CMAKE_CXX_COMPILER_VERSION}"
|
"The minimum supported version of CLANG is 8.0, found C++ compiler: "
|
||||||
|
"${CMAKE_CXX_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -1789,7 +1793,8 @@ Keep at '0' to automatically compute optimal values for each build."
|
|||||||
mark_as_advanced(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
mark_as_advanced(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Try to compute good default values, unless some are enforced in the user-exposed CMake cached variables.
|
# Try to compute good default values,
|
||||||
|
# unless some are enforced in the user-exposed CMake cached variables.
|
||||||
|
|
||||||
cmake_host_system_information(RESULT _NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
|
cmake_host_system_information(RESULT _NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
|
||||||
# Note: this gives mem in MB.
|
# Note: this gives mem in MB.
|
||||||
@@ -1798,16 +1803,19 @@ Keep at '0' to automatically compute optimal values for each build."
|
|||||||
set(_link_jobs 0)
|
set(_link_jobs 0)
|
||||||
if(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
if(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
||||||
set(_link_jobs ${NINJA_MAX_NUM_PARALLEL_LINK_JOBS})
|
set(_link_jobs ${NINJA_MAX_NUM_PARALLEL_LINK_JOBS})
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_LINK_JOBS: max concurrent linking jobs (from settings): ${_link_jobs}")
|
message(STATUS
|
||||||
|
" NINJA_MAX_NUM_PARALLEL_LINK_JOBS: "
|
||||||
|
"max concurrent linking jobs (from settings): ${_link_jobs}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
if (${_link_jobs} LESS 1)
|
if(${_link_jobs} LESS 1)
|
||||||
# Heuristics: Maximum amount of memory needed per linking task.
|
# Heuristics: Maximum amount of memory needed per linking task.
|
||||||
# Note: These values are purposedly over-estimated by 10-15% at least, to account
|
# Note: These values are purposedly over-estimated by 10-15% at least, to account
|
||||||
# for other types of jobs' memory usage, other system memory usages, etc.
|
# for other types of jobs' memory usage, other system memory usages, etc.
|
||||||
set(_link_mem 10000)
|
set(_link_mem 10000)
|
||||||
if (WITH_COMPILER_ASAN)
|
if(WITH_COMPILER_ASAN)
|
||||||
set(_link_mem 30000)
|
set(_link_mem 30000)
|
||||||
elseif ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
elseif("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||||
set(_link_mem 20000)
|
set(_link_mem 20000)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -1826,8 +1834,10 @@ Keep at '0' to automatically compute optimal values for each build."
|
|||||||
set(_link_jobs 1)
|
set(_link_jobs 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_LINK_JOBS: max concurrent linking jobs (computed): ${_link_jobs}")
|
message(STATUS
|
||||||
|
" NINJA_MAX_NUM_PARALLEL_LINK_JOBS: "
|
||||||
|
"max concurrent linking jobs (computed): ${_link_jobs}"
|
||||||
|
)
|
||||||
set(_link_mem)
|
set(_link_mem)
|
||||||
set(_link_jobs_max)
|
set(_link_jobs_max)
|
||||||
endif()
|
endif()
|
||||||
@@ -1840,17 +1850,19 @@ Keep at '0' to automatically compute optimal values for each build."
|
|||||||
set(_compile_heavy_jobs 0)
|
set(_compile_heavy_jobs 0)
|
||||||
if(NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
if(NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
||||||
set(_compile_heavy_jobs ${NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS})
|
set(_compile_heavy_jobs ${NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS})
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS: \
|
message(STATUS
|
||||||
max concurrent heavy compile jobs (from settings): ${_compile_heavy_jobs}")
|
" NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS: "
|
||||||
|
"max concurrent heavy compile jobs (from settings): ${_compile_heavy_jobs}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
if (${_compile_heavy_jobs} LESS 1)
|
if(${_compile_heavy_jobs} LESS 1)
|
||||||
# Heuristics: Maximum amount of memory needed per heavy compile task.
|
# Heuristics: Maximum amount of memory needed per heavy compile task.
|
||||||
# Note: These values are purposedly over-estimated by 10-15% at least, to account
|
# Note: These values are purposedly over-estimated by 10-15% at least, to account
|
||||||
# for other types of jobs' memory usage, other system memory usages, etc.
|
# for other types of jobs' memory usage, other system memory usages, etc.
|
||||||
set(_compile_heavy_mem 2000)
|
set(_compile_heavy_mem 2000)
|
||||||
if (WITH_COMPILER_ASAN)
|
if(WITH_COMPILER_ASAN)
|
||||||
set(_compile_heavy_mem 15000)
|
set(_compile_heavy_mem 15000)
|
||||||
elseif ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
elseif("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||||
set(_compile_heavy_mem 2000)
|
set(_compile_heavy_mem 2000)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -1872,8 +1884,10 @@ max concurrent heavy compile jobs (from settings): ${_compile_heavy_jobs}")
|
|||||||
set(_compile_heavy_jobs 1)
|
set(_compile_heavy_jobs 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS: \
|
message(STATUS
|
||||||
max concurrent heavy compile jobs (computed): ${_compile_heavy_jobs}")
|
" NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS: "
|
||||||
|
"max concurrent heavy compile jobs (computed): ${_compile_heavy_jobs}"
|
||||||
|
)
|
||||||
|
|
||||||
set(_compile_heavy_mem)
|
set(_compile_heavy_mem)
|
||||||
set(_compile_heavy_jobs_max)
|
set(_compile_heavy_jobs_max)
|
||||||
@@ -1886,31 +1900,36 @@ max concurrent heavy compile jobs (computed): ${_compile_heavy_jobs}")
|
|||||||
set(_compile_jobs 0)
|
set(_compile_jobs 0)
|
||||||
if(NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS)
|
if(NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS)
|
||||||
set(_compile_jobs ${NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS})
|
set(_compile_jobs ${NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS})
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS: \
|
message(STATUS
|
||||||
max concurrent regular compile jobs (from settings): ${_compile_jobs}")
|
" NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS: "
|
||||||
|
"max concurrent regular compile jobs (from settings): ${_compile_jobs}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
if (${_compile_jobs} LESS 1)
|
if(${_compile_jobs} LESS 1)
|
||||||
# Heuristics: Maximum amount of memory needed per regular compile task.
|
# Heuristics: Maximum amount of memory needed per regular compile task.
|
||||||
# Note: These values are purposedly over-estimated by 10-15% at least, to account
|
# NOTE: These values are purposefully over-estimated by 10-15% at least,
|
||||||
# for other types of jobs' memory usage, other system memory usages, etc.
|
# to account for other types of jobs' memory usage, other system memory usages, etc.
|
||||||
#
|
#
|
||||||
# FIXME:
|
# FIXME:
|
||||||
# There are a few files in 'normal' compile job pool now that require a significant amount of RAM
|
# There are a few files in 'normal' compile job pool now
|
||||||
# (e.g. `blenkernel/intern/volume.cc` can require almost 5GB of RAM in debug + ASAN builds). Until
|
# that require a significant amount of RAM
|
||||||
# we can add individual files to the heavy compile pool job (not possible currently with CMake),
|
# (e.g. `blenkernel/intern/volume.cc` can require almost 5GB of RAM in debug + ASAN builds).
|
||||||
# using overly-big values in ASAN build cases is the best that can be done.
|
# Until we can add individual files to the heavy compile pool job
|
||||||
# Alternative solution would be to put several whole targets (like `bf_blenkernel`) into the heavy pool,
|
# (not possible currently with CMake), using overly-big
|
||||||
# but that is likely even worse of a workaround.
|
# values in ASAN build cases is the best that can be done.
|
||||||
|
# Alternative solution would be to put several whole targets (like `bf_blenkernel`)
|
||||||
|
# into the heavy pool, but that is likely even worse of a workaround.
|
||||||
set(_compile_mem 500)
|
set(_compile_mem 500)
|
||||||
if (WITH_COMPILER_ASAN)
|
if(WITH_COMPILER_ASAN)
|
||||||
set(_compile_mem 4000)
|
set(_compile_mem 4000)
|
||||||
elseif ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
elseif("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||||
set(_compile_mem 500)
|
set(_compile_mem 500)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
math(EXPR _compile_jobs "${_TOT_MEM} / ${_compile_mem}")
|
math(EXPR _compile_jobs "${_TOT_MEM} / ${_compile_mem}")
|
||||||
if(${_NUM_CORES} GREATER 3)
|
if(${_NUM_CORES} GREATER 3)
|
||||||
# Heuristics: Cap max number of regular compile jobs to less than the total available anount of cores,
|
# Heuristics: Cap max number of regular compile jobs
|
||||||
|
# to less than the total available amount of cores,
|
||||||
# to ensure neither linking nor heavy compile jobs are starved from cores.
|
# to ensure neither linking nor heavy compile jobs are starved from cores.
|
||||||
math(EXPR _compile_jobs_max "${_NUM_CORES} - ${_link_jobs} - (${_compile_heavy_jobs} / 8)")
|
math(EXPR _compile_jobs_max "${_NUM_CORES} - ${_link_jobs} - (${_compile_heavy_jobs} / 8)")
|
||||||
else()
|
else()
|
||||||
@@ -1922,9 +1941,10 @@ max concurrent regular compile jobs (from settings): ${_compile_jobs}")
|
|||||||
set(_compile_jobs 1)
|
set(_compile_jobs 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS " NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS: \
|
message(STATUS
|
||||||
max concurrent regular compile jobs (computed): ${_compile_jobs}")
|
" NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS: "
|
||||||
|
"max concurrent regular compile jobs (computed): ${_compile_jobs}"
|
||||||
|
)
|
||||||
set(_compile_mem)
|
set(_compile_mem)
|
||||||
set(_compile_jobs_max)
|
set(_compile_jobs_max)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user