Duplicated files when deploying an app (.pro problem)
-
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) 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!
-
@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? -
Hi,
What happens is exactly what is written in your .pro file. You have a copyfiles command that is executed after the build.
-
@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
-
@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?