aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/scripts/windows/ArchSetup.cmake10
-rw-r--r--cmake/scripts/windows/CFlagOverrides.cmake7
-rw-r--r--cmake/scripts/windows/CXXFlagOverrides.cmake7
-rw-r--r--cmake/scripts/windowsstore/ArchSetup.cmake7
-rw-r--r--cmake/scripts/windowsstore/CFlagOverrides.cmake7
-rw-r--r--cmake/scripts/windowsstore/CXXFlagOverrides.cmake7
6 files changed, 38 insertions, 7 deletions
diff --git a/cmake/scripts/windows/ArchSetup.cmake b/cmake/scripts/windows/ArchSetup.cmake
index 49a0f38a29..f0f8a085b5 100644
--- a/cmake/scripts/windows/ArchSetup.cmake
+++ b/cmake/scripts/windows/ArchSetup.cmake
@@ -62,9 +62,15 @@ set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_M
# Additional SYSTEM_DEFINES
list(APPEND SYSTEM_DEFINES -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB)
-# Make sure /FS is set for Visual Studio in order to prevent simultaneous access to pdb files.
+# The /MP option enables /FS by default.
if(CMAKE_GENERATOR MATCHES "Visual Studio")
- set(CMAKE_CXX_FLAGS "/permissive- /MP /FS ${CMAKE_CXX_FLAGS}")
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+
+ set(CMAKE_CXX_FLAGS "/permissive- ${MP_FLAG} ${CMAKE_CXX_FLAGS}")
endif()
# Google Test needs to use shared version of runtime libraries
diff --git a/cmake/scripts/windows/CFlagOverrides.cmake b/cmake/scripts/windows/CFlagOverrides.cmake
index 1c796fda25..cd966899e1 100644
--- a/cmake/scripts/windows/CFlagOverrides.cmake
+++ b/cmake/scripts/windows/CFlagOverrides.cmake
@@ -1,5 +1,10 @@
if(MSVC)
- set(CMAKE_C_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR /MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+ set(CMAKE_C_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
set(CMAKE_C_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
endif()
diff --git a/cmake/scripts/windows/CXXFlagOverrides.cmake b/cmake/scripts/windows/CXXFlagOverrides.cmake
index 44ae602bfe..72df9de168 100644
--- a/cmake/scripts/windows/CXXFlagOverrides.cmake
+++ b/cmake/scripts/windows/CXXFlagOverrides.cmake
@@ -1,5 +1,10 @@
if(MSVC)
- set(CMAKE_CXX_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR /MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+ set(CMAKE_CXX_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
endif()
diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake
index a4e30a5ce4..f71ca7a32f 100644
--- a/cmake/scripts/windowsstore/ArchSetup.cmake
+++ b/cmake/scripts/windowsstore/ArchSetup.cmake
@@ -86,7 +86,12 @@ set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_M
list(APPEND SYSTEM_DEFINES -DHAS_WIN10_NETWORK)
# The /MP option enables /FS by default.
-set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS} /EHsc /await /permissive-")
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+set(CMAKE_CXX_FLAGS "${MP_FLAG} ${CMAKE_CXX_FLAGS} /EHsc /await /permissive-")
# Google Test needs to use shared version of runtime libraries
set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
diff --git a/cmake/scripts/windowsstore/CFlagOverrides.cmake b/cmake/scripts/windowsstore/CFlagOverrides.cmake
index 0cd1c4d74a..ab2f59cc23 100644
--- a/cmake/scripts/windowsstore/CFlagOverrides.cmake
+++ b/cmake/scripts/windowsstore/CFlagOverrides.cmake
@@ -1,5 +1,10 @@
# compiler flags
-string(APPEND CMAKE_C_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /Zi /DTARGET_WINDOWS")
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+string(APPEND CMAKE_C_FLAGS_INIT " /D_UNICODE /DUNICODE ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /Zi /DTARGET_WINDOWS")
string(APPEND CMAKE_C_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
diff --git a/cmake/scripts/windowsstore/CXXFlagOverrides.cmake b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
index 2219af4bd0..4ae3ac3cb0 100644
--- a/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
+++ b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
@@ -1,5 +1,10 @@
# compiler flags
-string(APPEND CMAKE_CXX_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /DTARGET_WINDOWS")
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+string(APPEND CMAKE_CXX_FLAGS_INIT " /D_UNICODE /DUNICODE ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /DTARGET_WINDOWS")
string(APPEND CMAKE_CXX_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")