mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 10:35:42 +00:00
Merge topic 'add-unity-builds'
555013cdd CMAKE: add unity builds support Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !2600
This commit is contained in:
commit
db26d2e3ef
@ -464,6 +464,16 @@ function(vtkm_library)
|
|||||||
set(VTKm_LIB_type SHARED)
|
set(VTKm_LIB_type SHARED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Skip unity builds unless explicitly asked
|
||||||
|
foreach(source IN LISTS VTKm_LIB_SOURCES VTKm_LIB_DEVICE_SOURCES)
|
||||||
|
get_source_file_property(is_candidate ${source} UNITY_BUILD_CANDIDATE)
|
||||||
|
if (NOT is_candidate)
|
||||||
|
list(APPEND non_unity_sources ${source})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_source_files_properties(${non_unity_sources} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||||
|
|
||||||
add_library(${lib_name}
|
add_library(${lib_name}
|
||||||
${VTKm_LIB_type}
|
${VTKm_LIB_type}
|
||||||
${VTKm_LIB_SOURCES}
|
${VTKm_LIB_SOURCES}
|
||||||
@ -615,8 +625,10 @@ function(vtkm_add_instantiations instantiations_list)
|
|||||||
math(EXPR counter "${counter} + 1")
|
math(EXPR counter "${counter} + 1")
|
||||||
endforeach(instantiation)
|
endforeach(instantiation)
|
||||||
|
|
||||||
set_source_files_properties(${_instantiations_list}
|
# Force unity builds here
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
|
set_source_files_properties(${_instantiations_list} PROPERTIES
|
||||||
|
SKIP_UNITY_BUILD_INCLUSION OFF
|
||||||
|
UNITY_BUILD_CANDIDATE ON
|
||||||
)
|
)
|
||||||
set(${instantiations_list} ${_instantiations_list} PARENT_SCOPE)
|
set(${instantiations_list} ${_instantiations_list} PARENT_SCOPE)
|
||||||
endfunction(vtkm_add_instantiations)
|
endfunction(vtkm_add_instantiations)
|
||||||
|
@ -24,6 +24,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
set(VTKm_CMAKE_MODULE_PATH ${VTKm_SOURCE_DIR}/CMake)
|
set(VTKm_CMAKE_MODULE_PATH ${VTKm_SOURCE_DIR}/CMake)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
|
# While disabled system-wide, VTK-m uses UNITY builds in some modules
|
||||||
|
set(CMAKE_UNITY_BUILD OFF)
|
||||||
|
|
||||||
|
# By default effectively disable unity builds
|
||||||
|
if (NOT DEFINED CMAKE_UNITY_BUILD_BATCH_SIZE)
|
||||||
|
set(CMAKE_UNITY_BUILD_BATCH_SIZE 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Determine VTK-m version
|
# Determine VTK-m version
|
||||||
include(Utilities/Git/Git.cmake)
|
include(Utilities/Git/Git.cmake)
|
||||||
include(VTKmDetermineVersion)
|
include(VTKmDetermineVersion)
|
||||||
|
12
docs/changelog/EnableUnityBuild.md
Normal file
12
docs/changelog/EnableUnityBuild.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
## Enable Unity build ##
|
||||||
|
|
||||||
|
VTK-m now partially supports unity builds in a subset its sources files which
|
||||||
|
are known to take the longer time/memory to build. Particularly, this enables
|
||||||
|
you to speedup compilation in VTK-m not memory intensive builds (HIP, CUDA) in a
|
||||||
|
system with sufficient resources.
|
||||||
|
|
||||||
|
We use `BATCH` unity builds type and the number of source files per batch can be
|
||||||
|
controlled by the canonical _CMake_ variable: `CMAKE_UNITY_BUILD_BATCH_SIZE`.
|
||||||
|
|
||||||
|
Unity builds requires _CMake_ >= 3.16, if using a older version, unity build
|
||||||
|
will be disabled a regular build will be performed.
|
@ -234,8 +234,6 @@ set(gradient_sources_device
|
|||||||
vtkm_pyexpander_generated_file(ClipWithFieldExternInstantiations.h)
|
vtkm_pyexpander_generated_file(ClipWithFieldExternInstantiations.h)
|
||||||
vtkm_pyexpander_generated_file(ClipWithImplicitFunctionExternInstantiations.h)
|
vtkm_pyexpander_generated_file(ClipWithImplicitFunctionExternInstantiations.h)
|
||||||
|
|
||||||
set_source_files_properties(Contour.cxx ExtractStructured.cxx PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
add_library(vtkm_filter INTERFACE)
|
add_library(vtkm_filter INTERFACE)
|
||||||
|
|
||||||
vtkm_library(
|
vtkm_library(
|
||||||
@ -270,12 +268,14 @@ vtkm_library(
|
|||||||
USE_VTKM_JOB_POOL
|
USE_VTKM_JOB_POOL
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(TARGET
|
set_target_properties(
|
||||||
vtkm_filter_common
|
vtkm_filter_common
|
||||||
vtkm_filter_extra
|
vtkm_filter_extra
|
||||||
vtkm_filter_contour
|
vtkm_filter_contour
|
||||||
vtkm_filter_gradient
|
vtkm_filter_gradient
|
||||||
PROPERTY UNITY_BUILD_MODE GROUP
|
PROPERTIES
|
||||||
|
UNITY_BUILD ON
|
||||||
|
UNITY_BUILD_MODE BATCH
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(vtkm_filter_common PUBLIC vtkm_worklet)
|
target_link_libraries(vtkm_filter_common PUBLIC vtkm_worklet)
|
||||||
|
Loading…
Reference in New Issue
Block a user