Commit Graph

107 Commits

Author SHA1 Message Date
Alexandru Croitor
42d3b21c92 Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.

Third party projects that require just these tools, and not the Qt
modules themselves,  should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.

It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.

Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.

This commit also changes the behavior regarding when to build tools
while building Qt itself.

When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.

When not cross compiling, tools added by add_qt_tool are built from
source.

When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.

Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.

Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr  -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools

Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:30 +00:00
Alexandru Croitor
15f5a347fe Add a debug suffix to libraries and plugins on macOS and Windows
This is especially important on macOS when doing a debug build,
because QPluginLoader is looking for the cocoa QPA plugin
suffixed with "_debug" when executing a test or example.

Change-Id: Ief23b3a82c567c16ab9dd30d04d1729031262d7d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-02 13:32:38 +00:00
Albert Astals Cid
a25f9a1507 cmake: Start adding compiler flags
Only has warnings for now

Next to come is the support for developer-build and enabling Werror

Change-Id: I8070dc06eb439c2a03007cce975c8147ff7e1582
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-21 13:51:19 +00:00
Albert Astals Cid
632d014afd cmake: set a CMAKE_BUILD_TYPE if none was specified
Because the default "empty" CMAKE_BUILD_TYPE is a weird default

Change-Id: I5768f67aa85dce4108e421d2f4eacdfb1cb5beb0
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-21 13:51:05 +00:00
Simon Hausmann
d61b6ea30a Add support for building conveniently with ccache
Pass -DQT_USE_CCACHE=ON to enable the use of ccache. This avoids having
to set up symlinks, which is useful when cross-compiling against
different targets.

Change-Id: I023fff105baaa538730997948aa122d2678887ce
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-19 08:59:12 +00:00
Simon Hausmann
0867dbf2f4 Fix finding syncqt when "cross compiling"
This is not quite the correct design yet, but makes the existing
mechanism work first.

Change-Id: Idbc6f1380adc955a772eb6e5beb6b3a5f7f686bb
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-12 14:02:03 +00:00
Simon Hausmann
e9c45bbddd Begin port of qtbase to CMake
Done-by: Alexandru Croitor <alexandru.croitor@qt.io>
Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-by: Kevin Funk <kevin.funk@kdab.com>
Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Done-by: Simon Hausmann <simon.hausmann@qt.io>
Done-by: Tobias Hunger <tobias.hunger@qt.io>
Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-by: Volker Krause <volker.krause@kdab.com>
Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-11-01 11:48:46 +00:00