[Bf-blender-cvs] [9c76b2c3b68] master: Freestyle: Use precompiled headers with MSVC.

Ray Molenkamp noreply at git.blender.org
Thu Jun 6 03:05:26 CEST 2019


Commit: 9c76b2c3b685ffcfaa4d6f28eed14528ea06f745
Author: Ray Molenkamp
Date:   Wed Jun 5 19:05:16 2019 -0600
Branches: master
https://developer.blender.org/rB9c76b2c3b685ffcfaa4d6f28eed14528ea06f745

Freestyle: Use precompiled headers with MSVC.

This brings down the build time for freestyle with MSVC from a
minute to 10-20 seconds.

vs2019 bf_freestyle debug   before: 60464 ms  after: 11028 ms
vs2019 bf_freestyle release before: 56984 ms  after: 20526 ms

Differential Revision: https://developer.blender.org/D2606

Reviewed By: brecht , sergey

===================================================================

M	build_files/cmake/macros.cmake
M	source/blender/freestyle/CMakeLists.txt
A	source/blender/freestyle/FRS_precomp.cpp
A	source/blender/freestyle/FRS_precomp.h

===================================================================

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5fd677ee5c9..42f707d8142 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1220,3 +1220,11 @@ macro(WINDOWS_SIGN_TARGET target)
     endif()
   endif()
 endmacro()
+
+MACRO(blender_precompile_headers target cpp header)
+  if (MSVC AND NOT MSVC_CLANG)
+		target_sources(${target} PRIVATE ${cpp} ${header})
+		set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/Yu${header} /FI${header}")
+		set_source_files_properties(${cpp} PROPERTIES COMPILE_FLAGS "/Yc${header}")
+	endif()
+ENDMACRO()
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index e6e72ea01db..253fcecc81c 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -586,3 +586,4 @@ if(WIN32)
 endif()
 
 blender_add_lib(bf_freestyle "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
+blender_precompile_headers(bf_freestyle FRS_precomp.cpp FRS_precomp.h)
diff --git a/source/blender/freestyle/FRS_precomp.cpp b/source/blender/freestyle/FRS_precomp.cpp
new file mode 100644
index 00000000000..771f5bf3a4a
--- /dev/null
+++ b/source/blender/freestyle/FRS_precomp.cpp
@@ -0,0 +1 @@
+#include "FRS_precomp.h"
\ No newline at end of file
diff --git a/source/blender/freestyle/FRS_precomp.h b/source/blender/freestyle/FRS_precomp.h
new file mode 100644
index 00000000000..6b9abff1446
--- /dev/null
+++ b/source/blender/freestyle/FRS_precomp.h
@@ -0,0 +1,46 @@
+#include <Python.h>
+#include <pthread.h>
+#include <string>
+#include <vector>
+#include <iostream>
+#include <math.h>
+#include <stdbool.h>
+#include <algorithm>
+#include <time.h>
+#include <iterator>
+#include <memory>
+#include <set>
+#include <map>
+#include <list>
+#include <deque>
+#include <sstream>
+#include <stdarg.h>
+#include <fstream>
+#include <iomanip>
+#include <stack>
+#include "intern/python/BPy_BBox.h"
+#include "intern/python/BPy_BinaryPredicate0D.h"
+#include "intern/python/BPy_BinaryPredicate1D.h"
+#include "intern/python/BPy_ContextFunctions.h"
+#include "intern/python/BPy_Convert.h"
+#include "intern/python/BPy_Freestyle.h"
+#include "intern/python/BPy_FrsMaterial.h"
+#include "intern/python/BPy_FrsNoise.h"
+#include "intern/python/BPy_Id.h"
+#include "intern/python/BPy_IntegrationType.h"
+#include "intern/python/BPy_Interface0D.h"
+#include "intern/python/BPy_Interface1D.h"
+#include "intern/python/BPy_Iterator.h"
+#include "intern/python/BPy_MediumType.h"
+#include "intern/python/BPy_Nature.h"
+#include "intern/python/BPy_Operators.h"
+#include "intern/python/BPy_SShape.h"
+#include "intern/python/BPy_StrokeAttribute.h"
+#include "intern/python/BPy_StrokeShader.h"
+#include "intern/python/BPy_UnaryFunction0D.h"
+#include "intern/python/BPy_UnaryFunction1D.h"
+#include "intern/python/BPy_UnaryPredicate0D.h"
+#include "intern/python/BPy_UnaryPredicate1D.h"
+#include "intern/python/BPy_ViewMap.h"
+#include "intern/python/BPy_ViewShape.h"
+#include "intern/python/Director.h"



More information about the Bf-blender-cvs mailing list