Commit 8073f4b1 authored by Davis King's avatar Davis King

Make visual studio build with all cores when building dlib.

parent aba6e363
...@@ -770,8 +770,10 @@ if (NOT TARGET dlib) ...@@ -770,8 +770,10 @@ if (NOT TARGET dlib)
enable_cpp11_for_target(dlib) enable_cpp11_for_target(dlib)
if((MSVC AND CMAKE_VERSION VERSION_LESS 3.11) OR CMAKE_VERSION VERSION_LESS 3.3) if((MSVC AND CMAKE_VERSION VERSION_LESS 3.11) OR CMAKE_VERSION VERSION_LESS 3.3)
target_compile_options(dlib PUBLIC ${active_compile_opts}) target_compile_options(dlib PUBLIC ${active_compile_opts})
target_compile_options(dlib PRIVATE ${active_compile_opts_private})
else() else()
target_compile_options(dlib PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${active_compile_opts}>) target_compile_options(dlib PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${active_compile_opts}>)
target_compile_options(dlib PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${active_compile_opts_private}>)
endif() endif()
# Install the library # Install the library
......
...@@ -122,6 +122,11 @@ if (MSVC) ...@@ -122,6 +122,11 @@ if (MSVC)
# that will not be readable by VS 2005. # that will not be readable by VS 2005.
list(APPEND active_compile_opts "/bigobj") list(APPEND active_compile_opts "/bigobj")
# Build dlib with all cores. Don't propagate the setting to client programs
# though since they might compile large translation units that use too much
# RAM.
list(APPEND active_compile_opts_private "/MP")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3)
# Clang can compile all Dlib's code at Windows platform. Tested with Clang 5 # Clang can compile all Dlib's code at Windows platform. Tested with Clang 5
list(APPEND active_compile_opts "-Xclang -fcxx-exceptions") list(APPEND active_compile_opts "-Xclang -fcxx-exceptions")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment