Using 'staticlib' and 'lib_bundle' together



  • On Mac or iOS, with Qt 5.9.3 or Qt 5.10, in my .pro, I have:
    CONFIG += lib_bundle

    And when I use:
    CONFIG += shared

    This will result in a .framework bundle, but
    CONFIG += staticlib
    or
    CONFIG += static

    This will only build the lib$$TARGET.a, and not a contained .framework. Is there another variable or tweak to get this to work?


  • Lifetime Qt Champion

    Hi,

    AFAIK, there’s no concept of static framework. It’s either one or the other.



  • @SGaist You could only make static frameworks under iOS until fairly recently.

    Either way, at the end, it's headers and the library under one directory, which isn't hard to do, but I would just rather use the existing system to do that.



  • Well, I couldn't figure out any magic incantation, so I just added the following:

                QMAKE_POST_LINK += mkdir -p $${TARGET}.framework/Headers && \
                    $$QMAKE_COPY $$PWD/*.h $${TARGET}.framework/Headers && \
                    $$QMAKE_COPY $$OUT_PWD/lib$${TARGET}.a $${TARGET}.framework/$${TARGET} && \
                    $$QMAKE_RANLIB -s $${TARGET}.framework/$${TARGET}
    

    Obviously, this only works on unix-like systems, and not versioned frameworks. But, for static linking, I think this is sufficient.


  • Lifetime Qt Champion

    Thanks for the feedback


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.