[Bf-blender-cvs] [f2df4e0076a] master: Build optimization: Compile glew for size rather than speed with msvc.

Ray Molenkamp noreply at git.blender.org
Fri Feb 7 15:35:28 CET 2020


Commit: f2df4e0076a29a32813f870741b0f89fcbf00eed
Author: Ray Molenkamp
Date:   Fri Feb 7 07:35:17 2020 -0700
Branches: master
https://developer.blender.org/rBf2df4e0076a29a32813f870741b0f89fcbf00eed

Build optimization: Compile glew for size rather than speed with msvc.

Glew.obj is one of the more expensive targets we have to build clocking in
at 34.907 seconds.

The root cause [1] is the msvc inliner is not super thrilled with the
glewIsSupported supported function, this patch changes the buildflags
of extern_glew to optimize for size rather than speed.

Given glew is only in play at initalization time there will be no
performance impact.

Time to build glew.obj

Before: 34.907s
After :  1.961s

[1] https://developercommunity.visualstudio.com/content/problem/732941/slow-compilation-of-glewc-for-visual-studio-2019-x.html

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

Reviewers: brecht, sergey, fclem

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

M	extern/glew/CMakeLists.txt

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

diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt
index 18ca88e6fec..59f13eb73c7 100644
--- a/extern/glew/CMakeLists.txt
+++ b/extern/glew/CMakeLists.txt
@@ -25,6 +25,16 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
   )
 endif()
 
+# MSVC's inliner is not having a happy time with glewIsSupported
+# causing this to be one of the most expensive things to build
+# in blender. Optimize for size rather than speed sidesteps this
+# problem, more details at
+# https://developercommunity.visualstudio.com/content/problem/732941/slow-compilation-of-glewc-for-visual-studio-2019-x.html
+
+if(MSVC)
+  add_c_flag("/Os")
+endif()
+
 set(INC
   include
 )



More information about the Bf-blender-cvs mailing list