digitalmars.D.learn - MSVC path on windows
- Jeremy DeHaan (10/10) Jan 12 2017 I'm trying to automate a build process for a project of mine, and
- Ryan (13/15) Jan 12 2017 I have both VS2013 and VS2015 installed. I have to use a project
I'm trying to automate a build process for a project of mine, and I want to get the path to the MSVC toolchain DMD is using. I don't want to hard code any paths that may not work on some people's set-ups. I know there are some environmental variables such as VS140COMNTOOLS, VS120COMNTOOLS, etc. Are these reliable to get the location for some MSVC toolchain? I've also thought of parsing the PATH to figure out where dmd is installed and extract the info from the sc.ini file. Am I being ridiculous?
Jan 12 2017
On Friday, 13 January 2017 at 03:21:52 UTC, Jeremy DeHaan wrote:I've also thought of parsing the PATH to figure out where dmd is installed and extract the info from the sc.ini file.I have both VS2013 and VS2015 installed. I have to use a project specific sc.ini file to match each project to the VS compiler/linker that was used to generate the C libraries it depends on. The point is, people may have several versions of MSVC installed, so I think parsing the sc.ini file would be the safest way to go, because it will tell you the linker DMD will ultimately use. The other variables will just tell you what is installed. Also, depending on the shell you use, those environment variables may not be reliably set. Which is why Microsoft provides a few shortcuts for the different toolchain's (e.g.32 vs 64 bit) terminals.
Jan 12 2017