Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up QtCreator's package manager setup #5305

Merged
merged 7 commits into from
Jun 15, 2024
Merged

Conversation

hemirt
Copy link
Contributor

@hemirt hemirt commented Apr 7, 2024

Added a QtCreatorPackageManager.cmake that gets auto imported when using Qt>6 with CMake and "Package manager auto setup" option (by default) turned on.

In this file, options to skip the automatic packagae manager setup is set up.

Options to skip exclusively conan, or vcpkg, are also set to on for self-documentation for the user.

Contributors using Qt Creator should pick just one (or none) to use and disable the other one, just now by default all are disabled.

A general status message with information about this gets sent right at the start of cmake command (as the QtCreatorPackageManager.cmake is one of the earliest things Qt Creator runs).

https://www.qt.io/blog/qt-creator-cmake-package-manager-auto-setup

[Extra Notes]
Vcpkg seems like it's not configured well to use with Qt Creator - since it downloads qt (and/or builds it).
Conan might not have this "issue" but I did not test it out, since even the build of openssl or boost was taking well over 15 minutes already.

@hemirt hemirt force-pushed the master branch 2 times, most recently from 9a1281f to bcef9df Compare May 20, 2024 20:34
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contributors using Qt Creator should pick just one (or none) to use and disable the other one, just now by default all are disabled.

In my opinion, if you have installed Qt Creator, you should be using conan, because it doesn't bring in Qt but uses the version installed on the system. vcpkg will compile qt from source, which can take some time (and might conflict with some assumptions Qt Creator makes (?)). Furthermore, only conan is tested in CI (#4099).

Conan might not have this "issue" but I did not test it out, since even the build of openssl or boost was taking well over 15 minutes already.

Conan doesn't build boost anymore. Only OpenSSL is built from source (this takes some time on Windows because they refuse to support any other build tool than nmake).


Since we support both package managers, I think it's a good idea to include a QtCreatorPackageManager.cmake (compared to adding it to .gitignore). However, only conan should be enabled. If a user doesn't want to have the auto-setup, they can turn it off in the Qt Creator settings.


This PR should also include documentation changes (at least) in BUILDING_ON_WINDOWS.md.

QtCreatorPackageManager.cmake Outdated Show resolved Hide resolved
@hemirt
Copy link
Contributor Author

hemirt commented Jun 6, 2024

Conan now autoexecutes and downloads or builds the libraries (it builds zlib and openssl for me)

But when trying to run chatterino from qt creator, I get these errors

image

image

The folder build\Desktop_Qt_6_7_1_MSVC2019_64bit-Debug\bin where chatterino.exe is located is missing the libcrypto-3-x64.dll and libssl-3-x64.dll files.

If I copy the files from build\Desktop_Qt_6_7_1_MSVC2019_64bit-Debug\conan-dependencies\build\conan\bin (where these are the only two files), chatterino then starts.

(PS: this folder build\Desktop_Qt_6_7_1_MSVC2019_64bit-Debug\conan-dependencies\build\conan also contains the Chatterino2 folder mentioned in the conanfile again with only those two dlls)

I'm not sure if this is a problem with the conanfile, or the cmakelists file.

@pajlada
Copy link
Member

pajlada commented Jun 8, 2024

This PR works for me - I don't get the error you get with missing openssl DLLs, my kit's Run configuration looks like this:
image

If I disable "Add build library search path to PATH", I get your error.

If I launch the exe without qt creator, I also get your error.

I think this is all acceptable.

Could you check if you have the "Add build library search path to PATH" disabled in your run configuration?

@hemirt
Copy link
Contributor Author

hemirt commented Jun 11, 2024

Could you check if you have the "Add build library search path to PATH" disabled in your run configuration?

I do have that checked. I can't launch the app inside Qt creator, nor outside it.
Did your configuration copy the libcrypto files into the bin folder next to the chatterino.exe?
chatterino2\build\Desktop_Qt_6_7_1_MSVC2019_64bit-Debug\bin
Mine does not.

Unchecking this setting did not change anything for me.

Maybe your build library search path (unsure what this variable is supposed to be) somehow has these openssl libraries?

Checking and unchecking this setting only seems to add C:\Qt\6.7.1\msvc2019_64\bin into the Path variable (in the environment section), though I already have this in my path variable (i.e. it's already in the Path variable shown value).

So if you get the same errors for the same libraries missing, I'm not sure whats going on, my only guess would be you already have openssl libraries in path, but in that case you would be getting missing qt libraries instead of libcrypto and libssl, is my guess. If you get the same libcrypto and libssl errors, then I'm not sure what or where is the problem.

@pajlada
Copy link
Member

pajlada commented Jun 15, 2024

My crypto DLLs are not added to the same directory as chatterino.exe is, no.
It seems my version of Qt creator (which was freshly installed at v13.0.2) handles adding conan to PATH before running chatterino.exe

image

@pajlada pajlada changed the title Skip conan and vcpkg autosetup when using QtCreator Clean up QtCreator's package manager setup Jun 15, 2024
@pajlada pajlada enabled auto-merge (squash) June 15, 2024 10:32
@pajlada pajlada merged commit 538bead into Chatterino:master Jun 15, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants