views:

961

answers:

4

I am trying to set up an automated build system on Windows using Cygwin. Among other things, it needs to be able to build several Visual C++ solutions. I have a script which sets up the environment variables needed for devenv, and if I type 'devenv' in bash it brings up the Visual Studio IDE. No problems so far.

I am also able to build a solution from cygwin's bash prompt by typing

$ devenv mysolution.sln /build Debug

The problem is that it is not showing me the build output. In fact, it does not even tell me whether or not the build succeeded. The command simply finishes, and I get back the prompt. Then I can go into the output directory, and check whether or not the executable was created, but for a build system I want to be able to grep for errors.

What am I doing wrong? I can see the debug output when I run devenv in the windows shell, but not in cygwin. Where is it being sent, and how do I get it back?

+1  A: 

I found a workaround.

devenv mysolution.sln /build Debug /out mylog.txt

will dump the build output into mylog.txt, which is even more convenient for automated builds. I am still curious why the output doesn't show up on the screen, though.

Dima
+5  A: 

Will cygwin find and run .com files?

There are 2 devenv executables, one is devenv.com which is a console mode application that handles stdin, stdout and stderr proxying for the other executable, devenv.exe, which is a GUI mode application. If devenv.exe is what cygwin is loading then there will be no stdin/stdout stuff. If devenv.com is being loaded, it should launch devenv.exe while proxying the stdout stuff to the console.

Maybe if you explicitly specify that devenv.com should be run?

Michael Burr
That's it! Thanks!
Dima
+1  A: 

Have you considered using MSBuild? You can use msbuild to build VS solutions without any modifications and it spits output out the stdout. The command would look something like:

msbuild mysolution.sln /t:Build /p:"Configuration=Debug" /p:"Platform=Win32"

MSBuild is the tool that MS designed to do automated builds, so it may fit your problem a little better than running the devenv.exe.

heavyd
That will probably not do everything I need. In addition for the VS solutions I have to build projects for an embedded platform, which are not using VS. At this point all I need is to be able to build all configurations and get an email if anything is broken. So it looks like MSBuild is at the same time too powerful and not flexible enough for what I need.
Dima
MSBuild is both extremely powerful and flexible. If it doesn't do it out of the box, there are community tasks such as http://sdctasks.codeplex.com/ and http://msbuildtasks.tigris.org/ which add extra functionality, or you can always write your own task. And even if you don't use it for your entire build process, it is at least useful for the parts that are compiled by MS products.
heavyd
A: 

last I heard, msbuild in vs 2008 couldn't handle c++ projects. I think it can in vs 2010.

Dan Kegel