Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How can I make a Qt Creator project that includes both a Qt plug-in and a demo application that uses it when run?
QtWS25 Last Chance

How can I make a Qt Creator project that includes both a Qt plug-in and a demo application that uses it when run?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
pluginqtcreatorproject
6 Posts 2 Posters 541 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.
  • Guy GizmoG Offline
    Guy GizmoG Offline
    Guy Gizmo
    wrote on last edited by
    #1

    I'm working on a Qt Creator project that has two targets: a Qt plug-in, and a demo application that uses the Qt plug-in. I have it set up so that there's an overarching Qt subdirs project that includes both of the plug-in and application project, with the plug-in project being a dependency of the app project.

    Both the app and plugin work as intended, and if I copy the built Qt plug-in to the global Qt plug-in directory, or I configure the "Run Settings" of the Qt Creator project so that it sets the QT_PLUGIN_PATH environment variable to the directory containing the plug-in, then the demo app finds it and uses it as intended.

    However, being that this project is meant to be an open source demo, I want people to be able to download it and run the demo app without needed to go through any additional steps to see the Qt plug-in working. All they should need to do is run the demo app from within Qt Creator.

    Is there a way to do that? So far I haven't found any settings I can put in my .pro file that tells the demo app to add the build directory of the plug-in project to its plug-in search paths.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you using the SUBDIRS template ?

      If so, you can use the OUT_PWD variable to set where the plugin should be put upon build. With it you can put the plugin in the folder you want in the application project build folder.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Guy GizmoG 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Are you using the SUBDIRS template ?

        If so, you can use the OUT_PWD variable to set where the plugin should be put upon build. With it you can put the plugin in the folder you want in the application project build folder.

        Guy GizmoG Offline
        Guy GizmoG Offline
        Guy Gizmo
        wrote on last edited by
        #3

        @SGaist said in How can I make a Qt Creator project that includes both a Qt plug-in and a demo application that uses it when run?:

        Hi,

        Are you using the SUBDIRS template ?

        If so, you can use the OUT_PWD variable to set where the plugin should be put upon build. With it you can put the plugin in the folder you want in the application project build folder.

        Yes, I'm using a subdirs project that contains the Qt plugin and app projects.

        However, my goal is to set up the .pro files used in these projects so that, when other users download the project, they can simply build and run the demo app from within Qt Creator and have the app find and load the Qt plug-in automatically, assuming that's possible. I can't do that by changing any build or run settings in Qt Creator as those are specific to a single system and aren't meant to be distributed.

        SGaistS 1 Reply Last reply
        0
        • Guy GizmoG Guy Gizmo

          @SGaist said in How can I make a Qt Creator project that includes both a Qt plug-in and a demo application that uses it when run?:

          Hi,

          Are you using the SUBDIRS template ?

          If so, you can use the OUT_PWD variable to set where the plugin should be put upon build. With it you can put the plugin in the folder you want in the application project build folder.

          Yes, I'm using a subdirs project that contains the Qt plugin and app projects.

          However, my goal is to set up the .pro files used in these projects so that, when other users download the project, they can simply build and run the demo app from within Qt Creator and have the app find and load the Qt plug-in automatically, assuming that's possible. I can't do that by changing any build or run settings in Qt Creator as those are specific to a single system and aren't meant to be distributed.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Guy-Gizmo that's exactly what my suggestion is about. It's independent of the fact to you use Qt Creator or build the project from the command line.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Guy GizmoG 1 Reply Last reply
          0
          • SGaistS SGaist

            @Guy-Gizmo that's exactly what my suggestion is about. It's independent of the fact to you use Qt Creator or build the project from the command line.

            Guy GizmoG Offline
            Guy GizmoG Offline
            Guy Gizmo
            wrote on last edited by
            #5

            @SGaist said in How can I make a Qt Creator project that includes both a Qt plug-in and a demo application that uses it when run?:

            @Guy-Gizmo that's exactly what my suggestion is about. It's independent of the fact to you use Qt Creator or build the project from the command line.

            Can you go into more detail about how to do that? I don't know how to modify a .pro file so that the Qt plug-in gets built in or copied to the right place.

            Furthermore, this project is primarily going to be built on macOS (though it may be run on Windows too), so I need to make sure it works in that case. I think that means the plugin needs to be copied into the correct place inside the demo app's application bundle, correct?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Something along the line of:

              DESTDIR = $$OUT_PWD/../app_project/plugins/myplugins

              Where app_project is the folder where your application is built and myplugins is the sub folder where you load your plugin from.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2

              • Login

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