@@ -59,3 +59,32 @@ def test_cpp17():
59
59
and 'pp36-pypy36_pp73-win32' not in w ]
60
60
61
61
assert set (actual_wheels ) == set (expected_wheels )
62
+
63
+
64
+ def test_cpp17_modern_msvc_workaround (tmp_path ):
65
+ # This test checks the workaround for modern C++ versions, using a modern compiler
66
+
67
+ if utils .platform != 'windows' :
68
+ pytest .skip ('the test is only relevant to the Windows build' )
69
+
70
+ if os .environ .get ('APPVEYOR_BUILD_WORKER_IMAGE' , '' ) == 'Visual Studio 2015' :
71
+ pytest .skip ('Visual Studio 2015 does not support C++17' )
72
+
73
+ # VC++ for Python 2.7 and MSVC 10 do not support modern standards
74
+ # This is a workaround which forces distutils/setupstools to a newer version
75
+ # Wheels compiled need a more modern C++ redistributable installed, which is not
76
+ # included with Python: see documentation for more info
77
+ # DISTUTILS_USE_SDK and MSSdk=1 tell distutils/setuptools that we are adding
78
+ # MSVC's compiler, tools, and libraries to PATH ourselves
79
+ add_env = {'CIBW_ENVIRONMENT' : 'STANDARD=17' ,
80
+ 'DISTUTILS_USE_SDK' : 1 , 'MSSdk' : 1 }
81
+
82
+ # Use existing distutils code to run Visual Studio's vcvarsall.bat
83
+ import distutils .msvc9compiler
84
+ vcvarsall_env = distutils .msvc9compiler .query_vcvarsall (14 )
85
+ add_env .update (vcvarsall_env )
86
+
87
+ actual_wheels = utils .cibuildwheel_run (project_dir , add_env = add_env )
88
+ expected_wheels = utils .expected_wheels ('spam' , '0.1.0' )
89
+
90
+ assert set (actual_wheels ) == set (expected_wheels )
0 commit comments