From 5cef52cbd9fb36dc918518fe3fa676c0a0e5c25f Mon Sep 17 00:00:00 2001 From: Adam Yoblick Date: Wed, 17 Apr 2024 16:26:21 -0500 Subject: [PATCH] revert changes to batch file, since it runs as a PR check --- .../windows/compile_windows.bat | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat index 674da647..0626d1b0 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat +++ b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat @@ -1,16 +1,16 @@ -:: This needs to be run from a Visual Studio Developer Command Prompt -:: You must also have the "Desktop Development with C++" workload installed +:: This script compiles the attach and inject DLLs for x86 and x64 architectures. +:: It runs as part of the PR checks in the debugpy repo, AND the artifacts are uploaded to github, +:: so you don't have to run it locally. setlocal @cd /d %~dp0 -@IF NOT EXIST "%VSINSTALLDIR%VC\Auxiliary\Build\vcvarsall.bat" ( - echo "Please install Visual Studio 2017 or later with the 'Desktop Development with C++' workload" - exit /b 1 -) - -:: Build x86 binaries -call "%VSINSTALLDIR%VC\Auxiliary\Build\vcvarsall.bat" x86 -vcvars_spectre_libs=spectre +@set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe +@echo Using vswhere at %VSWHERE% +@for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VSDIR=%%i +@echo Using Visual C++ at %VSDIR% + +call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86 -vcvars_spectre_libs=spectre cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_x86.dll copy attach_x86.dll ..\attach_x86.dll /Y @@ -20,12 +20,11 @@ cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_32 /Qspectre run_code_ copy run_code_on_dllmain_x86.dll ..\run_code_on_dllmain_x86.dll /Y copy run_code_on_dllmain_x86.pdb ..\run_code_on_dllmain_x86.pdb /Y -cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /PROFILE /GUARD:CF /out:inject_dll_x86.exe +cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_x86.exe copy inject_dll_x86.exe ..\inject_dll_x86.exe /Y copy inject_dll_x86.pdb ..\inject_dll_x86.pdb /Y -:: Build x64 binaries -call "%VSINSTALLDIR%VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -vcvars_spectre_libs=spectre +call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -vcvars_spectre_libs=spectre cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_amd64.dll copy attach_amd64.dll ..\attach_amd64.dll /Y @@ -35,7 +34,7 @@ cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_64 /Qspectre run_code_ copy run_code_on_dllmain_amd64.dll ..\run_code_on_dllmain_amd64.dll /Y copy run_code_on_dllmain_amd64.pdb ..\run_code_on_dllmain_amd64.pdb /Y -cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /PROFILE /GUARD:CF /out:inject_dll_amd64.exe +cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_amd64.exe copy inject_dll_amd64.exe ..\inject_dll_amd64.exe /Y copy inject_dll_amd64.pdb ..\inject_dll_amd64.pdb /Y