@@ -79,14 +79,29 @@ def test_cpp17_modern_msvc_workaround(tmp_path):
79
79
add_env = {'CIBW_ENVIRONMENT' : 'STANDARD=17' ,
80
80
'DISTUTILS_USE_SDK' : '1' , 'MSSdk' : '1' }
81
81
82
- # Use existing setuptools code to run Visual Studio's vcvarsall.bat
83
- import setuptools .msvc
82
+ # Use existing setuptools code to run Visual Studio's vcvarsall.bat and get the
83
+ # necessary environment variables, since running vcvarsall.bat in a subprocess
84
+ # does not keep the relevant environment variables
85
+ # In normal CI setup: run vcvarsall.bat before running cibuildwheel
86
+ import setuptools
87
+
88
+ # Different environment variables for 32-bit/64-bit targets
89
+ # First, 32-bit (or x86)
84
90
vcvarsall_env = setuptools .msvc .msvc14_get_vc_env ('x86' )
91
+ add_env_x86 = add_env .copy ()
92
+ add_env_x86 ['CIBW_BUILD' ] = '*-win32'
85
93
for vc_var in ['path' , 'include' , 'lib' ]:
86
- if vc_var in vcvarsall_env :
87
- add_env [vc_var ] = vcvarsall_env [vc_var ]
94
+ add_env_x86 [vc_var ] = vcvarsall_env [vc_var ]
95
+ actual_wheels = utils .cibuildwheel_run (project_dir , add_env = add_env_x86 )
96
+
97
+ # Then, 64-bit (or x64)
98
+ vcvarsall_env = setuptools .msvc .msvc14_get_vc_env ('x64' )
99
+ add_env_x64 = add_env .copy ()
100
+ add_env_x64 ['CIBW_BUILD' ] = '*-win_amd64'
101
+ for vc_var in ['path' , 'include' , 'lib' ]:
102
+ add_env_x64 [vc_var ] = vcvarsall_env [vc_var ]
103
+ actual_wheels += utils .cibuildwheel_run (project_dir , add_env = add_env_x64 )
88
104
89
- actual_wheels = utils .cibuildwheel_run (project_dir , add_env = add_env )
90
105
expected_wheels = utils .expected_wheels ('spam' , '0.1.0' )
91
106
92
107
assert set (actual_wheels ) == set (expected_wheels )
0 commit comments