Hello Adam,
It's easy to implement lazy loading of plugins in Qt5.
But I don't think that you can avoid using "hacks" in Qt4.
This is how it's done in qtcreator:
#ifdef Q_OS_WIN
QString libName = QString("%1/%2.dll").arg(location).arg(name);
#elif defined(Q_OS_MAC)
QString libName = QString("%1/lib%2.dylib").arg(location).arg(name);
#else
QString libName = QString("%1/lib%2.so").arg(location).arg(name);
#endif
Best regards, Alexander.
PS. May be I'm wrong, but it seems to me, that it would be enough to put
TRANSLATIONS section to qpdfview.pro and not to use
qpdfview-translations.pro
Hello again,
I messed up thing some more: I made the plug-in loading lazy, i.e. we
only try to load a plug-in when the corresponding format is used. And
I added build-time options to make the plug-ins static. (One option
for each plug-in, e.g. for the Arch Linux package I choose to make PDF
static and PS not.)
Of course, this further complicates the matter of determining the
actual "TARGET" variable in Makefile from qmake's "TARGET", e.g.
"libqpdfview_pdf.so" or "libqpdfview_pdf.a" for "qpdfview_pdf"...
Does anyone have an idea which qmake guru one could ask about this?
(The point is that I do not really want to write a OS switch statement
somewhere concatenating $QMAKE_PREFIX_SHLIB and things like that...)
Best regards, Adam.
Am 10.01.2013 20:42, schrieb Adam Reichold:
Hello again,
Ok, so I switched the whole thing to a plug-in based architecture
and changed the build system accordingly. Since this is the first
time I used Qt's plug-in system, comments and remarks are very much
appreciated.
For now, I chose to make plug-in loading explicit, i.e. the
program will only load the plug-ins it expects since build time and
fail if they are not present. (We probably want to relax this to
failing only if none are present.)
One thing I still have not figured out yet, is an automated way
for qmake to tell me what the plug-in files will actually be named
depending on the platform for which the program is built. (I.e.
TARGET=qpdfview-pdf and TEMPLATE=lib will yield libqpdfview-pdf.so
on Linux.) Currently, I explicitly set this (PDF_PLUGIN_NAME) in
the project include qpdfview.pri. Any hints/proposal are welcome.
Best regards, Adam.
--
Mailing list: https://launchpad.net/~qpdfview
Post to : [email protected]
Unsubscribe : https://launchpad.net/~qpdfview
More help : https://help.launchpad.net/ListHelp