Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple platform builds 1

Status
Not open for further replies.

PerFnurt

Programmer
Feb 25, 2003
972
SE
Hiya,

Is there any nifty way to have a Visual C++ 2005 project support multiple platforms?

Ie I want to be able to use a different compiler /linker than the built-in ones.

Actually I want to use both: Make a normal VS build, but also be able to perform a totally different build.

One way could be to have a makefile for running that build, but there seems to be no option to extract makefile from a project in VS2005.

Perhaps you have an idea on how to accomplish it?

Thank you.

/Per
[sub]
www.perfnurt.se[/sub]
 
Hello PerFnurt,

I do not know if what you asked is possible inside Visual C++ 2005. A priori I believe you cannot. But I have had the same problem as yours with Visual C++ 6, i.e. I don't want my projects to be stuck to a particular building system.
I get rid of this problem thanks to qmake, a makefile generator for various platforms and building systems.
It can also nicely generate Visual Studio projects. From my personal experience, I develop software under Windows using my preferred set of tools (Qt tools, Emacs NT, Cygwin shell). qmake generates makefiles that can be processed by the Visual C++ command line tools(cl, nmake, link). When I have to do some debug, I perform it under Visual Studio. To do so I have to import the project into VS, I only need to perform this once :
- If it does not exist I generate a VS project by running "qmake -t vcapp my-project.pro" --> my-project.dsp
- Load the generated VS project into a workspace.

qmake is developped by Trolltech and comes with the whole Qt library. It may be possible to install Qt(the open source edition) and remove all but what is needed for qmake to be run.
Or you can use a makefile generator that does the same job as qmake.

If VS C++ 2005 is clearly not able to this job, then I think qmake(or another tool) is the way to go.

--
Globos
 
Thanks for the suggestions.

Thing is, Visual Studio is the preferred central development tool.

Anyway, the automation model in 2005 is quite powerful though and it without too much effort one can make a macro that generates a makefile. So generating makefile from VS 2005 project turned out to be quite easy (though not 100% automatic)



/Per
[sub]
www.perfnurt.se[/sub]
 
Thing is, Visual Studio is the preferred central development tool.

This is not a restriction, as I said you can leave Visual Studio as the central tool but let a qmake-like tool generates when needed the Visual Studio project or a makefile for g++ if you switch to another compiler.

So generating makefile from VS 2005 project turned out to be quite easy.

VS 2005 is surely able to generate makefiles, but I don't think it lets you select a target compiler nor a target OS to generate for. So your problem still remains, i.e. with VS you can create only makefiles FOR VS.

--
Globos
 
VS 2005 is surely able to generate makefiles
Not really. That functionality has been explicitly removed.

We did not optimize IDE features for usage with other compilers in VS2005 :)

So your problem still remains, i.e. with VS you can create only makefiles FOR VS

If I write the macro myself I can generate anything. Actually I probably won't even generate the whole makefile, but rather just a makefile macro stating the .obj targets/dependants and let it include a central makefile having all the rules and whatnot.

Anyway, I appreciate your suggestion and will look into the qmake thingie.



/Per
[sub]
www.perfnurt.se[/sub]
 
If it is multiplatform, you'd be better off using imake. The standard set comes with the macros/options for a range of platforms including lots I haven't heard of. I last used it in 2000 when VS6 was around. It may or may not have been updated for VS2005.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top