Skip to content
Snippets Groups Projects
Verified Commit f7e29eb6 authored by Lars Bilke's avatar Lars Bilke
Browse files

[CMake] Added option OGS_USE_UNITY_BUILDS.

parent 8151620f
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,9 @@ option(OGS_USE_CONAN "Should Conan package manager be used?" ON) ...@@ -31,6 +31,9 @@ option(OGS_USE_CONAN "Should Conan package manager be used?" ON)
set(OGS_CONAN_BUILD "missing" CACHE STRING "Possible values: all, missing, \ set(OGS_CONAN_BUILD "missing" CACHE STRING "Possible values: all, missing, \
never or list of libs to build") never or list of libs to build")
option(OGS_DISABLE_CCACHE "Disables ccache compiler cache." OFF) option(OGS_DISABLE_CCACHE "Disables ccache compiler cache." OFF)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
option(OGS_USE_UNITY_BUILDS "Enables Unity builds for faster compilation." OFF)
endif()
# Third-party libraries, names come from Conan package names # Third-party libraries, names come from Conan package names
set(OGS_LIBS set(OGS_LIBS
......
...@@ -101,4 +101,9 @@ function(ogs_add_library targetName) ...@@ -101,4 +101,9 @@ function(ogs_add_library targetName)
if(OGS_USE_PCH AND NOT ${targetName} STREQUAL "ChemistryLib") if(OGS_USE_PCH AND NOT ${targetName} STREQUAL "ChemistryLib")
cotire(${targetName}) cotire(${targetName})
endif() endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
set_target_properties(${targetName} PROPERTIES
UNITY_BUILD ${OGS_USE_UNITY_BUILDS})
endif()
endfunction() endfunction()
set_target_properties(BaseLib PROPERTIES UNITY_BUILD ON if(NOT OGS_USE_UNITY_BUILDS OR ${CMAKE_VERSION} VERSION_LESS 3.16)
UNITY_BUILD_BATCH_SIZE 8) return()
set_target_properties(GeoLib PROPERTIES UNITY_BUILD ON endif()
UNITY_BUILD_BATCH_SIZE 40)
set_target_properties(MathLib PROPERTIES UNITY_BUILD ON set_target_properties(BaseLib PROPERTIES UNITY_BUILD_BATCH_SIZE 8)
UNITY_BUILD_BATCH_SIZE 10) set_target_properties(GeoLib PROPERTIES UNITY_BUILD_BATCH_SIZE 40)
set_target_properties(MeshLib PROPERTIES UNITY_BUILD ON set_target_properties(MaterialLib PROPERTIES UNITY_BUILD_BATCH_SIZE 20)
UNITY_BUILD_BATCH_SIZE 40) set_target_properties(MathLib PROPERTIES UNITY_BUILD_BATCH_SIZE 10)
set_target_properties(MeshLib PROPERTIES UNITY_BUILD_BATCH_SIZE 20)
# set_target_properties(ProcessLib PROPERTIES UNITY_BUILD_BATCH_SIZE 80) # breaks!
if(TARGET testrunner)
# breaks!
# set_target_properties(testrunner PROPERTIES UNITY_BUILD ON)
# set_target_properties(testrunner PROPERTIES UNITY_BUILD_BATCH_SIZE 2)
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment