Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved Duplicated files when deploying an app (.pro problem)

    General and Desktop
    4
    9
    288
    Loading More Posts
    • 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.
    • ivanicy
      ivanicy last edited by

      Hello!

      I have this .pro file:

      #-------------------------------------------------
      #
      # Project created by QtCreator 2019-04-25T09:46:39
      #
      #-------------------------------------------------
      
      QT       += core gui
      QT       += multimedia
      CONFIG   += c++14
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = sw_myApp
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which has been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      CONFIG ( debug, debug|release) {
          # DEBUG MODE -----------------------------------------------------------------------------------------------
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Ole32.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\BluetoothApis.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\SetupAPI.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Hid.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Iphlpapi.lib"
      
          LIBS += "$$PWD\..\..\modulos\opencv_cuda_4_0_0\lib\Debug\opencv_world400d.lib"
      
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvStream64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvBuffer64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvGenICam64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvDevice64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvBase64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvSerial64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvGUI64_VC11.lib"
          LIBS += "$$PWD\..\..\modulos\DocxFactory\lib\DocxFactory.lib"
      
          LIBS += "$$PWD\..\..\modulos\fieldtalk\lib\libmbusslave.lib"
      
          LIBS += "$$PWD\..\..\modulos\openssl\lib\*.lib"
      
          LIBS += "$$PWD\..\..\modulos\ffmpeg\lib\*.lib"
      
          LIBS += "$$PWD\..\..\modulos\open62541\lib\*.lib"
          LIBS += "$$PWD\..\..\modulos\mbedtls\lib\*.lib"
          LIBS += "$$PWD\..\..\modulos\opcua_sdk\lib\debug\*.lib"
          LIBS += "$$PWD\..\..\modulos\libxml2\out32dll.dbg\*d.lib"
      
          LIBS += "$$PWD\..\..\modulos\libcurl\lib\*.lib"
      
          #Dinamicas
          DESTDIR_WIN = $${OUT_PWD}\\debug
          DESTDIR_WIN ~= s,/,\\,g
          WIN_OPENCV = $${PWD}\\..\\..\\modulos\\opencv_cuda_4_0_0\\bin\\Debug\\*.dll
          WIN_OPENCV ~= s,/,\\,g
          CONNFIGURATION = $${PWD}\\..\\..\\modulos\\configuration\\*
          CONNFIGURATION ~= s,/,\\,g
          WIN_OPENSSL = $${PWD}\\..\\..\\modulos\\openssl\\bin\\*.dll
          WIN_OPENSSL ~= s,/,\\,g
          WIN_FFMPEG = $${PWD}\\..\\..\\modulos\\ffmpeg\\shared\\*.dll
          WIN_FFMPEG ~= s,/,\\,g
      
      } else {
          # RELEASE MODE ---------------------------------------------------------------------------------------------
      
          LIBS += "$$PWD\..\..\modulos\opencv_cuda_4_0_0\lib\Release\opencv_world400.lib"
      
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Ole32.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\BluetoothApis.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\SetupAPI.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Hid.lib"
          LIBS += "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\Iphlpapi.lib"
      
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvStream64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvBuffer64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvGenICam64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvDevice64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvBase64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvSerial64.lib"
          LIBS += "$$PWD\..\..\modulos\pleora\lib\x64\PvGUI64_VC11.lib"
          LIBS += "$$PWD\..\..\modulos\DocxFactory\lib\DocxFactory.lib"
      
          LIBS += "$$PWD\..\..\modulos\fieldtalk\lib\libmbusslave.lib"
      
          LIBS += "$$PWD\..\..\modulos\openssl\lib\*.lib"
      
          LIBS += "$$PWD\..\..\modulos\ffmpeg\lib\*.lib"
      
          LIBS += "$$PWD\..\..\modulos\open62541\lib\*.lib"
          LIBS += "$$PWD\..\..\modulos\mbedtls\lib\*.lib"
          LIBS += "$$PWD\..\..\modulos\opcua_sdk\lib\release\*.lib"
          LIBS += "$$PWD\..\..\modulos\libxml2\out32dll\*.lib"
      
          LIBS += "$$PWD\..\..\modulos\libcurl\lib\*.lib"
      
          #Dinamicas
          DESTDIR_WIN = $${OUT_PWD}\\release
          DESTDIR_WIN ~= s,/,\\,g
          WIN_OPENCV = $${PWD}\\..\\..\\modulos\\opencv_cuda_4_0_0\\bin\\Release\\*.dll
          WIN_OPENCV ~= s,/,\\,g
          CONNFIGURATION = $${PWD}\\..\\..\\modulos\\configuration\\*
          CONNFIGURATION ~= s,/,\\,g
          WIN_FFMPEG = $${PWD}\\..\\..\\modulos\\ffmpeg\\shared\\*.dll
          WIN_FFMPEG ~= s,/,\\,g
      }
      
      copyfiles.commands = $$quote(cmd /c xcopy /S /I /Y $${WIN_OPENCV} $${DESTDIR_WIN} &\
                                   cmd /c xcopy /S /I /Y $${CONNFIGURATION} $${DESTDIR_WIN} &\
                                   cmd /c xcopy /S /I /Y $${LIBCUDA} $${DESTDIR_WIN} &\
                                   )
      
          QMAKE_EXTRA_TARGETS += copyfiles
          POST_TARGETDEPS += copyfiles
      
          isEmpty(TARGET_EXT) {
              TARGET_CUSTOM_EXT = .exe
          } else {
              TARGET_CUSTOM_EXT = $${TARGET_EXT}
          }
      
          DEPLOY_COMMAND = windeployqt
      
          CONFIG( debug, debug|release ) {
              # debug
              DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
          } else {
              # release
              DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
          }
      
          #Uncomment the following line to help debug the deploy command when running qmake
          #warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})
      
          QMAKE_POST_LINK = $${DEPLOY_COMMAND} $${DEPLOY_TARGET}
      
      SOURCES += $$files(Interface/*.cpp)
      
      HEADERS += $$files(Interface/*.h)
      
      FORMS += $$files(Interface/*.ui)
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      RESOURCES += resources.qrc \
      

      When I compile it on release mode, Qt duplicates some files and libraries:

      build--sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release

      -debug
      -release (<-- Normal execution folder)
      ...
      ... (<-- Files duplicated in this path)

      a2e5689e-60b1-4eff-84b1-6b075a9cb51f-image.png

      I marked some duplicated files in the image. This files must be only in the release folder. How can I fix it?

      Thank you very much!

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @ivanicy last edited by

        @ivanicy Do you mean you have same files in sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release and in sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release/Release?
        Did you try to delete the complete build directory (sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release) and rebuild?

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

        ivanicy 1 Reply Last reply Reply Quote 0
        • ivanicy
          ivanicy @jsulm last edited by

          @jsulm Yes, this is my problem. I only want this files in "sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release/Release" I deleted the directory but this files appear again.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi,

            What happens is exactly what is written in your .pro file. You have a copyfiles command that is executed after the build.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            ivanicy 1 Reply Last reply Reply Quote 2
            • ivanicy
              ivanicy @SGaist last edited by ivanicy

              @SGaist So, where should that command be? Maybe inside the CONFIG that discerns between release and debug?

              aha_1980 1 Reply Last reply Reply Quote 0
              • aha_1980
                aha_1980 Lifetime Qt Champion @ivanicy last edited by

                @ivanicy said in Duplicated files when deploying an app (.pro problem):

                @SGaist So, where should that command be? Maybe inside the CONFIG that discerns between release and debug?

                Here?

                copyfiles.commands = $$quote(cmd /c xcopy /S /I /Y $${WIN_OPENCV} $${DESTDIR_WIN} &\
                                             cmd /c xcopy /S /I /Y $${CONNFIGURATION} $${DESTDIR_WIN} &\
                                             cmd /c xcopy /S /I /Y $${LIBCUDA} $${DESTDIR_WIN} &\
                                             )
                

                Regards

                Qt has to stay free or it will die.

                ivanicy 1 Reply Last reply Reply Quote 0
                • ivanicy
                  ivanicy @aha_1980 last edited by

                  @aha_1980 @SGaist But, DESTDIR_WIN contains sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release/Release path. Why it copy the files in the father's path?

                  aha_1980 1 Reply Last reply Reply Quote 0
                  • aha_1980
                    aha_1980 Lifetime Qt Champion @ivanicy last edited by

                    @ivanicy said in Duplicated files when deploying an app (.pro problem):

                    DESTDIR_WIN contains sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release/Release path.

                    Are you sure?

                    Qt has to stay free or it will die.

                    ivanicy 1 Reply Last reply Reply Quote 0
                    • ivanicy
                      ivanicy @aha_1980 last edited by

                      @aha_1980 Yes, I put

                      message("DESTDIR_WIN:        $$DESTDIR_WIN")
                      

                      before the copyfiles and it gives me this;

                      DESTDIR_WIN:        C:\Ivan\Proyectos\sw_myApp\build-sw_myApp-Desktop_Qt_5_11_2_MSVC2017_64bit-Release\release
                      
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post