PDA

View Full Version : QMake to Build Help Files



ChrisW67
29th June 2009, 01:34
Hi All,

I cannot seem to find any mention of having qmake build compiled help files from a help project and source. Are these rules in qmake's repertoire and how can I use them?

Cheers,
Chris

wysota
29th June 2009, 11:01
There are no predefined rules for this, you have to provide them yourself.

liversedge
30th July 2011, 11:15
Of course, the question is HOW do you do this?

A .pro file can only have a single target, so I've created a subdir with my .qhp files. But the .pro file can only build apps, libs and subdirs. Here is my help.pro file.. what is needed to make it generate a target qch rather than assuming it is building a binary?

TARGET = GoldenCheetah.qch

qhelpgenerator.output = help.qch
qhelpgenerator.input = help.qhp
qhelpgenerator.commands = ghelpgenerator help.qhp
qhelpgenerator.CONFIG = no_link
QMAKE_EXTRA_COMPILERS += qhelpgenerator

wysota
30th July 2011, 11:51
A .pro file can only have a single target
That's not true. One pro file can define an arbitrary number of targets but only one is considered the "main" target (i.e. the one that is executed when you call make without parameters). Have a look at the docs for QMAKE_EXTRA_TARGETS variable.

ChrisW67
30th July 2011, 22:45
Two variations that do the job:

# the main target
TEMPLATE = app
SOURCES += ...
HEADERS += ...

# The help
# Using a "custom compiler"
QHP_FILES += help1.qhp help2.qhp

qhp_qhc.input = QHP_FILES
qhp_qhc.output = ${QMAKE_FILE_BASE}.qch
qhp_qhc.commands = qhelpgenerator ${QMAKE_FILE_NAME}
qhp_qhc.CONFIG = no_link target_predeps
QMAKE_EXTRA_COMPILERS += qhp_qhc

# Or for a single file using a custom target
myhelp.target = test3.qhc
myhelp.depends = test3.qhp
myhelp.commands = qhelpgenerator $$myhelp.depends
QMAKE_EXTRA_TARGETS += myhelp
PRE_TARGETDEPS += test3.qhc

Utimately they amount to much the same sort of thing. The first is more flexible with multiple help files to generate.