In Qt 5, qmake generates CMake Config files which expose the plugins
as imported libraries. The name of these libraries are derived from
the plugin class name. So QCocoaIntegrationPlugin, and not qcocoa.
To keep compatibility between Qt5 and Qt6 CMake target names,
the pro2cmake script should generate plugin target names based on the
plugin class names.
To avoid passing the same name in qt_add_plugin (target and CLASS_NAME),
derive the class name from the target if the class name is
not explicitly specified.
Also add a new OUTPUT_NAME parameter which is used to change the
final file name of the plugin, so that it's compatible with Qt5.
For example to generate a qcocoa.dylib file, instead of
QCocoaIntegrationPlugin.dylib file.
The same OUTPUT_NAME value will be used for generation of plugin .prl
files for qmake consumption.
Change-Id: I4d53e680d7beb62befecd359cdf6bba60a34ff0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This allows doing debug_and_release builds with Ninja on all
platforms.
The "Ninja Multi-Config generator" is available starting with CMake
3.17.
Desired configurations can be set via CMAKE_CONFIGURATION_TYPES.
Possible values: "Release, Debug, RelWithDebInfo, MinRelSize".
For example -DCMAKE_CONFIGURATION_TYPES="Release;Debug".
The first configuration is the 'default' configuration which is
built when calling ninja with no arguments.
To build all targets of a certain configuration use "ninja all:Release"
or "ninja all:Debug".
To build all targets in all configurations use "ninja all:all".
Note that the first configuration influences which configuration of
tools will be used when building the libraries for all configurations.
In simple terms, when configured with
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" the release version of moc
is used by AUTOMOC.
When configured with -DCMAKE_CONFIGURATION_TYPES="Debug;Release"
the debug version of moc is used by AUTOMOC.
Framework builds and Ninja Multi-Config don't currently work together
due to multiple bugs in CMake, which ends up generating an invalid ninja
file with duplicate rules. There are also issues with placement of the
debug artifacts.
This will be handled in a follow up patch after CMake is fixed.
Task-number: QTBUG-76899
Change-Id: If224adc0b71b7d1d6606738101536146aa866cd7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This manifested in Coin when ninja tried to build qdrawhelper_sse2.cpp
before the Core framework headers were copied, resulting in a
fatal error: 'qatomic.h' file not found.
Make sure every SIMD object library has all PRIVATE dependencies of
its parent library PRIVATE dependencies (except for other SIMD object
libraries), to make sure that the framework headers are copied by the
time the SIMD source file is compiled.
Here's an example for clarification. Gui_simd_sse2's LINK_LIBRARIES
property should have all the values of Gui's LINK_LIBRARIES property
(like Qt::Core) filtering out all SIMD object library targets (
like Gui_simd_sse2, Gui_simd_sse3, etc).
Thus we make sure the SIMD object libraries are built after Gui's
dependencies are built.
Note that using INTERFACE_LINK_LIBRARIES to avoid the filtering of SIMD
targets in the generator expression would only work in shared Qt builds.
In static Qt builds where PRIVATE dependencies become PUBLIC, CMake would
insert $<LINK_ONLY:Gui_simd_foo> entries in INTERFACE_LINK_LIBRARIES
which causes CMake to be confused and fail at generation time.
Change-Id: I246c1394b9c9830c0ebd11e6621e56b992a6a1f2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When running tests with CMake's CTest, set the environment
QT_TEST_RUNNING_IN_CTEST to 1. This can be useful to deal with tests
that do not properly work when running from CTest.
For instance, the qmake test in this patch has one test that only works
when not run from CTest.
Change-Id: I01eea9131de69c18118a9ed9f96e9296d5ea20f1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Framework builds are enabled by default on macOS.
They are controlled via the framework feature.
Task-number: QTBUG-75751
Change-Id: I00bc64672f02bbd1672508b2b5010d202984a961
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
Adds custom targets which take care of generating and installing
documentation files.
Every module has a global set of targets suffixed with the module
name in order for them to be unique when we implement super builds.
The targets are the same as the list below, but replace ${target}
with the module's name. Eg.: docs_qtbase.
For every target which has an qt_add_docs() call, we now create the
following set of custom targets:
* docs_${target}
* html_docs_${target}
* qch_docs_${target}
* prepare_docs_${target}
* generate_docs_${target}
* install_docs_${target}
* install_html_docs_${target}
* install_qch_docs_${target}
Fixes: QTBUG-75859
Change-Id: Ie84cb9a2dedbe7333d9a84f4d73383442deca477
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change-Id: Iba5104cccdc613f7b2cf0d1454209578adaac824
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
We can't use qt_internal_export_modern_cmake_config_targets_file for
executables like tools, because it's not possible to use
INTERFACE_LINK_LIBRARIES with executables like you can with libraries.
We also can't create aliases to non-global imported targets.
Instead create new imported executable targets, fish out the imported
location, and assign it to the versionless targets.
Task-number: QTBUG-74137
Task-number: QTBUG-80477
Task-number: QTBUG-75984
Change-Id: I6a3c9c67ef4699c72a6c9a627c63158dfd6557f8
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Otherwise if you configured a commit that has tool A, and the switch
to a commit where tool A does not exist anymore, reconfiguration
will fail.
Change-Id: Ibb244b9630a6f4fecd27d51ce28eceff07ba8666
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This patch adds a new bootstrap tool which will read CMake's
AutoGenInfo.json and ParseCache.txt to determine what the current
list of json files is that needs to be passed to moc --collect-json
option.
Right now this is enabled for qt_add_module() with the option
GENERATE_METATYPES. pro2cmake has also been updated to detect qmake's
CONFIG += metatypes and to generate the above option for modules.
The implementation lives in Qt6CoreMacros so it can eventually be used
in the public facing apis.
The generated meta types file is saved under the target property
QT_MODULE_META_TYPES_FILE.
Change-Id: I03709c662be81dd0912d0068c23ee2507bfe4383
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Needed when building Qt Creator with CMake + Qt6 non-prefix build.
Specifically qttools's QtUiPlugin does not have any private headers,
but the non-existing include path was exported, which caused an error
when configuring Qt Creator.
Change-Id: I662bc502fe3134fba083bde273b7f63fe1470277
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Tested locally with the following configurations:
- iOS device builds (arm64)
- iOS simulator builds (x86_64)
- iOS simulator_and_device builds (fat arm64 and x86_64 archives)
All iOS builds currently require a custom vcpkg fork which contains
fixes for building the required 3rd party libraries.
qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2
have also been tested to build successfully.
simulator_and_device builds are also supported, but require an umerged
patch in upstream CMake as well as further patches to vcpkg.
Task-number: QTBUG-75576
Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
In the qtwayland repo, both WaylandClient and WaylandCompositor
packages need access to the qtwaylandscanner tool. That means
that the add_qt_tool(qtwaylandscanner) can't use the TOOLS_TARGET
argument to associate a dependency with only one of the above
modules.
Instead add_qt_tool now allows specifying a non-existent module
name for the TOOLS_TARGET argument, which can be manually
depended on by other packages.
Actually, you could specify the non-existent module before as
well, but that didn't do everything that had to be done.
This required a bit of refactoring in how the Dependencies file
for Tools packages is created. Now the file is created in
qt_export_tools.
Two new functions were also added to allow recording additional
dependencies between packages.
Also some bug fixes were done to make it all work. Specifically
the _FOUND variable generated in the Dependencies file was incorrect.
Also there are some quotes missing when appending extra package
dependencies via the QT_EXTRA_PACKAGE_DEPENDENCIES property.
Change-Id: I167efec16dff8d036e191df3572ea72764e22bc5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Instead of hardcoding which platforms and which compilers support
certain linker features, do the proper probing via
check_cxx_source_compiles.
Change-Id: I676010970d8f3a8f2a8340c5d15dfcef76fe9191
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Clang doesn't have a mkspec just a win32-clang, there is
win32-clang-g++ and win32-clang-msvc.
Change-Id: Iff521e955559dfb2308e377b41e86b3f62c42e70
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In qtwayland, there were a bunch of warnings of the following type
when configuring:
"The plug-in 'f' does not belong to any Qt module".
This happened because the plugin type had underscores, and was not
sanitized when comparing a the plugin type of plugin.
Add a function to do the sanitization, and use it everywhere.
Change-Id: I728b5f1e18fa5f8876c4a57dbd4e33148cb242d5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Rename internal APIs like extend_target to qt_extend_target.
Prefix apis with qt_ where required.
Keep old names for compatibility until all their usages are removed.
Change-Id: I9a13515a01857257a4c5be3a89253749d46a4f41
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Unfortunately not all repositories are marked as warning_clean
in their .qmake.conf files. For instance qtconnectivity and
qttools are not warning clean. Therefore we need to skip
warnings_are_errors flags on all targets created in that repository.
Add support for skipping the warnings are errors flags, by setting
a QT_SKIP_WARNINGS_ARE_ERRORS property on a target, and use that
within a generator expression with all the accumulated flags.
To mimic behavior of qmake, and set the property on all targets
created by add_qt_module, add_qt_plugin, etc, one simply needs
to set the QT_REPO_NOT_WARNINGS_CLEAN variable in the
repo project CMakeLists.txt.
Change-Id: Ib5a487af6601ae1519a0988a89f8083f94f92267
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This patch adds add_qt_manual_test() which is a simple wrapper around
add_qt_executable() which does not build under ${CMAKE_BUILD_DIR}/bin
or install the targets.
This could potentially be used later to tag manual tests.
Change-Id: Ic4e0a1d133009f5a858b9394347a0996cf42683f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In gui's CMakeLists.txt we have
if (NOT ANDROID)
...
add_qt_simd_part(Gui SIMD neon SOURCES ...)
...
endif()
and later
if(UNIX AND NOT ANDROID AND NOT APPLE_UIKIT AND NOT INTEGRITY AND NOT (TEST_architecture_arch STREQUAL "arm64"))
add_qt_simd_part(Gui SIMD neon
endif()
Since add_qt_simd_part internally uses an OBJECT library to compile the
sources with different flags and then link into Gui (in this case), we
may end up with an error when add_qt_simd_part is called twice for neon,
because the constructed target (Gui_simd_neon) exists already.
We can re-use an existing target though, as the SIMD features is the
same.
Change-Id: I7a21c6e66b47e918a53fa3b1a7db9e053ecc8d87
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When a _nolink target is exported, instead of getting the original
namespace prefix, it gets the Qt6 prefix
(OpenSSL::OpenSSL_nolink -> Qt6::OpenSSL_nolink).
There is some special case code in Network autotests which tries
to access the former target name, which doesn't exist when building
standalone tests.
Make sure to create a Qt6:: library alias for _nolink targets during a
build (so before the library is exported), and change the Network
autotests project to use this Qt6:: namespaced library, which will
ensure it is found both in a standalone tests build and in a regular
Qt build.
Also make sure to actually call find_package to find the OpenSSL
library when building standalone tests, otherwise configuration will
fail.
Change-Id: I3da5b958e72e745a50380f8ab1644459a7c6b005
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Don't call qt_android_dependencies for interface libraries.
Also make sure not to set properties which don't start with
INTERFACE_ prefix.
Change-Id: I0afdffd34c9aebe0d7ac4731b57dd4d505f84570
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
It only makes sense for non-interface libraries.
Change-Id: I80ac942ed546a6ac866e827aa2026e4e6ac897b2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Convert benchmark executables to add_qt_benchmark().
Currently add_qt_benchmark just calls add_qt_executable() and
ensures that it they build under CMAKE_CURRENT_BUILD_DIR and do not
install.
Add QT_BUILD_BENCHMARKS option to enable/disable building of benchmarks.
Change-Id: Id0bc676698d21d50048d97d9abef51d92ccb6638
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The last set would override the variable instead of appending to it,
thus QT_DISABLE_DEPRECATED_BEFORE was never set.
Change-Id: I173b91704a855fcda1f2b86172d318e3953466db
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
If we do not encounter the load(qt_plugin) statement in the .pro file
but we do see the entry CONFIG+=plugin, treat the target as a regular
CMake library instead of treating it as a qt_plugin by default.
Change-Id: I67ad5c865a1a5ab691a6b0d86c2db4b686aa04dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This patch converts all add_executable calls when building for Android
to a module library and replaces the call to add_test() to use
the android testrunner binary.
Change-Id: I10ba5919217cdc93cc2cbbb7d13ad9d10fc5ac1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
e1fd607493 in qtbase removed the
qml1 imports enum from qlibraryinfo.cpp, qconfig.cpp, etc.
With the recent merge from dev, this was not adjusted in
qt_generate_qconfig_cpp, and thus we generated one too many strings
in qconfig.cpp, which resulted in
QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath) returning
"imports" instead of "qml" subfolder, thus causing all qml modules
not being found.
Fix this by removing the extra qconfig.cpp entry, and all other
references to the location.
Change-Id: I128f667281138e2e0ef0fe1ced4af0405c532fef
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This patch adds two custom targets to generate android apks. The
targets are named ${TARGET}_prepare_apk_dir and ${TARGET}_make_apk. The
first one insures the binary is copied to the right location and the
latter invokes androiddeployqt on the apk directory.
Change-Id: I8152cef387b50ec03ee2bfd92b56910a6f22754c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use STRING type for install locations as we use them relative to the
CMAKE_INSTALL_PREFIX.
PATH type will get expanded to absolute paths by newer CMake versions,
so that breaks our logic.
Change-Id: I36be1f0378c4fb07ad8db0051d540f9d243000be
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Write out a file with some JSON data to describe a module.
This file contains information on how that module has been built.
Change-Id: I8a604692663cbb7b76b96b97124130e30b822e4b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Allow plugins to be built with undefined symbols when
ALLOW_UNDEFINED_SYMBOLS is specified.
Change-Id: I6bc809e3e5257302157bf8484f850d8319674a4a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Rename the builtin test data resource name to something more unique as
there are name clashes when building tests which also add a resource
named 'testdata'.
Change-Id: Icc1bbff3134e1dbc6ea4f6a87a1715b936c723cc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This maps the behavior of mkspecs/features/qt_common.prf and enables the
use of C++17 for example in Android, where the toolchain supports it
anyway.
Change-Id: I41f4bdb160a3929e2fb78f36efb1ad5f2ad391a5
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Latest CMake will try to compile the given precompiled headers
as C files, due to enabling the C language in the project + also
having c files.
Make sure to wrap the precompiled headers in a CXX language only
generator expression.
For details, see https://gitlab.kitware.com/cmake/cmake/issues/19839
Change-Id: Ib3508ad920092455c300b1a566ba6152bab032db
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
OUTPUT_DIRECTORY by itself is not a valid cmake target property.
Change-Id: Ic3a2a81b8b982ad7ccf0551000a157f9a4d3ef22
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Note the following bigger things that had to be done:
Handle GSS library / feature with a new custom find module.
Implement rudimentary support for relocatability (does not currently
handle extprefix).
Change-Id: Ic6cd27dda7ebca9829f51cb42ea76fff6d1767ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
If a module is marked as NO_MODULE_HEADERS, we shouldn't
try to include the non-existing include directory which is
usually generated by syncqt.
Note it seems that NO_SYNC_QT and NO_MODULE_HEADERS seems
to converge, so it might make sense to merge them in the future.
Change-Id: Iab4e2907ed68776632337b37496b015535da8784
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add condition replacements for the android ABIs.
Add a replacement for QT_ARCH to ANDROID_ABI, since QT_ARCH is only used
with the android build for now.
Change-Id: I553d7910546de32236f723ec2e9a05a18da76130
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
extend_target() does not handle the OUTPUT_DIRECTORY argument, so we
must handle it ourselves.
Change-Id: I31880a516ae185f3255b2a51f41d61ee6b1d9838
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>