Commit Graph

148 Commits

Author SHA1 Message Date
Martchus 472e32bfc2 Apply cmake-format 2023-09-11 21:20:43 +02:00
Martchus 56865f3a89 Add one hard-coded fallback search paths for icon themes
The `CMAKE_INSTALL_DATAROOTDIR` variable might be overridden by the project
to point to some custom location (e.g. `share/games` instead of `share`)
but this doesn't mean we will be able to find icons there.

Since icons are almost always under `/usr/share/icons` it makes sense to
add that location as one last hard-coded fallback to avoid having to
specify `BUILTIN_ICON_THEMES_SEARCH_PATH` in that common case.
2023-09-06 17:32:53 +02:00
Martchus f5d99397ff Avoid CMake deprecation warning by bumping version 2023-07-23 21:18:51 +02:00
Martchus a6a64aa429 Make warning about missing Qt translations dependent on BUILTIN_TRANSLATIONS_OF_QT 2023-07-03 21:58:18 +02:00
Martchus 96f10766d4 Enable web view support only by default if Qt WebEngine is present
The web view is only an optional enhancement in my applications so having
the support disabled is rather common. So for a better out-of-the-box
experience when configuring my projects it makes sense not having to
disable web view support explicitly if Qt WebEngine is not installed
anyways.
2023-06-10 18:08:13 +02:00
Martchus 6e4ea3652c Build CLI wrappers for Qt applications by default
Most of my Qt apps provide at least a basic CLI as well so providing the
CLI wrapper by default makes most sense.
2023-05-07 21:41:47 +02:00
Martchus 8642f14bb1 Apply clang-format and cmake-format 2023-03-25 18:50:08 +01:00
Martchus 5430edc5fc Avoid running expensive icon-bundling code on every CMake re-configuration 2023-03-23 22:08:57 +01:00
Martchus 0e151b3cc6 Avoid relying on external tool for working around CMake's broken `REALPATH` 2023-03-23 21:48:59 +01:00
Martchus c2bd68824c Workaround broken `get_filename_component(... REALPATH)` on Windows
See https://gitlab.kitware.com/cmake/cmake/-/issues/17206
2023-03-16 00:50:50 +01:00
Martchus dd3ae7b32b Make search path for icon themes configurable 2023-03-16 00:48:11 +01:00
Martchus 647ad121a5 Improve setting default icon theme
* Set the default icon theme when applying Qt settings and the "system"
  theme is supposed to be used but none could be determined by Qt
    * Use a bundled icon theme depending on whether the current palette is
      light or dark
* Apply the default not only under Windows anymore; supposedly this makes
  sense under any platform where Qt cannot determine the icon theme for us
2023-03-15 21:27:04 +01:00
Martchus 752c8cdc71 Link builds using static Qt also against Wayland shell integration plugins
These are required; the Wayland integration plugin alone is not sufficient.
2022-05-02 20:15:07 +02:00
Martchus 8a4b865c28 Improve linking against static Qt plugins
* Detect a static Qt build and link against Qt plugins automatically in
  that case (without the necassity to set `STATIC_LINKAGE`)
* Add offscreen support on UNIX platforms as it is useful for testing on
  headless systems
* Add wayland support if available
* Populate `QT_TEST_LIBRARIES` in case we're not building an app because
  the plugins are still required when building tests
2022-04-28 21:42:33 +02:00
Martchus b3896eb65e Check for relative paths also under install prefix
In the "normal" case none of the other variables are set
and thus relative paths (e.g. for the plugin directory)
cannot be resolved. This should still work when
CMAKE_FIND_ROOT_PATH is set beause we still check within
the other locations.
2021-11-04 23:22:26 +01:00
Martchus 9b559b153c Fix TLS support for static builds when using Qt 6.2.0 or newer
This Qt release "pluginized" the backends for TLS support so we need to
make sure to link against at least one TLS plugin since all of my
applications which use Qt Network expect TLS to work.
2021-10-02 19:39:51 +02:00
Martchus b51ac8c322 Improve comments for configuring Qt style plugins 2021-10-02 19:28:54 +02:00
Martchus 7c7704e4e5 Add `#include <QtWebEngineWidgetsVersion>` to `webviewincludes.h.in`
Used in Syncthing Tray to distinguish between Qt 5 and Qt 6.
2021-08-07 18:30:01 +02:00
Martchus 67e3d8b4af Apply cmake-format 2021-07-03 19:14:24 +02:00
Martchus 7765e6f062 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:14:13 +02:00
Martchus 7792012916 Avoid error with CMake < 3.12 2021-04-06 18:11:21 +02:00
Martchus 4cadb04b44 Apply CMake format 2021-03-20 21:01:24 +01:00
Martchus 5960c21558 Fix finding linguist tools macro when cross compiling with Qt 5
When cross compiling with Qt 5 the QT_HOST_PATH variable might
be set as well but the module might not be installed within the
host path. So let's do the usual lookup first and fallback to
QT_HOST_PATH only if that doesn't work.
2021-01-06 23:44:09 +01:00
Martchus d6ea2ac378 Apply cmake-format and clang-format 2020-12-20 17:56:35 +01:00
Martchus 746615e21e Make loading LinguistTools module work when cross-compiling with Qt 6 2020-12-19 20:58:29 +01:00
Martchus 7183ec501c Disable auto-inclusion of QML plugins
because these seem to pull in unwanted dependencies like PostgreSQL
2020-12-10 19:19:02 +01:00
Martchus 9bc3555c99 Resolve QT_INSTALL_TRANSLATIONS via CMAKE_PREFIX_PATH if it is relative
The variables provided by Qt 6 might just contain a relative path. This
change adds an extra function resolve these via CMAKE_PREFIX_PATH and
CMAKE_FIND_ROOT_PATH.
2020-11-11 18:51:19 +01:00
Martchus d80302d20d Make list of Qt's translations even if not available at build time
We shouldn't require translations to be installed at build time to know for
which repositories translations need to be loaded at runtime.
2020-11-11 18:11:43 +01:00
Martchus d61f32a635 Allow to disable built-in translations for Qt's own translations 2020-11-11 18:08:02 +01:00
Martchus 0a67d7dc15 Avoid hard-coding Qt version 2020-11-07 22:05:54 +01:00
Martchus 0f05beebd8 Cope with CMAKE_FIND_ROOT_PATH containing more than one path
According to the documentation CMAKE_FIND_ROOT_PATH is a list.
2020-11-07 22:02:10 +01:00
Martchus f59c2cb643 Fix detecting QXcbIntegrationPlugin
The variable QT5_Gui_STATIC_PREFIX is no longer used.
2020-11-07 21:58:54 +01:00
Martchus 09ff2d00b1 Replace META_QT5_VERSION with version-agnostic META_QT_VERSION 2020-11-07 21:38:18 +01:00
Martchus deb9b4467f Look for Svg plugins within the Gui module's directory as well
In Qt 5  these plugins were loaded as part of the Svg module (at least with
my patches). With Qt 6 (for which I've dropped my patches) we need to
include the plugin's config file manually.
2020-11-07 21:38:18 +01:00
Martchus 89152bdbe9 Fix passing arguments when configuring Qt plugins 2020-11-03 18:32:35 +01:00
Martchus 75b992bfd1 Don't install translations if built-in anyways 2020-10-30 22:45:56 +01:00
Martchus 4f06492306 Apply cmake-format 2020-10-10 00:50:40 +02:00
Martchus 15c884153a Allow building for Android with latest NDK, Qt 5 and CMake
* Making an Android APK should now generally work with NDK r21.d and
  Qt 5.15.1 and CMake 3.18 although some details might still need tweaking
* It is now supposed to be used within the NDK's toolchain instead of
  CMake's built-in Android support (which makes problems with newer NDK
  versions)
* The old way to lookup/pass variables is preserved so it should still
  work with older Qt versions and CMake's built-in Android support
* Qt's own support for invoking androiddeployqt needed to be disabled
  because it lead to CMake errors (see comment)
2020-10-05 18:37:23 +02:00
Martchus cb3a4960e7 Support Qt 6 (commit 174154b) 2020-09-04 00:44:48 +02:00
Martchus 9b7ad3375c Avoid hard-coding Qt version in function invocations
* Make use of "Version-less CMake targets", see
  https://www.qt.io/blog/versionless-cmake-targets-qt-5.15
* Keep fallbacks for compatibility with Qt < 5.15
* Remove some other occurrences of hard-coded Qt versions
2020-04-27 23:47:08 +02:00
Martchus 54e8ef75cd Fix comments mentioning qtconfig.h
There is a separate Qt-specific header since v6.
2020-03-17 19:56:32 +01:00
Martchus d33cf13923 Apply cmake-format 2020-03-08 13:51:36 +01:00
Martchus 031378e1c5 Fix remaining install dirs to use GNUInstallDirs consistently 2020-02-13 11:43:29 +01:00
Martchus fc76422d01 Use GNUInstallDirs
See https://github.com/Martchus/cpp-utilities/issues/17
2020-02-01 00:01:37 +01:00
Martchus e55ae3686b Require CMake 3.3.0 in all modules 2020-01-10 18:01:27 +01:00
Martchus ca081697df Reformat CMake scripts against cmake-format 0.6.3 2019-12-15 19:27:26 +01:00
Martchus b8d00d27c9 Apply cmake-format v0.6.0 2019-11-30 17:58:56 +01:00
Martchus a635b38e73 Apply CMake format 2019-10-12 19:00:24 +02:00
Martchus dbc5a18801 Allow setting custom app ID and label via CMake args
So one can produce different configurations/versions/flavors of
the app which can be installed at the same time.
2019-08-22 01:05:45 +02:00
Martchus 5f115b4918 Require META_ANDROID_PACKAGE_NAME for making Android APKs 2019-08-22 01:03:53 +02:00