cmake: Modernize (and fix) deployment on macOS For the past decade or so, we have used a bunch of self-written python and bash scripts for creating packages for macOS. These have not aged well, and recently several workarounds had to be hacked in to keep the machinery somewhat working at all. Still, invoking the scripts at build time rather than install time caused a race condition where sometimes not all the packages would be created in CI. To break the camel's back, deploying dependencies no longer worked correctly and broke the packages completely in 0.14-rc1. Fix this by modernizing the whole deployment process and related parts of the build system, replacing the custom scripts by relying on Qt's and CMake's own tooling instead. Some workarounds still need to be added to that to make everything work correctly (neither tool can deal correctly with QtWebEngine, for some reason, and CMake's Info.plist template lacks functionality), but the main part of the work is now delegated to official tooling, everything properly happend at install time avoiding race conditions in the build process, and we can remove a bunch of decade-old and hardly maintained custom code. Also adapt the CI configuration to use -DBUNDLE instead of the old -DDEPLOY, and remove the explicit setting of qmake's path too, as it is no longer needed now.
cmake: Determine minimum deployment target for Qt The minimum version of macOS supported by Qt may differ from the one provided by the Xcode SDK in use. If started on a macOS that is older than the minimum version indicated by Qt, the application might crash. Qt's minimum deployment target is not available directly as a define, variable or CMake/qmake property, but can be extracted from qmake using a rather stupid hack. Use this to set a cache variable that will be used in subsequent commits when generating the package's Info.plist file.
cmake: Allow deprecation warnings In recent releases, Qt deprecated a whole bunch of APIs, probably in preparation of the advent of Qt 6. Unfortunately, avoiding those is not straightforward, since Quassel has to support a broad range of older Qt releases, and not all deprecated APIs are easy to replace in those older versions. Some APIs, such as bearer management, don't even have a replacement yet. Since Qt 5.13, deprecation warnings cannot be disabled at all. To avoid breaking the CI builds, make deprecation warnings non-fatal even if FATAL_WARNINGS is enabled. This allows us to remove the WARN_QT_DEPRECATION option, which only had an effect when building against Qt < 5.13 anyway, and unconditionally enable the warnings when compiling with GCC or Clang. For MSVC, disable deprecation warnings completely, since there seems to be no way to selectively make warnings non-fatal, and we still want to fail for anything other than deprecations. Disable the use of APIs completely that were deprecated in Qt 5.5 (our current baseline) or earlier to prevent accidental use. This threshold can be raised in the future as we can rely on newer Qt versions and modernize affected code.
ssl: Remove HAVE_SSL define With fallback code for missing SSL support removed from the code base, the HAVE_SSL define is no longer needed.
ssl: Require SSL support in Qt There is no sane reason for not using SSL in the year 2020, plus every distro should be shipping the Qt libraries with SSL support enabled. Thus, make it mandatory for Quassel, too. Going forward, this allows us to remove lots of fallback code paths that make the code much more complex in many places, and that have not been tested (or even been built) in a long time.
Remove debug console and QtScript, which was deprecated with Qt5 - reduces dependencies, allows building quasselcore on most distros without pulling in X11 - removes unused code and dependencies, reduces size
Add a flag to enable Qt deprecation warnings on Qt < 5.13
cmake: fix build on MSYS2 Some minor changes to allow building easily on MSYS2: - don't check for snorenotify on MSYS2 because it segfaults on startup - don't use -fstack-protector-strong (libssp) on MinGW because it currently causes segfaults during static initialization https://sourceforge.net/p/mingw-w64/bugs/755/ - use the `cat` command to read files when using the 'MSYS Makefiles' generator, and not the cmd.exe `type` command - update doc for the quassel_add_module function wrt. 7d0879ab Tested to build correctly on MSYS2 with both the 'MSYS Makefiles' generator and the Ninja generator using a native ninja. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
cmake: Lower Boost dep version 1.56 -> 1.54 Require Boost 1.54 instead of 1.56. Tested to compile and work correctly on OpenSUSE Leap 42.3. Fixes #1510. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
cmake: Add ENABLE_SHARED option, default ON Add an ENABLE_SHARED option, defaults to ON, when set to OFF quassel_add_module() will build modules as static (does not affect platforms where modules would be built as static anyway.) The option name ENABLE_SHARED is frequently used for this purpose in cmake. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
cmake: Create imported target for Boost, if it doesn't exist yet Older versions of CMake's FindBoost.cmake don't create imported targets for the library. Create it ourselves if necessary.
cmake: Allow to make compile warnings fatal Failing on any compile warning is very useful in CI builds, so add an option for enabling this. The option defaults to OFF, because we don't want to annoy users that don't want this. Enable fatal warnings in Travis CI.
cmake: Move version setup into a separate .cmake file Introduce a new QuasselVersion.cmake that contains the hard-coded version, as well as the code for retrieving version information from git (if available). This file also sets up version.h with the given information. Remove the corresponding code from the main CMakeLists.txt. Output the git revision at configure time if available, which helps when analyzing build logs.
cmake: Consolidate compile settings Consolidate the various places where we were setting compiler options in QuasselCompileSettings.cmake. No longer include KDE's settings; instead, take some inspiration from their setup and incorporate this in our own, so we not only benefit when building against KDE Frameworks. Properly handle CMAKE_CXX_FLAGS and friends; append the flags to the end of our own list of flags, so one can override what we define. Clear the variables afterwards to avoid duplication. Get rid of some MinGW options that have been around for a decade and are most likely no longer required.
cmake: Add build-time dependency to Boost 1.56 We'll be using some Boost features in the future, so prepare the build system to reflect that dependency.
tests: Convert ExpressionMatchTests into a GTest-based test case As first contender for the newly introduced test framework, use the recently added ExpressionMatchTests class. Convert to use GTest, and move into the new home for Quassel unit tests (the tests/<module>/ directory). With this, "make test" (or "ninja test") actually does something if Quassel is configured with -DBUILD_TESTING=ON.
test: Add build system support and a main function for unit tests Add a new CMake option BUILD_TESTING (defaults to OFF) that, if enabled, will build unit tests and related requirements. Add a new library Quassel::Test::Main that provides a main function for test cases. Add a new CMake macro quassel_add_test for making the adding of test cases convenient by hiding most of the boilerplate. Test cases should #include "testglobal.h", so they automatically have access to GTest/GMock macros as well as the imported main function.
cmake: Build shared libraries The days of static builds are finally over. Build dynamic libraries for all Quassel modules. Let CMake handle the RPATH in a way that doesn't cause inconvenience; always set an RPATH in the build tree so the correct libraries are loaded, and also set an RPATH for installed binaries unless they go into a system location. Also define output directories for all build artifacts.
cmake: Modernize cmake support for LDAP Use a more modern, property-based find script for the LDAP libraries and get rid of the deprecated use of LDAP_LIBRARIES and similar variables in favor of a namespaced Ldap::Ldap target. Set package properties for better diagnostic output at configure time.
cmake: Reorganize package finding Use COMPONENTS to find required Qt5 modules in one go. Don't look for QtWebKit if we already have QtWebEngine. Look for Sonnet explicitly even when using KDE Frameworks, because we're using its config widget and shouldn't rely on transitivity here. Only look for LDAP when building the core (or mono client). Add QUIET everywhere to avoid spammy CMake warnings for optional packages. Add some diagnostic output indicating the versions of Qt and KF5.