diff --git a/test/10_cpp_standards/cibuildwheel_test.py b/test/10_cpp_standards/cibuildwheel_test.py index acebf73a..7036a38a 100644 --- a/test/10_cpp_standards/cibuildwheel_test.py +++ b/test/10_cpp_standards/cibuildwheel_test.py @@ -79,14 +79,29 @@ def test_cpp17_modern_msvc_workaround(tmp_path): add_env = {'CIBW_ENVIRONMENT': 'STANDARD=17', 'DISTUTILS_USE_SDK': '1', 'MSSdk': '1'} - # Use existing setuptools code to run Visual Studio's vcvarsall.bat - import setuptools.msvc + # Use existing setuptools code to run Visual Studio's vcvarsall.bat and get the + # necessary environment variables, since running vcvarsall.bat in a subprocess + # does not keep the relevant environment variables + # In normal CI setup: run vcvarsall.bat before running cibuildwheel + import setuptools + + # Different environment variables for 32-bit/64-bit targets + # First, 32-bit (or x86) vcvarsall_env = setuptools.msvc.msvc14_get_vc_env('x86') + add_env_x86 = add_env.copy() + add_env_x86['CIBW_BUILD'] = '*-win32' for vc_var in ['path', 'include', 'lib']: - if vc_var in vcvarsall_env: - add_env[vc_var] = vcvarsall_env[vc_var] + add_env_x86[vc_var] = vcvarsall_env[vc_var] + actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env_x86) + + # Then, 64-bit (or x64) + vcvarsall_env = setuptools.msvc.msvc14_get_vc_env('x64') + add_env_x64 = add_env.copy() + add_env_x64['CIBW_BUILD'] = '*-win_amd64' + for vc_var in ['path', 'include', 'lib']: + add_env_x64[vc_var] = vcvarsall_env[vc_var] + actual_wheels += utils.cibuildwheel_run(project_dir, add_env=add_env_x64) - actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) expected_wheels = utils.expected_wheels('spam', '0.1.0') assert set(actual_wheels) == set(expected_wheels)