Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Static build qml module depends _qmlcache _resources_2 _resources_1 targets
Forum Updated to NodeBB v4.3 + New Features

Static build qml module depends _qmlcache _resources_2 _resources_1 targets

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
4 Posts 1 Posters 510 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by
    #1

    I am creating a qml module as a library like:

    qt6_add_qml_module(nodeConection
    ~         URI  imports
    ~         VERSION 1.0 
    ~         SOURCES
    ~         src/nodeConnection.cpp include/nodeConnection.hpp
    ~         QML_FILES
    ~         qml/Node_Connections.qml
    ~         )
    

    and exporting the target like

    install(TARGETS nodeConection  EXPORT nodeConectionTargets DESTINATION bin )
    

    this work with shared builds but when using webassembly (static build) the backing target library depends on 3 more targets with name "target_qmlcache", "target_resources_2", "target_resources_1". How can I export the targets depending on the build type?

    Where are the sources of this cmake qml macros like "qt_add_qml_module".

    1 Reply Last reply
    0
    • MesrineM Offline
      MesrineM Offline
      Mesrine
      wrote on last edited by Mesrine
      #4

      It seems i need to add to qt_add_qml_module the [OUTPUT_TARGETS out_targets_var]
      and export the additional targets in out_targets_var variable .

      If the backing target is a static library and that static library will be installed, OUTPUT_TARGETS should be given to provide a variable in which to store a list of additional targets that will also need to be installed. These additional targets are generated internally by qt_add_qml_module() and are referenced by the backing target's linking requirements as part of ensuring that resources are set up and loaded correctly.

      1 Reply Last reply
      0
      • MesrineM Offline
        MesrineM Offline
        Mesrine
        wrote on last edited by
        #2

        Also I have not found the way to export a qml module target and link in some application target using wasm.

        If in the main application i set

        engine.addImportPath(QCoreApplication::applicationDirPath() + "/_deps/nodeconection-build/");
           12         qDebug()<<engine.importPathList();
        

        the output of that qDebug() tells me that it added "/_deps/nodeconection-build/" when using qt gcc but when using wasm it do not add that import directory.

        The only way i found to use qt_add_qml_module in wasm is to create all the modules in the main cmake file where the qt_add_executable is used.

        This is bad, because i want to export my custom qml modules and link to my main target so my modules are reusable. Using shared libraries(qt_gcc) this works nicely but with wasm is a mess. There is no example on this.

        1 Reply Last reply
        0
        • MesrineM Offline
          MesrineM Offline
          Mesrine
          wrote on last edited by Mesrine
          #3

          I need to add an imported module to The Qt Resource System, to then be able to import the module by adding

           engine.addImportPath(":/my.company.com/imports");
          

          if i create the module using qt_add_qml_module, how can i add the module to "The Qt Resource System"? Or how can i add the import path of that module using

          engine.addImportPath(":/my.company.com/imports");
          

          or mayb ei need to use a qurl path to webassembly be able to import that like

          engine.addImportPath(QUrl(u"qrc:/_deps/nodeconection-build/"_qs).toEncoded());
          

          Could be also relate that webassembly is like crosscompilation and the path are different?

          1 Reply Last reply
          0
          • MesrineM Offline
            MesrineM Offline
            Mesrine
            wrote on last edited by Mesrine
            #4

            It seems i need to add to qt_add_qml_module the [OUTPUT_TARGETS out_targets_var]
            and export the additional targets in out_targets_var variable .

            If the backing target is a static library and that static library will be installed, OUTPUT_TARGETS should be given to provide a variable in which to store a list of additional targets that will also need to be installed. These additional targets are generated internally by qt_add_qml_module() and are referenced by the backing target's linking requirements as part of ensuring that resources are set up and loaded correctly.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved