views:

492

answers:

4

We are developing a number of games on multiple paltforms (DS/Wii/Xbox 360/PS3/PC/PSP). Each has their own compiler/linker and debugger. We want to use Visual Studio as the IDE and to manage the build process but use the platform specific compilers (and settings) to generate the appropriate output. We could manage the build process outside of VS (using jam or ant say) but this is not the preffered solution.

Trawling the web, this seems to be a common problem but no-one has a good solution. Has anyone solved this problem? What's the best way of handling this.

A number of solutions spring to mind - auto-generate nant scripts from the solition in a pre-build step (probably the least work but still not ideal), replace cl.exe and link.exe with stub apps, use msbuild (but this is geared towards .net development and not native code), write a custom VS plug-in (lots of work - any pointers to an existing one either commercial or open soruce would be good). Anyone tried any of these? Was it good for you? ;)

Cheers

+1  A: 

Have you looked at CMake? It can generate Visual Studio project files from a textual description.

JesperE
AFAICS CMake works the 'wrong way'. We want to manage projects through VS, rather than manage them in some arbitrary build system then generate VS projects. Now if CMake could take a VS solution and build settings that would be another matter ;)
Gwaredd
Hum. I always try to avoid managing projects in Visual Studio, since the support for it is so incredibly lousy.
JesperE
A: 

Seconded the recommendation for CMake, with the caveat that you're not going to be able to manage projects in VS for other platforms. It's just not written to manage library paths, defines, etc etc for anything other than the current project/target/platform. You'll almost certainly need to say "platform X's libraries live here", and I just don't see a way of doing that through VS.

Alastair
+2  A: 

CMake doesn't do what I'm after. To be clear - when I say "manage the build process" I mean, anyone can grab the project from the repository then from within VS select the platform, compile/run, add files, change settings, etc and it all work by magic ;) So to answer my own question, after a bit of digging this is what I've come up with.

The 'correct' way to do this is to write a plug-in for VS that adds a new platform which would appear in the configuration manager (as they did for the Xbox, Pocket PC, etc). Unfortunately it would appear that Microsoft in their infinite wisdom have decided not to expose the API for this particular feature to the great unwashed.

However, you can write an add-in and in parallel replace cl.exe and link.exe with stub programs which dispatch the actual compliation to the appropriate compilers. It appears there's an open source project VSItanium for this (2003 only though and would have to be modified for custom compilers). Also SNSystems do this with their VSI package for the PSP.

It would take some time to write a plug-in so in the meantime a quick stop-gap solution is to write a script that parses the solution and project files and pulls out the important bits and generates files to be included by nant (or make, or jam or whatever) - called from a per-build step. Either that or go down the whole makefile solution route :/

MSBuild really should be the way forward. I had a quick play with it and you can (almost) do everything I want but somehow it jsut didn't quite gel. Kept thinking it was a C# project - maybe need to spend more time wit it, unless any MSBuild gurus want to point me in the right direction.

Gwaredd
i would also like this as well. Editing a text file just seems like a HUGE step back. Our promary dev tool is the MS IDE on win32 but we are porting/building for linux. I want to autogenerate the build file from VS, not from some text file to then build the other two. There's a product idea here I would imagine.
Tim
+1  A: 

Another options which is used on the Homebrew PSP SDK (MinPSPW) is to use Makefile projects. You use the code editor from VS but in the end when you invoke the compiler it will use the correct compiler based on your makefile. Most of the output errors will be catched up by VS and highlighted on your sources.

Paulo Lopes