Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Felgo CI/CD: qml plugin deployment for Android and iOS

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #24248

    Volker

    Hi,

    our project uses our internal qml plugin. If we put plugin binary nad qmldir file manually inside Felgo/Felgo/android/qml/Medrepo and build APK in QtCreator all works as expected and qml library together with Felgo project binary (as .so)  are inside /lib/x86. qmldir is inside /assets/–Added-by-androiddeployqt–/qml/…

    Now we trying to build Android and iOS packages using Felgo CI/CD server. We have qml plugin binary inside git repositotry, but how to copy it inside Felgo installation? I tried to put it this way:

    android {
        ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
        OTHER_FILES += android/AndroidManifest.xml \
                       android/build.gradle
        equals(ANDROID_TARGET_ARCH, arm64-v8a) {
            ANDROID_EXTRA_LIBS += \
                $$PWD/../../../deploy_android/arm64/libwebsockets.so \
                $$PWD/../../../deploy_android/arm64/libjasca.so \
                $$PWD/../../../deploy_android/arm64/libjasca_qml_plugin.so             
        }
    }

    where libjasca_qml_plugin.so is the required QML plugin. It gets deployed inside /lib/arm64-v8a, but app still crashes and I think it’s missing qmldir file. I cannot put it in ANDROID_EXTRA_LIBS.

    Since on Felgo CI/CD server I cannot manually copy files, the only possibility is to do all deployment with qmake (inside .pro file).

    What is the proper way to deploy QML plugin on Android and iOS?

    #24249

    Volker

    For Android it seems to work using ANDROID_EXTRA_PLUGINS. If put qml plugin together with qmldir inside eploy_android/arm64/Medrepo, then

    android {
        ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
        OTHER_FILES += android/AndroidManifest.xml \
                       android/build.gradle
        equals(ANDROID_TARGET_ARCH, arm64-v8a) {
            ANDROID_EXTRA_LIBS += \
                $$PWD/../../../deploy_android/arm64/libwebsockets.so \
                $$PWD/../../../deploy_android/arm64/libjasca.so
            ANDROID_EXTRA_PLUGINS += $$PWD/../../../deploy_android/arm64/Medrepo
        }

    After that I have qml plugin inside /lib/arm64-v8a and qmldir inside /assets/Medrepo/

    What should I do for iOS image?

    #24259

    Alex
    Felgo Team

    Hi Volker,

    sorry for the delay, I had a bit of back and forth with the development team about this. I followed up to you via mail on this.

    Best,
    Alex

    #24529

    Volker

    Hi Alex,

    I’ve got Mac Mini M1 and trying to get app running in Simulator and real device. AFAIK on iOS I have to use static libraries only, so I compiled qml plugin statically and link it with app:

    ios {
        LIBS +=            
            $$OUT_PWD/../jasca_qml_plugin/libjasca_qml_plugin.a 
        QMAKE_INFO_PLIST = ios/Project-Info.plist
        OTHER_FILES += $$QMAKE_INFO_PLIST
        QMAKE_IOS_DEPLOYMENT_TARGET = 12.5
        QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1
        QMAKE_APPLE_DEVICE_ARCHS = arm64
        QMAKE_APPLE_SIMULATOR_ARCHS = x86_64
        Q_ENABLE_BITCODE.name = ENABLE_BITCODE
        Q_ENABLE_BITCODE.value = NO
        QMAKE_MAC_XCODE_SETTINGS += Q_ENABLE_BITCODE
    }

    But on startup I’m getting: “​Warning: QQmlApplicationEngine failed to load component ((null):0, (null))” and later “module “Medrepo” is not installed”.

    I created resources file for qml plugin:

    <RCC>
        <qresource prefix="/Medrepo">
            <file>qmldir</file>
        </qresource>
    </RCC>

    and put following lines in main.cpp

    #ifdef Q_OS_DARWIN
        engine.addImportPath(app.applicationDirPath()+"/../PlugIns");
        engine.addImportPath("qrc:/Medrepo/");
        qmlRegisterType<JascaPlugin>(uri, 1, 0, "JascaPlugin");
    #endif

    But no success …

    #24530

    Volker

    I forgot to mention that qmldir was adjusted for static linkage:

    module Medrepo
    plugin jasca_qml_plugin
    typeinfo plugins.qmltypes # required for static plugins
    classname Jasca_qml_pluginPlugin # static plugin must set classname for plugin c++ class
    

     

    #24531

    Volker

    Inside pro of qml plugin there are some ios specific definitions:

    ios {
      DEFINES += BUILD_PLUGIN_STATIC
      CONFIG += static
      RESOURCES += plugin_resources.qrc
      QMAKE_MOC_OPTIONS += -Muri=$$uri
      QMAKE_IOS_DEPLOYMENT_TARGET = 12.5
      QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1
      QMAKE_APPLE_DEVICE_ARCHS = arm64
    
    }

     

    #24533

    Alex
    Felgo Team

    Hi Volker,

    just to be sure, is this related to Cloud Builds CI/CD (which this forum thread was related to) or are you trying to build/deploy locally on your Mac?

    Best,
    Alex

    #24534

    Volker

    Changing one line to qmlRegisterType<JascaPlugin>(“Medrepo”, 1, 0, “JascaPlugin”); solved the problem.

    #24535

    Volker

    Hi Alex,

    sorry, I had to create a new thread. We are doing CI/CD on our loacl gitlab runner, so it is not related to Felgo’s cloud build system.

    Regards

Viewing 9 posts - 1 through 9 (of 9 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded