Currently I'm trying to deploy a Qt application for Windows using MinGW and CMake from Linux. I used MXE to prepare building environment (install mingw32 and compile Qt5 shared libraries). I've written CMakeList.txt and a toolchain script, and they build my application OK.
The thing I can't achieve is to deliver shared Qt dlls to my built executable.
Here is my Toolchain file: http://pastebin.com/gh7kSda4
This is my CMakeLists.txt: http://pastebin.com/wHA7f7Sj
Here is the excerpt from that script, containing the installation part:
# Installation.
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${TOOLCHAIN}-Bundle)
install(TARGETS mEyeSaver
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/mEyeSaver${TOOLCHAIN_EXECUTABLE_FORMAT}\" \"\" \"${QT5_PATH}/bin\")
" COMPONENT Runtime)
As you can see, I use fixup_bundle for achieving my goal.
After I type make install
I get the following output:
http://pastebin.com/DymaH1Mu
After that there is nothing except mEyeSaver.exe in the x86_64-w64-mingw32-Bundle
folder. No dlls were copied.
I'm sure there were needed Qt dlls in the ~/mxe/usr/x86_64-w64-mingw32.shared/qt5/bin
folder. But there is still something I'm doing wrong.
How to fix the problem? Thank you
Update
I've rethought what I'm doing and came to a point that maybe fixup_bundle just can't analyze dependencies for Windows executable, because Linux ldd (which it uses) has nothing to do with a Windows app. So I've edited my question.
Is there any easy way to get dependency libraries with CMake (or maybe another tool) for Windows executable without copying them directly?
objdump -p app.exe | grep DLL
(linux-tips.com/t/…). So you'll have to manually parse the output with your build script and copy the needed libraries, excluding ones likeKERNEL32.dll
. One important note is that you won't see deeper level dependencies of DLLs listed, so you'll also have to iterate through them recursively. – Turn