Using qmake to build both 32 and 64 in the same source tree, for Visual Studio

621 views Asked by At

I'm trying to add a project that must build as a 32bit library (let's call it sdk32) in a source tree that is configured for Visual Studio 2010 64 bit. I.e. every project is a 64 bit library or application, but I need this sdk32 project as a 32bit wrapper for an SDK. I'm aware that in Linux one can use the -m32 flag to the compiler (as explained here Using QMAKE to build a both 32 and 64 bits versions of project); but is it possible to have a similar solution, so that in a console configured for VS2010 64bit (with its vcvarsall.bat x64 called), after running qmake -r for my tree I get every project configured for x64 but sdk32 will be configured for Win32? It should also work for qmake -r -tp vc

So far the only solution I can think of is a dirty trick, invoking a script (as explained here: Qt: Run a script BEFORE make) that would "understand" the x64 tags in the vcxproj and Makefiles and replace them with Win32, but this solution seems fragile to me, and too dependent on how the project looks like right now, which would prevent changes to the configuration in a comfortable way in the future. I am sure this has happened before, but I couldn't find a solution after googling this for almost a day. Any suggestions?

PS: the "sdk32" project doesn't need QT at all. The issue is that we use qmake as the Makefile and .vcxproj files creation step (because many other projects do use Qt).

0

There are 0 answers