Open hwhsu1231 opened 2 years ago
Well, conan-center has some rules about package folder layout: https://github.com/conan-io/conan-center-index/blob/10aad636633cf0a2fa4ae9c3c6b1ecf38d270e9d/docs/error_knowledge_base.md#kb-h013-default-package-layout. Making an exception is possible, but we need a strong reason, for exemples if it makes the package not usable.
@ericLemanissier Here is a problem I encountered.
On Windows platform, it is required to copy *.dll
files to the output directory when using "x:shared": true
option. Therefore, Conan provides us to use imports()
method in conanfile.py
or imports
section in conanfile.txt
. The following is an example of conanfile.py
I currently use:
However, it is NOT enough to just copy *.dll
files for Qt. According to my situations, I also need to copy platforms
and styles
folder into the output directory. However, the locations of these two folders are NOT the same in Qt5 and Qt6 installed from ConanCenter. Which means:
For Qt5, src="res/archdatadir/plugins"
for styles*
and platforms*
folder.
For Qt6, src="bin/archdatadir/plugins"
for styles*
and platforms*
folder.
If I want to make my project compatible with both Qt5 and Qt6. That would be a problem.
Can you try to use windeployqt instead of doing the copy manually ?
Edit : I also agree that the folder layout has to be unified. Don't hesitate to make a PR on qt5 putting archdatadir
in bin
instead of res
There is a bigger issue with this. Those folders are not only used to place files on the disk, but they are also put inside Qt6/Qt5Core.dll here. Then QCoreApplication::libraryPaths()
has a special logic to locate Qt plugins (platform, styles, etc) which are loaded dynamically during application startup. This logic can be found here and in QLibraryInfo::path. You can see that Qt code is looking for Qt plugins in the path given by qt_configure_strs
relative to the location of the Qt6Core.dll, and it is also looking directly in the directory where Qt6Core.dll is located. Same thing with the Qt5.
For example in the screenshot above Qt from conan will search for platform plugins in folders:
Qt form official installer will instead search in folders:
This is an important thing to consider when deploying a Qt application, and I think introducing such difference inside a conan package is a bad idea.
Problem Descriptions
Take
plugins
folder for example.I noticed that
In Qt5 installed by Official Installer, the
plugins
is in "${env:QT_ROOT_DIR}
":In Qt6 installed by Official Installer, the
plugins
is in "${env:QT_ROOT_DIR}
":However,
In Qt5 installed from ConanCenter, the
plugins
is in "${env:QT_ROOT_DIR}\res\archdatadir
":In Qt6 installed from ConanCenter, the
plugins
is in "${env:QT_ROOT_DIR}\bin\archdatadir
":Obviously, the locations of
plugins
folder are different from Qt5 and Qt6 installed from ConanCenter. Not to mention that they are all different from the location of it installed from Official Installer.I think it had better followed the structure of Qt Official. At least, Qt5 and Qt6 should use the same structure.
Screenshots