[Qt-interest] Using qmake to create Visual Studio projects with different 32 and 64 bit properties

Adam Light aclight at gmail.com
Thu Jan 13 01:42:44 CET 2011


I have the following bit of code in my Qt based project's .pro file:

win32: {
	win32:contains(QMAKE_HOST.arch, x86_64): {
		# 64 bit build:
		QMAKE_LIBDIR += $$quote($$PWD/ALibrary/win64)
		LIBS += -lALibrary64
	}
	else {
		#32 bit build.
		QMAKE_LIBDIR += $$quote($$PWD/ALibrary/win32)
		LIBS += -lALibrary
	}
}

I have two separate builds of qt on my machine, one 32 bit and one 64 bit.

If I compile my project using Qt creator, everything builds correctly
when I use both the 32 and 64 bit builds of qmake.

I am using the latest version of the visual studio addin in with
Visual Studio 2008. If I set the default Qt version to be a 32 bit
version and import my .pro file, and then change the project's Qt
version to a 64 bit build, the VS addin creates a x64 platform
configuration of my project, however it does not do so using the 64
bit version of qmake, so in my project's settings the library used for
both the 32 and 64 bit configurations is the 32 bit version of the
library.

If instead I start out with no project, set the default Qt version to
the 64 bit version, and import the project, both 32 and 64 bit
platform configurations of the project are created, but in both cases
the 64 bit version of my library is used.

I can't figure out a way to be able to import the project once and
have the 32 and 64 bit platforms of the project build correctly. The
only workaround I can come up with is to create two entirely separate
projects (or solutions), one for 32 bit builds and one for 64 bit
builds. This is pretty cumbersome since we're developing on both the
Macintosh and Windows using Creator, Xcode, and Visual Studio. The
.pro version of the project is the canonical version of the project,
and when that changes we re-create the Xcode and Visual Studio
versions of the project using qmake.

Has anyone gotten something like this to work for their own projects?
Maybe there's a special qmake flag that I can use for this?

Thanks for any help
Adam Light



More information about the Qt-interest-old mailing list