build.d: Get path to vswhere#8596
build.d: Get path to vswhere#8596dlang-bot merged 3 commits intodlang:masterfrom JinShil:build_win_vswhere
Conversation
|
Thanks for your pull request, @JinShil! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8596" |
src/build.d
Outdated
| continue; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Better wrap this in a function as we can reuse it for a cross-platform download of the bootstrap compiler too, then.
There was a problem hiding this comment.
Done. I didn't change the existing bootstrap compiler download to avoid introducing issues. I can always do that as a followup.
src/build.d
Outdated
| // Check if vswhere.exe is in the standard location | ||
| auto standardPath = ["cmd", "/C", "echo", `%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe`].execute.output; | ||
| standardPath = standardPath.replace(`"`, ""); // Remove quotes surrounding the path | ||
| standardPath = standardPath.replace("\r\n", ""); // Remove trailing newline characters |
There was a problem hiding this comment.
If the functions are chained standardPath could be made const.
src/build.d
Outdated
| return outputPath; | ||
|
|
||
| // Could not find or obtain vswhere.exe | ||
| throw new Exception("Could not obtain vswhere.exe. Consider downloading it from https://github.com/Microsoft/vswhere and placing it in your PATH"); |
There was a problem hiding this comment.
There's an extra space before Consider.
This gets the path to vswhere: https://github.com/Microsoft/vswhere
vswhere is a single executable for locating Visual Studio installations and components. It's installed automatically by Visual Studio 2017 v15.2+ to a standard location at
%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe. It is also downloadable from the GitHub repository linked above.I intend to use it at
dmd/src/vcbuild/msvc-dmc.d
Lines 17 to 21 in 3d289d3
dmd/src/vcbuild/msvc-lib.d
Lines 14 to 16 in 3d289d3
\Program Fileswithout a drive letter. Anyway, that code doesn't even work on my computer, so I can't get a build. I thinkvswherewill be a better solution for locatingcl.exeandlib.exe.msvc-dmc and msvc_lib will check the environment variable
HOST_VSWHEREand execute it to locatecl.exeandlib.exe. build.d is responsible for settingHOST_VSWHERE, and that's what this PR does.cc @rainers for your expertise