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. Qt Creator: how to copy files after building?

Qt Creator: how to copy files after building?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 5.7k 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello all!

    I am developing static lib and I need to copy files (lib and headers) copy to the defined directory. How to make it?

    I found this https://forum.qt.io/topic/92537/how-can-i-call-shell-script-while-clicking-of-run-button-of-qt/2 and https://stackoverflow.com/questions/6300148/get-qmake-to-execute-shell-script-after-build-finished-on-mac but the problem is how to automate it in case of different builds for different platforms and architectures.

    This code in *.pro file is working perfectly:

    QMAKE_POST_LINK += yes | cp /libSomething.a /path/where/to/copy/
    

    Is there any way to automate it without using *.pro file?

    K 1 Reply Last reply
    0
    • B bogong

      Hello all!

      I am developing static lib and I need to copy files (lib and headers) copy to the defined directory. How to make it?

      I found this https://forum.qt.io/topic/92537/how-can-i-call-shell-script-while-clicking-of-run-button-of-qt/2 and https://stackoverflow.com/questions/6300148/get-qmake-to-execute-shell-script-after-build-finished-on-mac but the problem is how to automate it in case of different builds for different platforms and architectures.

      This code in *.pro file is working perfectly:

      QMAKE_POST_LINK += yes | cp /libSomething.a /path/where/to/copy/
      

      Is there any way to automate it without using *.pro file?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @bogong

      You can set directory names through variables. E.g.

      CONFIG(release, debug|release) {
          PACKSOURCE = $$DESTDIR/$$TARGET".*"
          PACKINDIR  = $$PACKBASE/packages/$$MODULNAME
          PACKUPDIR  = $$PACKBASE/packages_update/$$MODULNAME
      
          win32:{
              exists($$system_path($$MyPackageLocation/package.xml)) {
                  QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$MyPackageLocation/package.xml) $$system_path($$PACKINDIR/meta/)
              }
              QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$PACKSOURCE) $$system_path($$PACKINDIR/data/)
              QMAKE_POST_LINK += && dir $$system_path($$PACKINDIR/data/)
              QMAKE_POST_LINK += && del $$system_path($$PACKINDIR/data/*.txt.sik)
      
              exists($$system_path($$MyPackageLocation/package.xml)) {
                  QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$MyPackageLocation/package.xml) $$system_path($$PACKUPDIR/meta/)
              }
              QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$PACKSOURCE) $$system_path($$PACKUPDIR/data/)
              QMAKE_POST_LINK += && dir $$system_path($$PACKUPDIR/data/)
              QMAKE_POST_LINK += && del $$system_path($$PACKUPDIR/data/*.txt.sik)
          }
          linux:{
      # not set yet
          }
      }
      

      That is basically a .pri file I am including in several .pro . The result files are distributed intop a package folder for using installer framework.

      Vote the answer(s) that helped you to solve your issue(s)

      B 1 Reply Last reply
      2
      • K koahnig

        @bogong

        You can set directory names through variables. E.g.

        CONFIG(release, debug|release) {
            PACKSOURCE = $$DESTDIR/$$TARGET".*"
            PACKINDIR  = $$PACKBASE/packages/$$MODULNAME
            PACKUPDIR  = $$PACKBASE/packages_update/$$MODULNAME
        
            win32:{
                exists($$system_path($$MyPackageLocation/package.xml)) {
                    QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$MyPackageLocation/package.xml) $$system_path($$PACKINDIR/meta/)
                }
                QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$PACKSOURCE) $$system_path($$PACKINDIR/data/)
                QMAKE_POST_LINK += && dir $$system_path($$PACKINDIR/data/)
                QMAKE_POST_LINK += && del $$system_path($$PACKINDIR/data/*.txt.sik)
        
                exists($$system_path($$MyPackageLocation/package.xml)) {
                    QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$MyPackageLocation/package.xml) $$system_path($$PACKUPDIR/meta/)
                }
                QMAKE_POST_LINK += && xcopy /I /Y /R $$system_path($$PACKSOURCE) $$system_path($$PACKUPDIR/data/)
                QMAKE_POST_LINK += && dir $$system_path($$PACKUPDIR/data/)
                QMAKE_POST_LINK += && del $$system_path($$PACKUPDIR/data/*.txt.sik)
            }
            linux:{
        # not set yet
            }
        }
        

        That is basically a .pri file I am including in several .pro . The result files are distributed intop a package folder for using installer framework.

        B Offline
        B Offline
        bogong
        wrote on last edited by
        #3

        @koahnig I know it perfectly. The question in my message about "Is there any way to automate it without using *.pro file?"
        Is your way without using *.pro file???

        aha_1980A K 2 Replies Last reply
        0
        • B bogong

          @koahnig I know it perfectly. The question in my message about "Is there any way to automate it without using *.pro file?"
          Is your way without using *.pro file???

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @bogong If you really want to do it without .pro file:

          You can add custom build steps in Creators Projects View: Projects (Ctrl+5) > Build Settings > Build Steps > Add build step.

          Note that this is only for your personal working directory and not meant to be shared.

          Regards

          Qt has to stay free or it will die.

          1 Reply Last reply
          4
          • B bogong

            @koahnig I know it perfectly. The question in my message about "Is there any way to automate it without using *.pro file?"
            Is your way without using *.pro file???

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @bogong

            Certainly you can type something similar in bat-file.
            Probably also in the cmake file.

            In Qt creator probably you could add a special command for keystrokes, but that would not be automatic.
            I am using still qmake and the .pro file for compilation with Qt creator. Therefore, this is the only way I can think of.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bogong
              wrote on last edited by
              #6

              I've been seeking kind of plugin for Qt Creator, not writing anything in any files. It seems nothing appeared yet. I am starting new project right now, and there are tradition - at the start line of every new project checking abilities and solutions that will make life easy. For this matter seems nothing new.

              mrjjM 1 Reply Last reply
              0
              • B bogong

                I've been seeking kind of plugin for Qt Creator, not writing anything in any files. It seems nothing appeared yet. I am starting new project right now, and there are tradition - at the start line of every new project checking abilities and solutions that will make life easy. For this matter seems nothing new.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @bogong
                Since you ask about something not for qmake.
                What tool do you then use?
                It should offer the same features as qmake.

                1 Reply Last reply
                2

                • Login

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