File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1356,6 +1356,38 @@ def doConfigure(myenv):
13561356 print ( 'Failed to enable sanitizer with flag: ' + sanitizer_option )
13571357 Exit (1 )
13581358
1359+ # When using msvc, check for VS 2013 Update 2+ so we can use new compiler flags
1360+ if using_msvc ():
1361+ haveVS2013Update2OrLater = False
1362+ def CheckVS2013Update2 (context ):
1363+ test_body = """
1364+ #if _MSC_VER < 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER < 180030501)
1365+ #error Old Version
1366+ #endif
1367+ int main(int argc, char* argv[]) {
1368+ return 0;
1369+ }
1370+ """
1371+ context .Message ('Checking for VS 2013 Update 2 or Later... ' )
1372+ ret = context .TryCompile (textwrap .dedent (test_body ), ".cpp" )
1373+ context .Result (ret )
1374+ return ret
1375+ conf = Configure (myenv , help = False , custom_tests = {
1376+ 'CheckVS2013Update2' : CheckVS2013Update2 ,
1377+ })
1378+ haveVS2013Update2OrLater = conf .CheckVS2013Update2 ()
1379+ conf .Finish ()
1380+
1381+ if haveVS2013Update2OrLater and optBuild :
1382+ # http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
1383+ #
1384+ myenv .Append ( CCFLAGS = ["/Gw" , "/Gy" ] )
1385+ myenv .Append ( LINKFLAGS = ["/OPT:REF" ])
1386+
1387+ # http://blogs.msdn.com/b/vcblog/archive/2014/03/25/linker-enhancements-in-visual-studio-2013-update-2-ctp2.aspx
1388+ #
1389+ myenv .Append ( CCFLAGS = ["/Zc:inline" ])
1390+
13591391 # Apply any link time optimization settings as selected by the 'lto' option.
13601392 if has_option ('lto' ):
13611393 if using_msvc ():
You can’t perform that action at this time.
0 commit comments