Create a C++ plugin: how to install headers?



  • Hi!
    I've written a plugin following this guide http://doc.qt.io/qt-5/qtqml-modules-cppplugins.html, and now I've something perfectly working that I can instantiate from qml.
    The last building step install the file .so in default qml dir of qt.
    However, I would like to install it as a "library" as well. I can explain my case: I need to create one of the object defined in the plugin from the c++ code of another project, and in order to do it, I need the header and the relative library to be placed in QT_INSTALL_HEADERS and QT_INSTALL_LIBS.

    How can I setup the project to build the plugin as both "QML plugin" and "library like"?

    From this https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application,
    it's seems that I've to add to the .pro these lines:

    headersDataFiles.path = $$[QT_INSTALL_HEADERS]/MyLib/
    headersDataFiles.files = $$PWD/src/*.h
    INSTALLS += headersDataFiles

    libraryFiles.path = $$[QT_INSTALL_LIBS]
    Debug:libraryFiles.files = $$OUT_PWD/debug/.a $$OUT_PWD/debug/.prl
    Release:libraryFiles.files = $$OUT_PWD/release/.a $$OUT_PWD/release/.prl
    INSTALLS += libraryFiles

    Is it the right procedure?

    Thanks

    This is the code of the plugin https://github.com/chili-epfl/qml-3dmouseinterface


Log in to reply
 

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