[Scons-users] 'MSVS' Environment variable contents

Kenny, Jason L jason.l.kenny at intel.com
Wed Feb 18 11:55:27 EST 2015


HI guys.. there is logic to get the sdk path.

Below is the code used in Parts for this in our tool overrides

The main think to notice is that if you look at the vcvars.bat file for VS it has a reg call to get the location of the SDK to use.  The code below basically does that same.

Hope this helps!
Jason


def get_current_sdk():
    ''' get SDK path based on reg key used for vc 9.0 and 10'''
    # note this key is used for both 32-bit and 64-bit systems
    # this mean the that default path will always be program file/xxx
    # even on 64-bit systems
    key='SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder'
    dir=''
    try:
        dir=SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)[0]
        debug('Found SDK dir in registry: %s' % dir)
    except WindowsError, e:
        debug('Did not find SDK dir key %s in registry' % \
              (key))
    return dir

def get_current_sdk11():
    ''' get SDK path based on reg key used for vc 11'''
    # note this key is used for both 32-bit and 64-bit systems
    # this mean the that default path will always be program file/xxx
    # even on 64-bit systems
    key='SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0\CurrentInstallFolder'
    dir=''
    try:
        dir=SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)[0]
        debug('Found SDK dir in registry: %s' % dir)
    except WindowsError, e:
        debug('Did not find SDK dir key %s in registry' % \
              (key))
    return dir


From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Andrew C. Morrow
Sent: Tuesday, February 17, 2015 8:14 PM
To: Dirk Bächle; SCons users mailing list
Subject: Re: [Scons-users] 'MSVS' Environment variable contents


Thanks Dirk -

I will give it a look. I had avoided reaching into the internal Tool methods as I assumed that those were not really part of the public SCons API and could change across SCons releases.

I think we may have just ultimately hard-coded the SDK path, since in this particular case we definitely know the install path of the SDK on the CI system, and don't need this information in builds made elsewhere. Not exactly elegant, but it seems like a reasonable compromise.

It might be nice to have this information exposed in a documented and stable way though.

Thanks,
Andrew

On Fri, Feb 13, 2015 at 5:06 PM, Dirk Bächle <tshortik at gmx.de<mailto:tshortik at gmx.de>> wrote:
On 13.02.2015 04:24, Andrew C. Morrow wrote:

[...]

Unfortunately, not really. I actually need to know the path because I want to access a file (that is neither a library nor a header)
that is bundled with the SDK. I simply want to copy that file somewhere else, but I'd prefer to just re-use the detection that SCons
performs to locate the SDK. The PLATFORMSDKDIR would have been perfect, but it seems it is not really an option.

Have another look at "sdk.py" in Tool.MSCommon. The method get_default_sdk() should return the version/ID for the default SDK, and you could use that as key into Tool.MSCommon.InstalledSDKMap ... or pick some of the other provided methods/dicts.


Dirk

_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150218/c254694d/attachment.html>


More information about the Scons-users mailing list