lmms icon indicating copy to clipboard operation
lmms copied to clipboard

Add better Qt5 detection

Open tresf opened this issue 7 years ago • 6 comments

Making a cmake project with Qt5 dependencies can vary in difficulty depending on how Qt5 was obtained.

For example:

  • On Linux, Qt5 is usually offered from a package manager, such as apt or dnf, but it's also quite common to install Qt5 manually into /opt/.
  • On Mac, Qt5 is usually fulfilled by homebrew or macports however it is also fairly common to install from the QtCreator desktop installer.
  • On Windows, Qt5 is usually installed directly from the QtCreator desktop installer, but may also be obtained from msys2.
    • Windows makes this even harder because QtCreator comes bundled with various C++ compatible versions including mingw, MSVC 2015 32-bit, MSVC 2015 64-bit, etc. You need to know your exact compiler version and manually add that each time you build a project using cmake.

What this PR aims to do is allow cmake .. to find Qt5 without a hassle on the most common build environments. This means the average developer should never need to type brew --prefix qt5 or export CMAKE_PREFIX_PATH=/path/to/qt5 again, although that "normal" technique will still remain to be supported.

Usage

INCLUDE(FindQt5All)
FIND_PACKAGE(Qt5Core REQUIRED)

Progress

OS Source Module Working
Linux from package manager FindQt5Linux.cmake
Linux from 3rd-party ppa FindQt5Linux.cmake
Linux from qt.io FindQt5Linux.cmake
Windows from QtCreator + MSVC FindQt5Windows.cmake
Windows from QtCreator + mingw FindQt5Windows.cmake
macOS from QtCreator FindQt5Apple.cmake
macOS from homebrew FindQt5Apple.cmake
macOS from macports FindQt5Apple.cmake

Additional Modules

Some detection techniques include parsing of command output (e.g. EXECUTE_PROCESS(...)), so an additional module has been added EnglishLocale.cmake.

Usage:

INCLUDE(EnglishLocale)
USE_ENGLISH_LOCALE()  # SET COMMANDS TO USE ENGLISH STANDARD OUTPUT
EXECUTE_PROCESS(...)
USE_DEFAULT_LOCALE()  # RESET COMMAND ENVIRONMENT BACK TO NATIVE LOCALE

This PR is a work in progress and should be merged once the most common platforms have been completed.

tresf avatar Dec 23 '17 06:12 tresf

@tresf What's the status of this PR?

PhysSong avatar Oct 23 '19 02:10 PhysSong

@tresf What's the status of this PR?

Stalled. 😄

Seriously though:

  1. There are unrelated changes in here, like the SDL and FFTW include dirs and the AppVeyor stuff. They can probably be removed.
  2. Someone that actually develops on Windows using master should help with the various Qt detection environments. Does vcpkg handle Qt detection? How do people do it?
  3. macOS really needs this PR as it's stupid to keep typing export CMAKE_PREFIX_PATH=$(brew --prefix qt5) every time I build.
  4. Linux, I have no idea and it's probably a good candidate for the back burner considering Linux often just uses the repo version of Qt (versus Win/Mac which download it manually most of the time).

I don't have the time to dedicate to this right now, but the code is good, even if as a reference point for someone else to run with hit.

tresf avatar Oct 23 '19 03:10 tresf

:robot: Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! :tophat:

Linux

Windows

macOS

:robot:
{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://output.circle-artifacts.com/output/job/a6b6904b-21fa-41ef-9531-b93d53fd7553/artifacts/0/lmms-1.3.0-alpha.1.225+g9caf35e64-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17853?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://output.circle-artifacts.com/output/job/2b65ef87-bb1e-4b0b-a4df-bb6e01616a55/artifacts/0/lmms-1.3.0-alpha.1.225+g9caf35e64-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17852?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://output.circle-artifacts.com/output/job/e07bd744-6539-4de2-ab75-497d4e00f022/artifacts/0/lmms-1.3.0-alpha.1.225+g9caf35e64-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17855?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/3vxmr46kc8ctjmbk/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44323790"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/9yevxhlnb8vmwib0/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44323790"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://output.circle-artifacts.com/output/job/16d19b1c-6cac-4d7f-9488-7f7f9dc132a4/artifacts/0/lmms-1.3.0-alpha.1.225+g9caf35e64-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17851?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "25cb65ac5188df2da27127705b68d1736621f539"}

LmmsBot avatar Jul 30 '22 03:07 LmmsBot