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. [resolved] getting qmake to copy some data files for me

[resolved] getting qmake to copy some data files for me

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 2 Posters 9.0k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    A few months ago, I asked a question "in this thread":http://developer.qt.nokia.com/forums/viewthread/7487/ about getting the build process to move data files from the source folder structure into the build folder structure. It worked fine on my Mac, but this weekend I began trying to port to a Windows XP machine. The build of the binary works, but not the moving of the data files.

    The reason for this is obvious, as the pathname is different on the XP system (here's part of my .pro file):

    @APP_COEFF_FILES.files = coeffs
    APP_COEFF_FILES.path = Contents/MacOS

    QMAKE_BUNDLE_DATA += APP_COEFF_FILES

    APP_DATA_FILES.files = data
    APP_DATA_FILES.path = Contents/MacOS

    QMAKE_BUNDLE_DATA += APP_DATA_FILES
    @

    So, I guess the question is, can I make this conditional on the system the build is running on? It would be nice if I could just drag the entire project, .pro file and all, from the Mac to the XP.

    Thanks...

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      According to the docs, QMAKE_BUNDLE_DATA is only used on the Mac. I didn't try if it works at all on other platforms.

      For specifying different paths, you can put that into scopes of course:

      @
      macx: {
      APP_COEFF_FILES.files = coeffs
      APP_COEFF_FILES.path = Contents/MacOS
       
      QMAKE_BUNDLE_DATA += APP_COEFF_FILES
       
      APP_DATA_FILES.files = data
      APP_DATA_FILES.path = Contents/MacOS
       
      QMAKE_BUNDLE_DATA += APP_DATA_FILES
      }

      win32: {
      APP_COEFF_FILES.files = coeffs
      APP_COEFF_FILES.path = abc
       
      QMAKE_BUNDLE_DATA += APP_COEFF_FILES
       
      APP_DATA_FILES.files = data
      APP_DATA_FILES.path = def
       
      QMAKE_BUNDLE_DATA += APP_DATA_FILES
      }
      @

      But again, I don't know whether that QMAKE_BUNDLE_DATA works at all.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        Thanks, Volker...I'll give that a try later today, just for experimentation. After looking at this a bit more, though, I'm a little surprised that it didn't work. Why didn't the build process just create the (Mac-named) directories on the XP?

        And, is there any documentation on the language used in the .pro file? I didn't see anything on the main docs page.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          As the docs state, that whole QMAKE_BUNDLE_DATA thingie works on the Mac only. I wouldn't expect it to work on any other platform.

          But you can write a script that copies everything into the right place, then add
          add QMAKE_POST_LINK=/path/to/your/script to the .pro file. This will call your script every time your application is built (after the link step).

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #5

            Where are the docs for the .pro file? I couldn't find it on the main page. I found a copy script that takes parameters for the source and destination; now I just have to figure out how to pass it that information (without hard-coding it, preferably).

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Find the docs "here":/doc/qt-4.7/qmake-manual.html and here the "variable reference":/doc/qt-4.7/qmake-variable-reference.html

              I, for example, have this in my .pro:

              @
              QMAKE_POST_LINK = ./OSX-lib-and-framework-paths.sh "$${TARGET}.app"
              @

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #7

                Wow...that's quite a list of variables.

                In your example above, what is the syntax for the stuff in the quotes? I gather that you're forming a parameter for a script, but...what does the stuff mean? Feel free to point me to a document if one exists.

                Also, it appears that I could obviate this problem by choosing a different destination for the executable with the TARGET variable. True? Good idea/bad idea? I was thinking I could put it in the same directory as my .pro file and other stuff.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  That's quite simple: $${XYZ} will be replaced by the contents of variable XYZ. It can be any of the predefined variables/constants of qmake or a self defined variable. I've added the quotes because my target can contain spaces and the script would interpret it as two arguments in that case. On the shell command line you would call it like this:

                  @
                  ./OSX-lib-and-framework-paths.sh "My Application.app"
                  @

                  The TARGET variable contains the base name of your final binaray. The complete file name depends on the target type as well as the operating system and is "calculated" for the respective uses. For example:

                  • application on Windows: target.exe
                  • static lib on Windows: target.lib
                  • dynamic lib on Windows: target.dll
                  • application on OS X: target.app
                  • static lib on OS X: target.a
                  • dynamic lib on OS X: target.dylib
                  • application on Linux: target (no suffix)
                  • static lib on Linux: target.a
                  • dynamic lib on Linux: target.so

                  The TARGET variable does not contain the path to the final binary. You should be able to construct that together with the DESTDIR variable, though.

                  General info on the variable voodoo can be found in the "variable documentation":http://developer.qt.nokia.com/doc/qt-4.7/qmake-advanced-usage.html of the qmake manual. In general, it's a good idea to read that from the very beginning to the end :-)

                  http://www.catb.org/~esr/faqs/smart-questions.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