Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, January 2008
Re: Own compilers and Qt Visual Studio integration


Message 1 in thread

Hi Matthias,

Which Qt version is this? VS support for custom compilers was added in 4.3.

If you are using 4.3 or later, it's hard to say why it fails. Two things I 
would do in this is to add "pyidl.depends = ${QMAKE_FILE_IN}" and change the 
output to be ${OBJECTS_DIR}/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}. I 
usually also add the custom compiler binary to the depends list.

You should check the generated vcproj file with this (I find it easier 
checking the XML code than finding it in the project settings dialog). It 
must have the custom build step for the idl compiler and the compile step on 
the generated c++ file.

Bo.

On torsdag den 27. December 2007, Mathias Waack wrote:
> Hi all,
>
> I've integrated a small python script which generates c++ code from a
> header file into our build chain:
>
> pyidl.output = $$OBJECTS_DIR/${QMAKE_FILE_IN}.cpp
> pyidl.input = PYIDL
> pyidl.commands = $$QMAKE_PYIDL ${QMAKE_FILE_IN} $$OBJECTS_DIR
> pyidl.variable_out = SOURCES
> pyidl.name = ./idl.py
> QMAKE_EXTRA_COMPILERS += pyidl
>
> PYIDL +=   <here comes the header file>
>
> It works nice under Linux using qmake/make for build. Now I've imported
> the .pro file into Visual Studio 2005 using the Qt Visual Studio
> integration. Everyting works except the generation of sources from the
> above script. VS complains:
>
> c1xx : fatal error C1083: Cannot open source file: '.\obj\<generated c++
> file>': No such file or directory
>
> which is definitively right - the file was not created. Is there a way to
> make it workable in VS too?
>
> BTW: using the command line and qmake/nmake in Windows works, so this is
> only a minor drawback, but it would be nice to get it working...
>
> Mathias
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/



-- 
 [ signature omitted ] 

Message 2 in thread

Hi Bo, 

On Wednesday 02 January 2008, Bo Thorsen wrote:
> Which Qt version is this? VS support for custom compilers was added in 4.3.

4.3.3

> If you are using 4.3 or later, it's hard to say why it fails. Two things I
> would do in this is to add "pyidl.depends = ${QMAKE_FILE_IN}" and change
> the output to be ${OBJECTS_DIR}/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}. 

I can't say I understand the output line, but it works. Thank you!

> I 
> usually also add the custom compiler binary to the depends list.

Sounds reasonable, good advice!

Best regards

	Mathias

--
 [ signature omitted ] 

Message 3 in thread

On onsdag den 2. Januar 2008, Mathias Waack wrote:
> Hi Bo,
>
> On Wednesday 02 January 2008, Bo Thorsen wrote:
> > Which Qt version is this? VS support for custom compilers was added in
> > 4.3.
>
> 4.3.3
>
> > If you are using 4.3 or later, it's hard to say why it fails. Two things
> > I would do in this is to add "pyidl.depends = ${QMAKE_FILE_IN}" and
> > change the output to be
> > ${OBJECTS_DIR}/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}.
>
> I can't say I understand the output line, but it works. Thank you!

Hmm, looks like there's a 

${OBJECTS_DIR} is obvious.
${QMAKE_FILE_BASE} is the filename without the extension (f, not f.h)
$${first(QMAKE_EXT_H)} takes the first of the extensions qmake knows as header 
files - this is usually .h. The idea here is that if you use .hpp in your 
company, you can add this in front of the list, and the generated file will 
follow your company style.

I actually make a separate target dir macro so the user can put them wherever 
he might wish. Like this from our QRPC package:

isEmpty(QRPC_DIR):QRPC_DIR = .
isEmpty(QRPC_SOURCES_DIR):QRPC_SOURCES_DIR = $$QRPC_DIR
isEmpty(QRPC_HEADERS_DIR):QRPC_HEADERS_DIR = $$QRPC_DIR
!equals(QRPC_HEADERS_DIR, ".") {
  INCLUDEPATH += $$QRPC_HEADERS_DIR
  DEPENDPATH += $$QRPC_HEADERS_DIR
}

In this particular case, I would use ${QRPC_SOURCES_DIR} as the output 
directory for cpp files and ${QRPC_HEADERS_DIR for headers.

Bo.

-- 
 [ signature omitted ]