Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Build Qt without all the widgets I don't need

Build Qt without all the widgets I don't need

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 3.4k 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.
  • D Offline
    D Offline
    Donner
    wrote on last edited by
    #1

    Hi,

    I am using Qt for a really small project (just one window, a few push buttons and some other minor stuff). Still, I need the Qt-DLLs and ship them with my executable file (at least on Windows).

    Now, my executable only is about 200 KB big, but the Qt DLLs (Core and GUI, bult in release mode) take almost 10 MB which is quite a lot since I don't need most of the stuff in there.

    Is there a way of building Qt only with what I actually need and use in my application?

    I know the wiki page http://qt-project.org/doc/qt-4.8/configure-options.html, but is there a way to optimize the size further?

    Thank you in advance,
    D.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Have you tried to use static linking and LTO?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        If you use static linking, take care of the licence stuff.
        LGPL does not allow static linkage. Commercial license allows it. IIRC, GPL also allows it.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Yes, there are more options for optimization. There is a header file somewhere that has loads of defines that enable you to switch features on and off very specifically. I'll dig a bit to find it.

          Edit:
          Found it. You're looking to modify <qtdir>\src\corelib\global\qfeatures.h

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #5

            You can also define your own feature set using the qconfig tool. You can find it (as a project with sources) under "tools".

            Consider that you can also remove a lot of features using the command line options of "configure", when building Qt. Call configure -h to get a full list of options.

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

              [quote author="peppe" date="1331177864"]Have you tried to use static linking and LTO?[/quote]
              Hey, thanks for your reply. Unfortunately because I can't afford the commercial license, static linking is no option. But what does LTO stand for?

              [quote author="Andre" date="1331177864"]Yes, there are more options for optimization. There is a header file somewhere that has loads of defines that enable you to switch features on and off very specifically. I’ll dig a bit to find it.
              Edit: Found it. You’re looking to modify <qtdir>\src\corelib\global\qfeatures.h
              [/quote]I'll have a look into that file, thanks a lot :)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Donner
                wrote on last edited by
                #7

                [quote author="Asperamanca" date="1331200410"]You can also define your own feature set using the qconfig tool. You can find it (as a project with sources) under "tools".

                Consider that you can also remove a lot of features using the command line options of "configure", when building Qt. Call configure -h to get a full list of options.[/quote]qconfig seems to be very promising, didn't know that tool. Thank you!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Asperamanca
                  wrote on last edited by
                  #8

                  There's also an article explaining the use of qconfig:

                  http://doc.qt.nokia.com/4.7-snapshot/fine-tuning-features.html

                  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