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

Qt-interest Archive, April 2007
QMAKE Suffix Rules


Message 1 in thread

I have files in the project I am porting to Qt with a non standard
extension.  For that extension I need to run a separate tool to
"compile" them.  I've looked into QMAKE_PRE_LINK and that is too late
(the files generate header files used in the program).

Is there something like QMAKE_PRE_BUILD, that would run before every
build?  Or even better a way to specify suffix rules like I can in
makefiles (.insuffix.outsuffix : ; command)  - that way the file will
only be compiled with it changes.

Thanks,
Robert

--
 [ signature omitted ] 

Message 2 in thread

"Robert Stehwien" <rstehwien@xxxxxxxxx> wrote on 04/05/2007 03:09:03 PM:

# I have files in the project I am porting to Qt with a non standard
# extension.  For that extension I need to run a separate tool to
# "compile" them.  I've looked into QMAKE_PRE_LINK and that is too late
# (the files generate header files used in the program).
#
# Is there something like QMAKE_PRE_BUILD, that would run before every
# build?  Or even better a way to specify suffix rules like I can in
# makefiles (.insuffix.outsuffix : ; command)  - that way the file will
# only be compiled with it changes.

Please refer to http://wiki.qtcentre.org/index.php?title=Undocumented_qmake
for more information on custom compilers than what is in the
Qt documentation.

--
 [ signature omitted ] 

Message 3 in thread

Thanks.  That looks like it will do the trick.  I'll be generating .h
and .cpp files from my file much like the IDL example.  Once I make
the changes (early next week), I'll report anything interesting on the
solution.

--Robert

On 4/5/07, Gordon.Schumacher@xxxxxxxxxxx <Gordon.Schumacher@xxxxxxxxxxx> wrote:
> "Robert Stehwien" <rstehwien@xxxxxxxxx> wrote on 04/05/2007 03:09:03 PM:
>
> # I have files in the project I am porting to Qt with a non standard
> # extension.  For that extension I need to run a separate tool to
> # "compile" them.  I've looked into QMAKE_PRE_LINK and that is too late
> # (the files generate header files used in the program).
> #
> # Is there something like QMAKE_PRE_BUILD, that would run before every
> # build?  Or even better a way to specify suffix rules like I can in
> # makefiles (.insuffix.outsuffix : ; command)  - that way the file will
> # only be compiled with it changes.
>
> Please refer to http://wiki.qtcentre.org/index.php?title=Undocumented_qmake
> for more information on custom compilers than what is in the
> Qt documentation.
>
>

--
 [ signature omitted ] 

Message 4 in thread

On 4/5/07, Gordon.Schumacher@xxxxxxxxxxx <Gordon.Schumacher@xxxxxxxxxxx> wrote:
> "Robert Stehwien" <rstehwien@xxxxxxxxx> wrote on 04/05/2007 03:09:03 PM:
>
> # I have files in the project I am porting to Qt with a non standard
> # extension.  For that extension I need to run a separate tool to
> # "compile" them.  I've looked into QMAKE_PRE_LINK and that is too late
> # (the files generate header files used in the program).
> #
> # Is there something like QMAKE_PRE_BUILD, that would run before every
> # build?  Or even better a way to specify suffix rules like I can in
> # makefiles (.insuffix.outsuffix : ; command)  - that way the file will
> # only be compiled with it changes.
>
> Please refer to http://wiki.qtcentre.org/index.php?title=Undocumented_qmake
> for more information on custom compilers than what is in the
> Qt documentation.
>

I tried the information on Undocumented_qmake to no avail (using the
4.3 Beta).  I added the following to my .pro in hopes that it would
build Messages_cd.h but it didn't work on Linux, Windows, or Mac OS X:
----------
msgc_mc.output = Messages_cd.h
msgc_mc.input = ../Messages_cd.mc
msgc_mc.commands = msgc -c ../Messages_cd.mc
msgc_mc.variable_out = HEADERS
QMAKE_EXTRA_COMPILERS += msgc_mc
----------

The Makefile generated by the above code would clean Messages_cd.h,
but had no rules to compile Messages_cd.h.  Did I do something wrong?

----------

The following did work on Linux and Mac OS X (-spec macx-g++), but not
Windows (using the visual studio integration and opening the .pro
file):
----------
messages_cd_h.target = Messages_cd.h
messages_cd_h.commands = msgc -c ../Messages_cd.mc
messages_cd_h.depends = ../Messages_cd.mc
QMAKE_EXTRA_TARGETS += messages_cd_h
----------

How can I get this (or anything that will perform this step) working
on Windows (preferably using Visual Studio integration)?

Thanks,
Robert

--
 [ signature omitted ] 

Message 5 in thread

On Friday 06 April 2007 04:09, Robert Stehwien wrote:
> I have files in the project I am porting to Qt with a non standard
> extension.  For that extension I need to run a separate tool to
> "compile" them.  I've looked into QMAKE_PRE_LINK and that is too late
> (the files generate header files used in the program).
>
> Is there something like QMAKE_PRE_BUILD, that would run before every
> build?  Or even better a way to specify suffix rules like I can in
> makefiles (.insuffix.outsuffix : ; command)  - that way the file will
> only be compiled with it changes.

See toward undocumented variable QMAKE_EXTRA_INCLUDES
Something like this in the .pro-file:
QMAKE_EXTRA_INCLUDES = some_extra_file

will cause qmake to add line: 
include "some_extra_file"

just before all rules and after defining all variables in the resulting 
Makefile. You can put in the file "some_extra_file" some rules to build your 
own files.

-- 
 [ signature omitted ]