Build: Ninja: Move 'Unity builds' to heavy pooljobs.

This commit adds a new helper to define expected properties when a
target needs to use the unity build feature.

That new helper does what was already done for existing cases, and in
addition add the target to the Ninja 'heavy' pooljobs if relevant.

Pull Request: https://projects.blender.org/blender/blender/pulls/116791
This commit is contained in:
Bastien Montagne
2024-01-05 16:22:25 +01:00
committed by Gitea
parent fd0ca109b1
commit 95b30b3516
6 changed files with 19 additions and 20 deletions

View File

@@ -223,6 +223,20 @@ function(blender_target_include_dirs_sys
blender_target_include_dirs_impl(${target} TRUE "${_ALL_INCS}")
endfunction()
# Enable unity build for the given target.
function(blender_set_target_unity_build target batch_size)
if(WITH_UNITY_BUILD)
set_target_properties(${target} PROPERTIES
UNITY_BUILD ON
UNITY_BUILD_BATCH_SIZE ${batch_size}
)
if(WITH_NINJA_POOL_JOBS AND NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
# Unity builds are typically heavy.
set_target_properties(${target} PROPERTIES JOB_POOL_COMPILE compile_heavy_job_pool)
endif()
endif()
endfunction()
# Set include paths for header files included with "*.h" syntax.
# This enables auto-complete suggestions for user header files on Xcode.
# Build process is not affected since the include paths are the same

View File

@@ -648,10 +648,7 @@ if(WITH_COMPOSITOR_CPU)
blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_UNITY_BUILD)
set_target_properties(bf_compositor PROPERTIES UNITY_BUILD ON)
set_target_properties(bf_compositor PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
endif()
blender_set_target_unity_build(bf_compositor 10)
if(COMMAND target_precompile_headers)
target_precompile_headers(bf_compositor PRIVATE COM_precomp.h)

View File

@@ -159,10 +159,7 @@ endif()
blender_add_lib(bf_nodes_composite "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_UNITY_BUILD)
set_target_properties(bf_nodes_composite PROPERTIES UNITY_BUILD ON)
set_target_properties(bf_nodes_composite PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
endif()
blender_set_target_unity_build(bf_nodes_composite 10)
# RNA_prototypes.h
add_dependencies(bf_nodes_composite bf_rna)

View File

@@ -72,7 +72,4 @@ list(APPEND LIB
blender_add_lib(bf_nodes_function "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
target_link_libraries(bf_nodes_functions_generated bf_nodes_function)
if(WITH_UNITY_BUILD)
set_target_properties(bf_nodes_function PROPERTIES UNITY_BUILD ON)
set_target_properties(bf_nodes_function PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
endif()
blender_set_target_unity_build(bf_nodes_function 10)

View File

@@ -285,10 +285,7 @@ list(APPEND LIB
blender_add_lib(bf_nodes_geometry "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
target_link_libraries(bf_nodes_geometry_generated bf_nodes_geometry)
if(WITH_UNITY_BUILD)
set_target_properties(bf_nodes_geometry PROPERTIES UNITY_BUILD ON)
set_target_properties(bf_nodes_geometry PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
endif()
blender_set_target_unity_build(bf_nodes_geometry 10)
# RNA_prototypes.h
add_dependencies(bf_nodes_geometry bf_rna)

View File

@@ -185,10 +185,7 @@ endif()
blender_add_lib(bf_nodes_shader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_UNITY_BUILD)
set_target_properties(bf_nodes_shader PROPERTIES UNITY_BUILD ON)
set_target_properties(bf_nodes_shader PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
endif()
blender_set_target_unity_build(bf_nodes_shader 10)
# RNA_prototypes.h
add_dependencies(bf_nodes_shader bf_rna)