Windows: Added compiler flags to improve incremental link times.

This commit provides roughly a 20% reduction in link time on Windows.

The `/Zc:inline` flag tells the compiler to generate object files
but exclude symbols that are either unreferenced or have internal
linkage only.  This leads to smaller object files and faster linking.
See: https://msdn.microsoft.com/en-us/library/dn642448.aspx

The `/debug:FASTLINK` flag changes how the linker generates
program database files (PDB).  Instead of making a full copy of any
related debug information used by the library, this option instead
creates indexes to other PDBs, thereby cutting down on link-time
code generation.  This only affects DEBUG builds.
See: https://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx

Review: https://reviews.apache.org/r/58013/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b14375c8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b14375c8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b14375c8

Branch: refs/heads/master
Commit: b14375c86675b2ff17d4ecb51ef5b91b04289267
Parents: 7de8684
Author: Jeff Coffler <[email protected]>
Authored: Wed Mar 29 11:07:00 2017 -0700
Committer: Joseph Wu <[email protected]>
Committed: Wed Mar 29 13:38:21 2017 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b14375c8/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 5936be0..39aea28 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -54,6 +54,11 @@ if (WIN32)
         echo "ERROR: Environment variable 'PreferredToolArchitecture' must be 
set to 'x64', see MESOS-6720 for details" 1>&2 && EXIT 1
       )
     )
+
+  # Speed up incremental linking for the VS compiler/linker, for more info, 
see:
+  # 
https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-up-the-incremental-developer-build-scenario/
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /debug:FASTLINK")
 endif (WIN32)
 
 

Reply via email to