Skip to content
Snippets Groups Projects
Commit f983d955 authored by Yuri Kunde Schlesner's avatar Yuri Kunde Schlesner
Browse files

CMake: Enable VS parallel builds for a good reduction in compile times

This enables the /MP compiler flag, which parallelizes builds of by
distributing compilation of individual object files across workes
processes, instead of being limited to per-project parallelism.

Reduces the time for a full compile from 72 s to 45 s on my machine.
parent d46f6500
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ else() ...@@ -17,6 +17,7 @@ else()
# As far as I can tell, there's no way to override the CMake defaults while leaving user # As far as I can tell, there's no way to override the CMake defaults while leaving user
# changes intact, so we'll just clobber everything and say sorry. # changes intact, so we'll just clobber everything and say sorry.
message(STATUS "Cache compiler flags ignored, please edit CMakeFiles.txt to change the flags.") message(STATUS "Cache compiler flags ignored, please edit CMakeFiles.txt to change the flags.")
# /MP - Multi-threaded compilation
# /MD - Multi-threaded runtime # /MD - Multi-threaded runtime
# /Ox - Full optimization # /Ox - Full optimization
# /Oi - Use intrinsic functions # /Oi - Use intrinsic functions
...@@ -24,7 +25,7 @@ else() ...@@ -24,7 +25,7 @@ else()
# /GR- - Disable RTTI # /GR- - Disable RTTI
# /GS- - No stack buffer overflow checks # /GS- - No stack buffer overflow checks
# /EHsc - C++-only exception handling semantics # /EHsc - C++-only exception handling semantics
set(optimization_flags "/MD /Ox /Oi /Oy- /DNDEBUG /GR- /GS- /EHsc") set(optimization_flags "/MP /MD /Ox /Oi /Oy- /DNDEBUG /GR- /GS- /EHsc")
# /Zi - Output debugging information # /Zi - Output debugging information
# /Zo - enahnced debug info for optimized builds # /Zo - enahnced debug info for optimized builds
set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
......
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