Reduce the amount of code required to add a qml plugin to cmake
by making add_qml_module wrap the add_qt_plugin code where required.
add_qml_module will also create a dummy target so that qml files
will appear as source files in an IDE when no cpp files are present.
CXX_MODULE qmake parameter has been dropped in favor of an
explicit IMPORT_VERSION parameter, since it was only used to
determine the version when the IMPORT_VERSION was not specified.
Change-Id: I4a4b626566720d04c62d246ca521db8c4a95b10f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
These changes enable the support to handle test data and install or
package them as resources when appropriate.
This change does not handle the GENERATED_TESTDATA or
TEST_HELPER_INSTALLS since there are very few occurrences of these and
we can handle those as special cases.
Finally, in add_qt_test, only append CMAKE_CURRENT_SOURCE_DIR if
the path is not absolute.
Change-Id: Ic20b9749d10e2a09916f2797606116471c64850b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add the necessary code to both the QtBuild and pro2cmake to be able
to handle qml plugins in qt declarative.
Add condition replacement for QTDIR_build to QT_BUILDING_QT so that
certain qml examples work correctly when being built in the build
directory.
Fix add_qt_resources not being updated during build after changes
were made. Files list used as dependencies were not populated.
Add missing module mappings for qtdeclarative.
Change-Id: I0f71d0a3a0e7e97ba96807950d11cffaee04d9b2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
f66c1db16c in qtbase introduced a new
macro that the moc scanner has to look for.
Set an explicit list of macros to look for in the
CMAKE_AUTOMOC_MACRO_NAMES property of every target that has AUTOMOC
enabled, otherwise CMake AUTOMOC won't run moc on files that contain
the new macro.
Change-Id: Id991a70d773cef66716621803a88e96b44a80650
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is done by adding a DEFAULT_IF argument to add_qt_plugin, which accepts
if-evaluated expressions.
e.g.
add_qt_plugin(myplugin
DEFAULT_IF ${foo} STREQUAL ${bar}
...
)
so that this mechanism can be reused later if necessary.
Change-Id: I7eba9adaaa28e55a4f0f94cf206e868b990027e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Generate the ${MODULE}-android-dependencies.xml for the androiddeployqt
tool. This will ensure all the right plugins and dependencies are
packaged when generating the apk.
This change also changes the visibility for executable to default/public.
Not having this will cause the application to crash as we can't locate
main() in the executable (shared library).
Additionally pro2cmake conversion script has been updated to perform
the required conversions for the Android settings.
Finally, the 6 projects in QtBase that have Android dependencies have
been updated with the new script and the step that produces the xml
files in run at the end in QtPostProcess.cmake.
Change-Id: I9774ba1b123bc11cae972fa37054ef2c51988498
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Just like with qmake, separate the two "features".
Change-Id: Idf2a796c7c4aaa740c471688b2221d7041fed643
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For ICU we have multiple components, and ICU becomes a public dependency
to QtCore.
When storing the INTERFACE_QT_PACKAGE_COMPONENTS property, make sure to
store the entire list of components, not just the first component -- by
turning the semi-colon separated list into a space separated list.
When processing the components at find_dependency time, we need to
reverse that and pass COMPONENTS directly to ensure a correct parameter
expansion.
Change-Id: I24a0708520e7d5fba039395a151034aee4d4c0e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add labels so that ctest --print-labels and ctest -L <label> gives
insight over the test plan and the ability to run easily individual
tests.
* Unfortunately we can't do the TESTARGS indirection for arguments as
coin does with testlib, so instead pass the parameters to generate
the xml unconditionally.
Change-Id: I289de9c15c516e3ac3fe04771fdbd8d7a083ff1f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When cross-compiling we take a shortcut in add_qt_tool() for moc, etc.
as the tools are already imported from the host build of Qt. However we
must still add the tools as a dependency in for example QtCore so that
when the cross-compiled QtCore is used, the host tools are implicitly
imported.
Change-Id: I83e4fd7f21e18472c0965c90c058dd2b55b6ec65
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
add_library(MODULE) creates libraries with .so extension on macOS,
but Qt plugins should have the .dylib extension.
Change-Id: I603e7abfb9d5b78c0c8ea526f9fe995bf36c3a50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
We want our libraries to end up in the same bin directory, not inside the
Debug\ or Release\ sub-directories. Their distinct names avoid a clash.
For our tools such as moc, uic, etc. we need to place the release build into
the bin directory explicitly, as by default multi-config generators place
binaries into the Debug\ or Release\ sub-directory.
This is also needed as cmake's automoc itself expects moc to be in the
bin directory.
One effect of this is that with a multi-config build, it is always necessary
to perform a release build first, otherwise the debug build won't find moc/uic.
Change-Id: I1361823ddf5961a5f1bb517e4bca69e621cbce9e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Remove the special case in QtGui and instead handle this in a generic
way so that QtPrintSupport is covered, too. For now we do this in the
same function where we run the regular target install() commands. It
doesn't quite fit into per-target PUBLIC_HEADER or PRIVATE_HEADER
properties as the qpa headers sit _next_ to public and private in a
separate qpa sub-directory.
Change-Id: I30aadaf9496cf0236f39a7c36a5163e4270edecc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This changes many different CMake places to mention Qt6 instead of
Qt5.
Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.
Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
Builds fail on Windows, due to splitting on ':' on absolute file paths,
when handling syncqt injections.
Revert for now to get qt6 merge in faster.
This reverts commit 7559d508d1.
Change-Id: If139a8a1eb4ae7ccc8d7b835b12e83b03176e28b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
In case of a CMake superbuild, the actual install root in a non-prefix
build is the top-level build directory (not $TOP_BUILDDIR/qtbase anymore).
This is more in line how CMake lays out things by default.
Task-number: QTBUG-75582
Change-Id: I4e1744b5c877508fedc33e237eec28cb7436010b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The GlobalConfigPrivate target should also be filtered out when
registering target dependencies, because there's no standalone
Qt5GlobalConfigPrivate.cmake file.
Amends fbfa067a30.
Change-Id: If89732bc2fd004b9644959f71339e22210483d7c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
There were a few issues:
- Third party dependency info for plugins was not generated,
because the depends and public_depends variables were not fetched.
This caused issues when trying to use the qcocoa plugin in a
consuming application, because Cups::Cups was not found.
- Privately linked libraries in extend_target were not considered when
generating dependency info for modules. This caused issues in
QtThemeSupport, becauese it could not find Qt::DBus, due to that
target only being added as a private library in a conditional scope.
- Make sure to handle privately linked internal modules like
PlatformModuleInternal to map to the Qt5 package, because there is no
standalone package for it.
Also remove a TODO comment that says that qt_register_target_dependencies
should maybe be called in extend_target. That's already the case.
Change-Id: Ie99c52e800cd89e6f82008f1e38f4da5cd602929
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Provide add_qt_gui_executable() as function in our public API that takes
care of automaticWinMain linkage. We can use this in the future to
encapsulate similarplatform-specific behavior and adjustments, such as
module generation onAndroid.
In order for the examples to see the function in Qt5CoreMacros, three more
additional fixes were required:
* Do the build_repo_end() call _before_ attempting to build the
examples, as we need the build_repo_end() to include QtPostProcess
and complete the creation of all the target config files.
Otherwise the find_package() calls in the examples see something
incomplete.
* Add more QT_NO_CREATE_TARGET guards
* Always call find_dependency on the dependencies, regardless of the
target creation mode. This way a find_package(Qt5 COMPONENTS
Widgets) will still load Qt5CoreMacros.
Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Commit abe12f600b moved the
_LARGEFILE64_SOURCE define to a central place and commit
449eee2d10 made it conditional to UNIX
(not WIN32). Somehow these two were left over though.
Change-Id: I23b08e84db804e9d5a4dde706af501c0918b460e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Generate the android deployment settings json for android apk
targets. QtPlatformAndroid is now also deployed as a public
build dependency of QtCore. Some minor refactoring has been
performed to the naming of variables and functions to
better match the public facing apis.
Extra settings for the file can be configured using the
following target properties:
set_target_properties(Core
PROPERTIES QT_ANDROID_DEPLOYMENT_DEPENDENCIES "foo;bar"
QT_ANDROID_EXTRA_LIBS "foo;bar"
QT_ANDROID_EXTRA_PLUGINS "foo;bar"
QT_ANDROID_PACKAGE_SOURCE_DIR "/foo/bar/"
)
The file is generated using the function
qt_android_generate_depoyment_settings().
We need to install the android template files and jar
files during the android build as the androiddeployqt tool
wont work if parts of it are split between the host
install and the android install.
Added QT_BUILD_QT variable to check whether we are building
Qt from source.
Finally, we also force the stdlib to shared via cmake
configuration with -DANDROID_STL="c++_shared"
Change-Id: I063c47e11749d56ba4c6f02101dbcc09e1b9fe87
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is needed for QmlDevTools in qtdeclarative.
Change-Id: I41adec15f292c91192e171b45d1e5d48764c37c4
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Move flags/options that we use for modules from add_module to the new
platform module target.
Change-Id: I89e414690336dcd37253432fe5116226d1c8dd82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
extend_target.
In extend_target(Foo) we go over all the ModulePrivate dependencies
to assign them to FooPrivate. To do that we use the QT_KNOWN_MODULES
variable.
The problem is that the variable gets reset when we build a new
repository, so when we build qtdeclarative, QT_KNOWN_MODULES has no
entries for Core, Gui, etc, but only Qml, Quick, etc.
And yet QmlPrivate has to depend on CorePrivate.
Change the module Config.cmake files to append their target name
to a global variable called QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE.
The global variable gets populated every time find_package(QtFoo)
is called.
Use the union of QT_KNOWN_MODULES and
QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE when considering FooPrivate
libraries.
Change-Id: Ibd9449744478cea58eb5d9737cc8887b4df92420
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Don't try to report an installable public module .pri file for internal
modules.
Change-Id: Ide6a50420e0b5448b141c842df4c891baca4a9d9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Link to them from add_qt_module/plugin/tool
This way we set the warnings_are_errors flags just once
and also non-qtbase modules get them
Change-Id: I2b65a81694aaebdd7c886249f217c11f79492bad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
... in superbuilds. PROJECT_SOURCE_DIR points to the wrong directory in
that case.
Change-Id: Ic0cba254734c4693b418dd8a0d8e77063914a9de
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Generate a pri file for public and private interfaces, but map CONFIG +=
internal_module to a cmake option and skip the former if set.
Task-number: QTBUG-75666
Change-Id: I3f4baf1277094f4c22149a9e8769734baf9a235f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
for modules, plugins and tools only (i.e. no tests nor examples)
this mimics the qmake behavior
default value is developer_build
Comes with some fixes in qmake since it seems in the qmake built it was
not having Werror, now does because we built it with add_qt_tool
Change-Id: I6f3237f25a6fedefa958644929e90f13837a12df
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This mirrors what happens for qmake. qt_plugin.prf does not
define these, but qt_module.prf does.
Change-Id: I742d3c766f6f4bd129fa6ccf85b5a67c6758e819
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This was added to the qmake build system in 220028d37c
Change-Id: Ieee8b4d47b8f9716c14c85cf3038f1074ee8c46a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Create CMake config files which can be used from the very same CMake
project. These CMake config files simply do not create any targets,
controlled via the QT_NO_CREATE_TARGETS.
This patch also allows to build qtbase.git:examples as a standalone
project, against an already-built Qt.
Ran this:
ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example
Task-number: QTBUG-74713
Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Otherwise when compiling qxcb-glx-integration we would get a warning like
<command-line>: warning: ISO C++11 requires whitespace after the macro name
because -DQT_BUILD_QXCB-GLX-INTEGRATION_LIB is not a valid define name
Change-Id: Ie8cef93a47b14d75eaad77893f7182e1514dd616
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Only re-enable exceptions for the modules that do
CONFIG+=exceptions
in qmake
Change-Id: I9f19078adbdc1b8fa3d4102fb51a099e7e35522e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
In particular, Qt targets extended with other qt targets
(eg. Qt::VulkanSupport or Qt::LinuxAccessibilitySupport)
after the first add_qt_module were not taken into account when generating
Depends files.
Note that this patch updates the minimum required version
to CMake 3.15
Change-Id: I747deedd4d59e385876bc1a834ef9bdb6078911b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
so they are actually set for all the targets
and that the code is a bit simpler
Change-Id: I2cd253d0a3cec3f482b868f81e852edfa158d3f1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
when largefile feature is enabled, in qmake world
this came from largefile.prf
Change-Id: I064da31328ad46157354c7012c7b8397c558cd1d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake will complain if you try to use a plugin in target_link_libraries,
and it won't produce import libraries on windows, or use .so.number
on Linux.
Change-Id: I6f0cf8267b3c0e6e5c888703596afe59b3a39141
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The plugin dll files were missing from install_dir/plugins/
Change-Id: I68655faf949e4b8fcab153c6c9b8ee14d3ad8ecc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
We can't use the gold linker with the android NDK, which is the default
option. Using the gold linker results in linker crashes. QMake builds
also disables the gold linker.
Change-Id: I73de93150b160b4411715007bc7e40238b96d400
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Dlls were missing from the install_dir/bin directory.
Change-Id: I0b5ef685b779c91969bbfa877f226be2060f6e56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In order for test lib to locate the file requested via QFINDTESTDATA, it
needs the build directory of the test (for example
$builddir/tests/auto/foo/bar) and __FILE__ expanding to a path to the
source relative to this build directory.
With ninja, __FILE__ is a path that is always relative to the top-level
build directory, not the per-test case one. Therefore the path
resolution in testlib fails.
To accommodate this, add_qt_test() now always sets QT_TESTCASE_BUILDDIR
as well as the newly introduced QT_TESTCASE_SOURCEDIR, which, as an
absolute path, removes the need to use __FILE__.
Change-Id: I16c2b0001e38162e6da9fdb1a61f4f8ce634fe46
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Hunter has recently added aliased target names that conform with upstream
CMake find module target names.
Extended the WrapFreetype to work with Hunter's freetype (lowercase) package
name.
Change-Id: I0e25f342c6930658f07f05d2e6a58cf94d2d168d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit introduces infrastructure work to allow static builds of Qt
to handle importing of plug-ins.
Change-Id: Ife0ca3ca7276ea8ec96fe0eb6adf934fad7620ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>