@@ -85,10 +85,18 @@ o.Add(
8585
8686)
8787
88+ # Windows : Disable permissive mode, making MSVC more standards compliant.
89+ # /D_USE_MATH_DEFINES is needed with permissive mode off for
90+ # common definitions like M_P.
91+ # /Zc:externC- fixes a compilation error with Boost::interprocess
92+ # described here:
93+ # https://developercommunity.visualstudio.com/content/problem/756694/including-windowsh-and-boostinterprocess-headers-l.html
94+ # /DBOOST_ALL_NO_LIB is needed to find Boost when it is built without
95+ # verbose system information added to file and directory names.
8896o .Add (
8997 "CXXFLAGS" ,
9098 "The extra flags to pass to the C++ compiler during compilation." ,
91- [ "-pipe" , "-Wall" , "-Wextra" ] if Environment ()["PLATFORM" ] != "win32" else [],
99+ [ "-pipe" , "-Wall" , "-Wextra" ] if Environment ()["PLATFORM" ] != "win32" else [ "/permissive-" , "/D_USE_MATH_DEFINES" , "/Zc:externC-" , "/DBOOST_ALL_NO_LIB" ],
92100)
93101
94102o .Add (
@@ -1171,7 +1179,6 @@ else:
11711179 "/D_WINDLL" ,
11721180 "/D_MBCS" ,
11731181 "/W4" ,
1174- "/experimental:external" ,
11751182 "/external:W0" ,
11761183 "/Zc:inline" , # Remove unreferenced function or data if it is COMDAT or has internal linkage only
11771184 "/GR" , # enable RTTI
@@ -1196,6 +1203,13 @@ else:
11961203 "/wd4244" , # suppress warning about possible loss of data in type conversion
11971204 "/wd4305" , # suppress warning about conversion from double to float
11981205 "/wd4506" , # suppress warning about no definition for inline function. Needed for USD::Glf
1206+ # NOTE : the following warnings are generated by external dependencies, even when using /external
1207+ # They may be able to be re-enabled after updating to MSVC 2022.
1208+ "/wd4127" , # suppress warning "conditional expression is constant", Needed for USD
1209+ "/wd4456" , # suppress warning "declaration of 'x' hides previous local declaration"
1210+ "/wd4459" , # suppress warning "declaration of 'x' hides global declaration"
1211+ "/wd4201" , # suppress warning "nonstandard extension used : nameless struct/union"
1212+ "/wd4245" , # suppress warning "'initializing': conversion from 'int' to 'size_t', signed / unsigned mismatch
11991213 # suppress warning about exported class deriving from non-exported class.
12001214 # Microsoft states (in https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170)
12011215 # that "C4275 can be ignored if you are deriving from a type in the
@@ -2166,6 +2180,7 @@ if env["WITH_GL"] and doConfigure :
21662180 # while still using -Werror.
21672181 "-Wno-format" if env ["PLATFORM" ] != "win32" else "" ,
21682182 "-Wno-strict-aliasing" if env ["PLATFORM" ] != "win32" else "" ,
2183+ "/wd4701" if env ["PLATFORM" ] == "win32" else "" ,
21692184 systemIncludeArgument , "$GLEW_INCLUDE_PATH" ,
21702185 systemIncludeArgument , "$OIIO_INCLUDE_PATH" ,
21712186 ],
@@ -3031,6 +3046,7 @@ if usdEnv["USD_LIB_PREFIX"] :
30313046usdEnvAppends = {
30323047 "CXXFLAGS" : [
30333048 "-Wno-deprecated" if env ["PLATFORM" ] != "win32" else "" ,
3049+ "/Zc:inline-" if env ["PLATFORM" ] == "win32" else "" ,
30343050 "-DIECoreUSD_EXPORTS" ,
30353051 systemIncludeArgument , "$USD_INCLUDE_PATH" ,
30363052 systemIncludeArgument , "$PYTHON_INCLUDE_PATH" ,
0 commit comments