[Yhc] VC(++) environment variables (vcvars32.bat, Issue 49)

Andrew Wilkinson andrewjwilkinson at gmail.com
Mon Jan 8 05:08:26 EST 2007


Hi,

On 1/7/07, Peter Tanski <p.tanski at gmail.com> wrote:
>
> I looked at Issue 49, on setting the correct environment variables
> for a Visual Studio (Visual C++) toolset using vcvars32.bat or
> whatever the correct batch file is (see below).  This shouldn't be
> too hard to do but I don't know which SCons files I should modify for
> this.  If any of you have extra time, would you please point me in
> the right direction?


build/platform.py is definitely the best place to do it as the function
win32 is only called for Windows builds. It's slightly complicated by the
attempts I made a getting Yhc to build under GHC on Windows, but never got
to work. Getting the right environment variables is probably complicated
enough to warrant a new file with a function called from build/platform.py,
but it could be included in the same function.

The basic strategy I want to try is this:
>
> 1. find the correct Visual Studio build by querying the system and
> finding the %VSnnCOMNTOOLS% installation.  In DOS, this would be as
> simple as:
>
> C:\> set | find "COMNTOOLS"
> VS80COMNTOOLS=C:\....


The dictionary os.environ is probably what you're looking for.

2. find the correct vcvars32.bat or vsvars32.bat (possibly by
> searching the Start Menu for the Visual Studio [version] Command
> Prompt) and examining the shortcut.  There are only two "Start Menu"
> systems to check, the current User and "All Users."  There is a
> program, 'getlnk' from Bamboo Software <http://www.inwa.net/~frog/
> bamboo.htm> to query the .lnk file in case there isn't a Windows
> program.  (Note: easiest solution is to query the settings in the
> Registry, under \Software\Microsoft\VisualStudio\[version]\External
> Tools, I believe. I haven't explored this thoroughly and expect there
> is some cool Python or scons function for that purpose.)


 http://sourceforge.net/projects/pywin32/ will let you query the registry.
I'm not sure if it is included in the main Python windows installer, but it
is definitely include in ActiveState's ActivePython.

3. run the batch file and query the environment variables


Is the batch file simple enough to use regular expressions to extract the
values? That might be easier?

4. propagate the variables into scons ENV
>
> ... after this, if Yhc ever needs the Visual Studio tools again, it
> might be able to perform the same process after (or during)
> installation.
>
>
This is as simple as
        env["CC"] = "path to compiler"

Hope this helps,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/yhc/attachments/20070108/bc87e193/attachment.htm


More information about the Yhc mailing list