Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Carlisle <carlisle.b3d@gmail.com>2022-01-11 22:18:34 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2022-01-11 22:18:58 +0300
commit259a71cd3c06a258d5795e1a1529db4f687dcd93 (patch)
treed3af6eca7e27033e5438756d47c2fae16e1b067a
parent8cff1ecf9fd5aad79c695de0532cc399b66874a6 (diff)
Build: use precompiled headers on all platforms
Since CMake 3.16, CMake has native precompiled header (PCH) support. This change swaps Blender's own PCH implementation with the native implementation. Previously, PCH was only enabled on Windows however, this new implementation works on all platforms. For more information see https://cmake.org/cmake/help/latest/command/target_precompile_headers.html On my system, Linux with ninja running on an i5 8250U I saw a 60% reduction in compile times for `bf_freestyle` + linking time. Reviewed By: LazyDodo, brecht Differential Revision: https://developer.blender.org/D13797
-rw-r--r--build_files/cmake/macros.cmake23
-rw-r--r--source/blender/freestyle/CMakeLists.txt5
-rw-r--r--source/blender/freestyle/FRS_precomp.cpp2
3 files changed, 4 insertions, 26 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 34c2c9a684d..25a8b66af51 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1292,29 +1292,6 @@ macro(openmp_delayload
endif()
endmacro()
-macro(blender_precompile_headers target cpp header)
- if(MSVC)
- # get the name for the pch output file
- get_filename_component(pchbase ${cpp} NAME_WE)
- set(pchfinal "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${pchbase}.pch")
-
- # mark the cpp as the one outputting the pch
- set_property(SOURCE ${cpp} APPEND PROPERTY OBJECT_OUTPUTS "${pchfinal}")
-
- # get all sources for the target
- get_target_property(sources ${target} SOURCES)
-
- # make all sources depend on the pch to enforce the build order
- foreach(src ${sources})
- set_property(SOURCE ${src} APPEND PROPERTY OBJECT_DEPENDS "${pchfinal}")
- endforeach()
-
- target_sources(${target} PRIVATE ${cpp} ${header})
- set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/Yu${header} /Fp${pchfinal} /FI${header}")
- set_source_files_properties(${cpp} PROPERTIES COMPILE_FLAGS "/Yc${header} /Fp${pchfinal}")
- endif()
-endmacro()
-
macro(set_and_warn_dependency
_dependency _setting _val)
# when $_dependency is disabled, forces $_setting = $_val
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index b7eaf018dba..47da6bc55f6 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -594,4 +594,7 @@ if(WIN32)
endif()
blender_add_lib(bf_freestyle "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
-blender_precompile_headers(bf_freestyle FRS_precomp.cpp FRS_precomp.h)
+
+if(COMMAND target_precompile_headers)
+ target_precompile_headers(bf_freestyle PRIVATE FRS_precomp.h)
+endif()
diff --git a/source/blender/freestyle/FRS_precomp.cpp b/source/blender/freestyle/FRS_precomp.cpp
deleted file mode 100644
index 7e50a47f45b..00000000000
--- a/source/blender/freestyle/FRS_precomp.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Pre-compiled headers, see: D2606. */
-#include "FRS_precomp.h"