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

Qt-interest Archive, March 2008
Make a project compilable with both static and shared qt


Message 1 in thread

Hi all,

My project uses plugins, and I would like to make it compilable with static
or shared qt

If I use the QT_PLUGIN qmake directive and the Q_IMPORT_PLUGIN macro to make
my project compilable with static qt, then when I try to build it with a
shared Qt I get errors such as "cannot find -lqjpegd"

Is there a macro and a qmake variable available to turn these instructions
into conditionnal statements?

Thanks,

Etienne

Message 2 in thread

On fredag den 14. Marts 2008, Etienne Sandré wrote:
> Hi all,
>
> My project uses plugins, and I would like to make it compilable with static
> or shared qt
>
> If I use the QT_PLUGIN qmake directive and the Q_IMPORT_PLUGIN macro to
> make my project compilable with static qt, then when I try to build it with
> a shared Qt I get errors such as "cannot find -lqjpegd"
>
> Is there a macro and a qmake variable available to turn these instructions
> into conditionnal statements?

No, unfortunately not. There is no way in qmake to set up make to do an if 
statement. The reason is that you won't get visual studio and xcode to handle 
those.

Bo.

-- 
 [ signature omitted ] 

Message 3 in thread

qmake is already handling some kind of conditionnal statements such as:

win32:debug
{
    CONFIG += console
}

So it should be possible to implement something like:

qt_static
{
    QT_PLUGIN += qjpeg
}


Etienne





2008/3/17, Bo Thorsen <bo@xxxxxxxxxxxxxxxxxxxxx>:
>
> On fredag den 14. Marts 2008, Etienne Sandrà wrote:
> > Hi all,
> >
> > My project uses plugins, and I would like to make it compilable with
> static
> > or shared qt
> >
> > If I use the QT_PLUGIN qmake directive and the Q_IMPORT_PLUGIN macro to
> > make my project compilable with static qt, then when I try to build it
> with
> > a shared Qt I get errors such as "cannot find -lqjpegd"
> >
> > Is there a macro and a qmake variable available to turn these
> instructions
> > into conditionnal statements?
>
>
> No, unfortunately not. There is no way in qmake to set up make to do an if
> statement. The reason is that you won't get visual studio and xcode to
> handle
> those.
>
> Bo.
>
> --
>
> Thorsen Consulting ApS - Qt consulting services
> http://www.thorsen-consulting.dk
>
>
> --
> 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/
>
>

Message 4 in thread

and what about my second question? (preprocessor conditionnal statement)

I would like to to something like:

#ifdef(QT_STATIC)
Q_IMPORT_PLUGIN(qjpeg)
#endif

because the Q_IMPORT_PLUGIN is useful only for static builds and generates
an error when linking with the shared library

Etienne

Message 5 in thread

Hello,

On Mon, Mar 17, 2008 at 3:09 PM, Etienne SandrÃ
<etienne.sandre@xxxxxxxxxxxxxxxxx> wrote:
> and what about my second question? (preprocessor conditionnal statement)

Just add a define to the static conditional. I'm using this snippet:

static {
    QTPLUGIN += qtaccessiblewidgets
    LIBS += -L$$(QT_BUILD_TREE)/plugins/accessible -lqtaccessiblewidgets
    DEFINES += STATIC
    message("using static plugin")
}

and then #ifdef STATIC around Q_IMPORT_PLUGIN.


 - Dominik
N‹§²æìr¸›zÇu©šŠ[hªØµêÞÚÞçÚè–[^r(›­†éì®&Þ{azˍç-¢»ayºȬµªÜ+Þjwbú+™«b¢xm¶Ÿÿ–+-²Úè–[^r(›ú­Š{^­ë-