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?

Is there any documentation for the .pro file?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
6 Posts 3 Posters 545 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.
  • R Offline
    R Offline
    rjmx
    wrote on 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?

    jsulmJ KH-219DesignK 2 Replies Last reply
    1
    • R rjmx

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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
      2
      • R rjmx

        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?

        KH-219DesignK Online
        KH-219DesignK Online
        KH-219Design
        wrote on 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

        KH-219DesignK 1 Reply Last reply
        1
        • KH-219DesignK KH-219Design

          @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() }
          
          KH-219DesignK Online
          KH-219DesignK Online
          KH-219Design
          wrote on 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
          3
          • jsulmJ jsulm

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

            R Offline
            R Offline
            rjmx
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • KH-219DesignK KH-219Design

              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 last edited by
              #6

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

              1 Reply Last reply
              0
              • aha_1980A aha_1980 has marked this topic as solved on

              • Login

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