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. Is there any documentation for the .pro file?
Forum Updated to NodeBB v4.3 + New Features

Is there any documentation for the .pro file?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
6 Posts 3 Posters 594 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.
  • R Offline
    R Offline
    rjmx
    wrote on 9 Oct 2023, 21:35 last edited by
    #1

    My project works fine on Linux and MacOS, and now I'm working on Windows with it. This involves some quite different stuff to the other two platforms: file paths, for example, are weird in Windows.
    Since I will expect to use the same .pro file for all three platforms, how can I separate them out?
    The .pro file was originally created in Linux, with lines that appear to be platform-specific (preceded with "qnx: ", "win32: ", "unix: "), and that may be enough, but are there any others? Is there one for MacOS? And why "win32"? It appears to work with 64-bit Windows, but is there a "win64"?
    I've looked for documentation on the .pro file, but I can't find any. Is there one?

    J K 2 Replies Last reply 9 Oct 2023, 23:05
    1
    • R rjmx
      9 Oct 2023, 21:35

      My project works fine on Linux and MacOS, and now I'm working on Windows with it. This involves some quite different stuff to the other two platforms: file paths, for example, are weird in Windows.
      Since I will expect to use the same .pro file for all three platforms, how can I separate them out?
      The .pro file was originally created in Linux, with lines that appear to be platform-specific (preceded with "qnx: ", "win32: ", "unix: "), and that may be enough, but are there any others? Is there one for MacOS? And why "win32"? It appears to work with 64-bit Windows, but is there a "win64"?
      I've looked for documentation on the .pro file, but I can't find any. Is there one?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 9 Oct 2023, 23:05 last edited by
      #2

      @rjmx https://doc.qt.io/qt-6/qmake-manual.html

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

      R 1 Reply Last reply 11 Oct 2023, 00:08
      2
      • R rjmx
        9 Oct 2023, 21:35

        My project works fine on Linux and MacOS, and now I'm working on Windows with it. This involves some quite different stuff to the other two platforms: file paths, for example, are weird in Windows.
        Since I will expect to use the same .pro file for all three platforms, how can I separate them out?
        The .pro file was originally created in Linux, with lines that appear to be platform-specific (preceded with "qnx: ", "win32: ", "unix: "), and that may be enough, but are there any others? Is there one for MacOS? And why "win32"? It appears to work with 64-bit Windows, but is there a "win64"?
        I've looked for documentation on the .pro file, but I can't find any. Is there one?

        K Offline
        K Offline
        KH-219Design
        wrote on 10 Oct 2023, 17:47 last edited by
        #3

        @rjmx I maintain several Qt GUI projects that use qmake and that target multiple OS platforms. I have been (mostly) pleased with an approach based on pri files, which are intended to be referenced from a pro like so:

        !include($$top_srcdir/cross_platform.pri) { error() }
        

        You can see a "Hello World" at the links below (which is quite big to be called Hello World, but is meant to be a mostly-minimal example of how a multi-library project can be supported simultaneously on: linux, windows, macOS, iOS, android).

        https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/src/util/util.pri#L3C1-L3C54

        https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/cross_platform.pri

        https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/main_gui.pro#L8

        As you will see in my code comments, I was initially inspired by https://www.toptal.com/qt/vital-guide-qmake

        Important parting thought:

        ALWAYS always always use the "error()" part of this, or else (unbelievably?) the line will fail silently, and you'll wonder why downstream compile/link actions are failing:

        # the "error()" part is critical! Indispensable!
        !include($$top_srcdir/cross_platform.pri) { error() }
        

        www.219design.com
        Software | Electrical | Mechanical | Product Design

        K 1 Reply Last reply 10 Oct 2023, 17:50
        1
        • K KH-219Design
          10 Oct 2023, 17:47

          @rjmx I maintain several Qt GUI projects that use qmake and that target multiple OS platforms. I have been (mostly) pleased with an approach based on pri files, which are intended to be referenced from a pro like so:

          !include($$top_srcdir/cross_platform.pri) { error() }
          

          You can see a "Hello World" at the links below (which is quite big to be called Hello World, but is meant to be a mostly-minimal example of how a multi-library project can be supported simultaneously on: linux, windows, macOS, iOS, android).

          https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/src/util/util.pri#L3C1-L3C54

          https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/cross_platform.pri

          https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/main_gui.pro#L8

          As you will see in my code comments, I was initially inspired by https://www.toptal.com/qt/vital-guide-qmake

          Important parting thought:

          ALWAYS always always use the "error()" part of this, or else (unbelievably?) the line will fail silently, and you'll wonder why downstream compile/link actions are failing:

          # the "error()" part is critical! Indispensable!
          !include($$top_srcdir/cross_platform.pri) { error() }
          
          K Offline
          K Offline
          KH-219Design
          wrote on 10 Oct 2023, 17:50 last edited by
          #4

          I just noticed I should also explain this:

          $$top_srcdir
          

          The "$$top_srcdir" works due to the existence of a .qmake.conf file at the top-level of the repository (side-by-side with the top .pro)

          That was a tip I found here: https://wiki.qt.io/QMake-top-level-srcdir-and-builddir

          www.219design.com
          Software | Electrical | Mechanical | Product Design

          R 1 Reply Last reply 11 Oct 2023, 00:09
          3
          • J jsulm
            9 Oct 2023, 23:05

            @rjmx https://doc.qt.io/qt-6/qmake-manual.html

            R Offline
            R Offline
            rjmx
            wrote on 11 Oct 2023, 00:08 last edited by
            #5

            @jsulm Ah, thanks! That's what I was looking for.

            1 Reply Last reply
            0
            • K KH-219Design
              10 Oct 2023, 17:50

              I just noticed I should also explain this:

              $$top_srcdir
              

              The "$$top_srcdir" works due to the existence of a .qmake.conf file at the top-level of the repository (side-by-side with the top .pro)

              That was a tip I found here: https://wiki.qt.io/QMake-top-level-srcdir-and-builddir

              R Offline
              R Offline
              rjmx
              wrote on 11 Oct 2023, 00:09 last edited by
              #6

              @KH-219Design Thank you for that. That's going to be useful.

              1 Reply Last reply
              0
              • A aha_1980 has marked this topic as solved on 24 Dec 2023, 05:06

              3/6

              10 Oct 2023, 17:47

              • Login

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