Hacker News new | ask | show | jobs
by dundarious 1091 days ago
Regarding vcvars.bat, I'm still a fan of letting the user set that before calling into the build system. I specifically don't want random projects trying to find random toolchains in random ways. The new toolchain file sounds like a great development in that space.

Without CMake, from powershell, you can do something like `& "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -VsInstallationPath:"C:\Program Files\Microsoft Visual Studio\2022\Community" -Arch:amd64 -HostArch:amd64 -SkipAutomaticLocation` and it works well enough. I usually provide that oneliner as a vs2022ce-x64-x64.ps1 script, and just note in the README that users can adapt it to their system/needs.

Also of note is the amazing portable-msvc.py by the one and only Mārtiņš Možeiko : https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cd...

It downloads the compiler toolchain and nothing more, and writes a setup.bat with no conditional logic. It was trivial for me to adapt to write a setup.ps1 also. Compare the size of the result, vs my attempt to have a minimal toolchain using the Visual Studio Installer.

    1.3G    msvc
    4.2G    C:/Program Files/Microsoft Visual Studio/2022/Community
You don't get the debugger, profiler, etc., of course, but I use other tools for that stuff anyway (and they don't require an additional 3G).

I don't recommend projects to use it directly, it's just an excellent resource to point people towards.