www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - MSVC path on windows

reply Jeremy DeHaan <dehaan.jeremiah gmail.com> writes:
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
parent Ryan <clumsycodemonkey gmail.com> writes:
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