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. Excess Static Libs when using QMake
Forum Updated to NodeBB v4.3 + New Features

Excess Static Libs when using QMake

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
9 Posts 4 Posters 382 Views 2 Watching
  • 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.
  • D Offline
    D Offline
    DalePennington
    wrote on last edited by
    #1

    Folks,
    I am using Qt 6.10 and a source build. When I use QMake to generate the make files and the _plugin_import.cpp file I am getting many additional static libraries that I do not need or have added in automatically, such as QSvgIconPlugin.
    I can manually edit the generated files to remove them and things work fine, but in the long term I would rather not have to do that. Any idea how to get Qt to not auto add those static plugins?
    Thanks
    Dale Pennington

    jsulmJ 1 Reply Last reply
    0
    • D DalePennington

      Folks,
      I am using Qt 6.10 and a source build. When I use QMake to generate the make files and the _plugin_import.cpp file I am getting many additional static libraries that I do not need or have added in automatically, such as QSvgIconPlugin.
      I can manually edit the generated files to remove them and things work fine, but in the long term I would rather not have to do that. Any idea how to get Qt to not auto add those static plugins?
      Thanks
      Dale Pennington

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @DalePennington said in Excess Static Libs when using QMake:

      Did you try

      QT -= svg
      

      if you do not need SVG?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DalePennington
        wrote on last edited by
        #3

        Tried it, no change. I am trying the cmake file now to see if I can get that to work. Seems to be OK except AUTOMOC is not generating moc files for our basic code tree (with seperate forms,inc and src dirs). Once set the AUTOUIC search path property the forms generated OK, but so far AUTOMOC is not generating the moc. If I turn the tree flat (i.e. put all the files at the top level) it works so there is something I am missing with regards to getting AUTOMOC to look in the right places
        Dale

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

          Hi,

          Might be a silly question but did you set the AUTOMOC_INCLUDE_DIRECTORIES property ?

          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
          0
          • D Offline
            D Offline
            DalePennington
            wrote on last edited by DalePennington
            #5

            At this point I have not. I tried at one point and noticed the MOC_INCLUDES variable in AutogenInfo.json did not change, do I probably did something wrong. It does include the include directory I set for the target, but this is not where the AUTOUIC places the ui_.h file it generates. I am assuming that this needs to be findable to get AUTOMOC to work properly, but no good idea how to fix that.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DalePennington
              wrote on last edited by
              #6

              To make help easier, this is the setup

              1. Files are in the following tree
                  guiclient2 - Has .pro file
                      forms - has ui file
                      inc - has .hpp files
                      src - has .cpp files
              

              The CMakeLists.txt file has

              cmake_minimum_required(VERSION 3.16)
              project(guiclient LANGUAGES CXX)
              
              set(CMAKE_CXX_STANDARD 17)
              set(CMAKE_CXX_STANDARD_REQUIRED ON)
              
              set(CMAKE_AUTOUIC_SEARCH_PATHS "forms")
              
              find_package(Qt5 REQUIRED COMPONENTS Widgets WebSockets)
              
              qt_standard_project_setup()
              
              qt_add_executable(guiclient2
                  src/main.cpp
                  src/echowindow.cpp
              }
              
              target_include_directories(guiclient2 PRIVATE inc)
              target_link_libraries(guiclient2 PRIVATE
                  Qt::Widgets
                  Qt::WebSockets
              )
              

              The original cmake call sets up the AutogenInfo.json, so it must be determining what UI and MOC need generating at that time.
              As noted, if I do the same files in a flat setup (all in guiclient2) it works fine with the same CMakeLists.txt with the paths modified.

              I hope this helps figure out what I am doing wrong.
              Dale Pennington

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Add also your headers. Then automoc will find them and you will see them properly in the IDE.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DalePennington
                  wrote on last edited by
                  #8

                  Odd, not needed in flat file system case, but explicity adding it to the sources did in fact get everything to work.

                  As a side, not important question, is there a way to add sources to a target after the initial qt_add_executable ? I ask this for ease of future use for programs with large numbers of source files.

                  Thanks,
                  Dale Pennington

                  1 Reply Last reply
                  0
                  • D DalePennington has marked this topic as solved on
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    When all is in one directory then automoc can find them. It does not search in subdirectories.

                    For additional sources - see target_sources cmake command

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    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