* Add support for a QT_RESOURCE_PREFIX target property, that
add_qt_resource respects. This makes it convenient to add files
to the resource system for a project without the need to repeat
prefixes. In qmake land with multiple resources they're repeated
in the foo.prefix variables or in the prefix attribute in .qrc
files.
* Since /qt-project.org/imports is in the default QML import search path
and the hierarchy under the import search paths is "regulated",
we might as well make add_qml_module set QT_RESOURCE_PREFIX on
the target. We can compute the correct value for that. This
allows removing the redundant prefix from the add_qt_resource()
calls for the qml files.
Change-Id: Ic15130dc9e432340fc3edf93e35f2a803b4b40eb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
There was a missing dependency rule which would cause the generated cpp
file to not be updated when changes were made to a qrc file generated
through add_qt_resource().
Change-Id: I9544c2fb6cf49529913f731b8fb6fc524d65e40c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Detect this in the conversion script and map it to a source file
property. When that's the case, avoid repeating the file list but
instead store it in a variable.
Change-Id: If3119d83914bb798766e27351746b4e867bd3ab3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Minor tweaks to make sure QML test cases without source files work as
expected.
Change-Id: I30b72622692b8f36d01f7a17b9d1456b0ab223ea
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
File passed into add_qt_resource are check to see if they match valid
qml files extension. Those which match the latter are then processed
by the qt quick compiler should the qmlcachegen target be present. We
also ensure that any remaining resources are properly chainloaded.
If the qmlcachegen target can't be located a warning be will be
issued asking for the inclusion of QmlTools in the find_package
command.
Change-Id: Ieecd38670e15c21d94dc549b31c7d87f2383d9af
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
While trying to port qtgraphicaleffects, when trying to configure
the project with a non-prefix build, the configuration fails with
the following error:
CMake Error in src/effects/CMakeLists.txt:
Imported target "Qt::Qml" includes non-existent path
"../qt_cmake/qtdeclarative_built_developer/include"
This is because we incorrectly export public include directories
that point to an "/include" folder under the repo build dir, whereas
in a non-prefix build the syncqt "/include" folder is actually in the
qtbase build dir.
Fix this, by introducing a new variable called "foo_repo_include_dir"
which will point to the correct include directory regardles of prefix
or non-prefix build. This variable is set by qt_internal_module_info.
Fix all relevant places to use this new variable. Also streamline
and remove any unncessary include directories in all our functions,
thus making everything consistent and hopefully easier to understand.
Change-Id: Icbe884701275c7754daecadcdba18048b4d779d0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Make sure the URI name for qml modules correctly strips out the version
number for instances such as QtQuick.Controls.2.
Change-Id: I18e706b371323eeefdd6d7564b922265fa5cad3f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The rcc generated code relies on global constructors to register the resources.
The object file of the generated code is included by default in shared libraries
and executables. However when the object file ends up in a static library, the
linker will discard the object file when nothing references any of the symbols
in that object file, when linking the static library into the executable/shared library.
The solution is to link the object file straight into the final target, by means of a
cmake object library.
Change-Id: I02ad1173e4f7e8f907022c906640dc9086233676
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Due to the missing argument processing on PUBLIC arguments we could
run into situations where the defines for an executable (mostly tests)
would be incorrectly processed.
If one were to pass a define into a test that also specifies public
libraries, the defines passed in by test would fall under the
PUBLIC_LIBRARIES argument in add_qt_executable.
For instance, in a test with DEFINES Foo PUBLIC_LIBRARIES Core
would cause arg_DEFINES to be "Foo=BAR;PUBLIC_LIBRARIES;Core". This
combined with the defines specified by add_qt_test would result
in the following string "Foo=BAR;PUBLIC_LIBRARIES;Core;TEST_DIR=..."
and would cause TEST_DIR to be treated as a public library in
add add_qt_executable.
For some reason I can't figure out, these two defines end up in the
linker flag section of certain test programs. There is nothing wrong
with the rest of the propagation chain into add_qt_executable. My best
guess is that it has something to do with the generators. In any case
add an explicit -D fixes the issue.
Change-Id: I340790c1c2426fa76785d1bd1b3332a904323d56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It has been decided, that going forward all qml files are to be added
to a module via the resource system. This patch does the ground work
to make sure all qml modules in the qt codebase follow these new
conventions.
New properties on targets have been added so that we can't track all the
qml related information for later use.
To make sure it is still possible to install qml files we added the
qt_install_qml_files() command.
Pro2cmake has been adjusted to handle the special cases of versioned
qml modules (e.g: QtQuick.2). It will now insert a TARGET_PATH
override to avoid the default conversion from the URI parameter.
Finally, this patch temporarliy disables the quick compiler by moving
all relevant code into a dummy function. This will be removed in a
follow up patch where the quick compiler will be enable for all
qml files present in resource files.
Change-Id: I09fe4517fad26ec96122d9c7c777dbfbd214905c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This patch adds support for the qtquick compiler feature, which
will embed the compiled qml files as resources along with the
respective qml_loader.
This patch also changes the add_qml_module call to require either
EMBED_QML_FILES and/or INSTALL_QML_FILES to be specified.
Change-Id: I32d29c9b554b8286ed3b980027a56dd4abe11c92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Make sure that the .qml/.js/.mjs files are copied or installed into
their target destination.
Change-Id: Ib1649e5168c9fe3a570800af92d82293e5b295d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
When cross-compiling qtdeclarative, add_qt_tools makes sure to import
the host tool and not build it. But there are also some
extend_target and add_qt_resource calls which try to extend the host
tool.
Make sure to protect those functions not to do anything if they are
called on an imported target.
Change-Id: Ifd8bcab8e56ad389a8c145382b23bd2c1bda5e81
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
After re-arranging subdirs, the cmake target level dependencies can
handle building qmlcachegen before running the custom command for
generating cache files.
Change-Id: I8a35b2b5bfd2fdf4b49462ff9c27e5f3075254fc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make sure to handle glob expressions in the entire path given, not just
the end of the path. This handles tests like qsslkey and qnetworkreply.
Also copy/install the testdata in the final test directory path under
a "testdata" subdir.
Previously INSTALL_TESTDIR was used, which was never set to anything.
Change-Id: I2408e12f586cadeb524ffa249e851a4179324b23
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
This patch adds support for qmake's qmlcache feature. It's enabled
when option EMBED_QML_FILES is not present in add_qml_module.
Change-Id: I9b35f0bda7dfaf777f55c14eaf3d763f9b550fa4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Some projects in QtQuickControls force the qml files to embedded into
the binary. This change exposes an option to mimic that bevhavior.
Change-Id: I4cbf0c21c05ca03b8dd1189eb7d81e43279c7157
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extend add_qt_test for qmltest by setting the option QMLTEST
when we detect the config qmltestcase.
We also forwards the GUI option to the tests when detected.
This is a requirement for some QtQuickControls2 tests.
Finally when doing a prefix build, we add the install directory
to the QT_PLUGIN_PATH environment variable.
Change-Id: I3b2ecb494955976e98abbcf3d03925c314336122
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make sure that paths passed to qt_copy_or_install are prefixed with
QT_INSTALL_DIR so that they behave correctly with prefix and non-prefix
builds.
Make sure that plugin.qmltypes and qmldir are also copied to binary dir
when doing prefix builds to match qmake's behavior.
Change-Id: I6f87ed478e797c9f66dbf85264904ad29a60ad95
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Some author warnings don't make sense when dealing with QML
plugins, like the messages regarding CLASS_NAME or not
belonging to a certain module. Take care not to print those
warnings in those cases.
Change-Id: I017bd63cca650dc262337949242e813b7b6a56cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
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>
It's needed when building QtQml on Windows, otherwise
compilation fails.
Add it as a private define for every module being built,
as it is done in qt_module.prf.
Change-Id: I1e322d1da15adea8b3f037a722b3260a552dfb62
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The warning used to be a fatal error, until we found out that certain
packages might provide optional targets, or provide one target
out of a possible set.
Until we figure out a better way to deal with that, remove the
barrage of warnings while configuring.
Change-Id: Iacf93a997a8f87f81167ac7c4cc991212e7fca5d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
We use
qt_find_package(SQLite3 PROVIDED_TARGETS SQLite::SQLite3)
which intends to find cmake's FindSQLite3.cmake and expects the
existence of the corresponding target. However qt_find_package first
tries to call find_package in config mode, which does not interact well
with vcpkg's sqlite, where sqlite3-config.cmake is provided to support
multi-config targets. So that call will appear to succeed, yet the
expected targets are not there of course.
Therefore this patch adds a sanity check for the target existence and
allows for a fallback to the module mode for find_package, in order to
find CMake's FindSQLite3.cmake.
Change-Id: I660f26c38369c3504df1c590e9d3a51ff1f65c6c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also fix the QT_BUILD_SHARED_LIBS usage. While building qtbase, it
is assigned later than the call for
qt_generate_global_config_pri_file(), so it used always choose static.
Make sure to check for BUILD_SHARED_LIBS as well.
Change-Id: I66f03e5adacc89646147fc96154bee8002b2b9cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
We used to copy a qconfig.cpp.in file verbatim.
Add some plumbing to actually compute the strings and their lengths
as it is done in qtbase/configure.pri.
Also make sure to replace the hardcoded linux mkspec with one that is
automatically determined.
Of course both the detection of the mkspec, and the hardcoded strings
for include, lib, etc. should be fixed in the future.
This is a stepping stone to allow building a Qt application using
the qmake built by CMake.
Change-Id: I2e6754f44b20b09b09d14fd85785d56288e6517b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Generate module .pri files
* Generate qconfig.pri
* Propagate MODULE_CONFIG from the .pro files
This enables the basic use-case of simple application builds that for
example use the moc. Omitted from the patch is support for private
module configurations, prl files (should we do this?) and possibly more
hidden gems that need to be implemented to for example support building
Qt modules with qmake.
Task-number: QTBUG-75666
Change-Id: Icbf0d9ccea4cd683e4c38340b9a2320bf7951d0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Since LINUX is not set when targeting Android, we must extend these
conditions manually.
Change-Id: Ie78167d452e0806bfa64773c1e311a99f4a28f8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QtQml uses QLALR to generate a grammar, but the qmake qlalr feature
seems to be a general one, so the corresponding CMake implementations
are kept in qtbase for now.
Change-Id: Ibe916878b18155ddc5bb08793dd2075ebfa8f282
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Before this patch we enabled AUTOMOC, AUTORCC, AUTOUIC for all targets
that did not opt out.
Aside from being wasteful from a performance point of view,
this also caused issues when trying to build qtimageformats which
does not depend on Widgets which is the package that exposes uic.
To avoid this, enable only AUTOMOC for all targets by default, and
UIC and RCC can be opted in via the ENABLE_AUTOGEN_TOOLS option.
To facilitate this some refactoring had to be done, like moving some
common setup for all autogen tools into a separate call, and making
sure that extend_target understands the autogen options, because some
ui files are only added conditionally.
Also the conversion script has been adapted to output the
ENABLE_AUTOGEN_TOOLS option whenever a .pro file contains at least
one FORMS += foo assignment.
Note that we don't really use AUTORCC while building Qt, so nothing
opts into that at the moment.
Task-number: QTBUG-75875
Change-Id: I889c4980e9fb1b74ba361abed4044737f8842ea4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add a prefix for generated .qrc files so for in-source builds we don't
end up overwriting htem.
Change-Id: I8eef582479eb45d67585f6aab87b288393bbadb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QT_CMAKE_EXPORT_NAMESPACE is used by the Qt packages to make features
available to the consuming CMake project. The value was moved to the
BuildInternals Config file, but that's wrong because consuming
applications not including the BuildInternals component would fail
to use any other Qt package.
Move QT_CMAKE_EXPORT_NAMESPACE to be propagated with QtCore package
again.
Amends 9542e78525.
Change-Id: I9841ac8c2828b00c0111d59e8976c889554e0ce1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
To implement this, create a new Qt5BuildInternals package.
All child Qt modules like qtsvg should use
find_package(Qt5BuildInternals) or
find_package(Qt5 COMPONENTS BuildInternals) in the their
top level CMakeLists.txt.
This will make the qt_build_repo() macros available.
For qtbase we slightly cheat, and specify a CMAKE_PREFIX_PATH
pointing to the source folder that contains the BuildInternals
package.
For the other modules we actually use a configured and installed
package Config file.
This change moves variables that used to be written into the
QtCore Config file into the BuildInternals package. This way
things that are relevant only for building additional Qt modules
does not pollute the QtCore package.
Task-number: QTBUG-75580
Change-Id: I5479adff2f7903c9c2862d28c05c7f485ce3e4eb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Currently to build qtsvg we have some copy-pasted code to set up
the paths for QtSetup and QtPostProcess to be found.
To make it cleaner, introduce two new macros called
qt_build_repo_begin and qt_build_repo_end(). The first one
should be called in a child repo like qtsvg, right after
a find_package(Qt5) call, and the second one at the end of the
repo top-level CMakeLists.txt file.
In order for the macros to work, extract some of the variables
which were set in Qt5Config into Qt5CoreConfig instead. This
makes sure that it works also for find_package(Qt5Core) calls.
Task-number: QTBUG-75580
Change-Id: I85267c6bd86f9291ec2e170fddab1006ab684b5c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Separate the logic to find all used libraries from the code that writes out
the link_library information into the CMakeLists(.gen)?.txt files.
This patch will remove some "PUBLIC_LIBRARIES Qt::Core" from generated files.
This is due to us handling some Qt libraries in special ways in some of our
add_qt_* helpers. These special libraries were added to the LIBRARIES section,
but actually they should be added to the PUBLIC_LIBRARIES section instead. Do
so now, so that the newly generated files do not break things again.
Change-Id: I588781087a8aecc4d879e949735671d8085f0698
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Tested with MinGW 7.3.0 64 from Qt 5.12 installation.
The CMake 3rd party libraries I used from hunter project (with some
package, and target names changes)
Change-Id: Ie89555a6cd8bdb7182f9b2dd2c3c39784c523ead
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously we just recorded that Gui has to link against
Vulkan::Vulkan_nolink, but if an application consumed Gui, it wouldn't
find that target.
We need to record that if a module links against Vulkan_nolink, and
then generate a find_dependency(Vulkan) call in the module config
file.
We also have to assign the _nolink interface library to an export
(the Qt5 one), so that it gets installed as a target.
Change-Id: Icbc29ff4161ab18fdd162196ae128e29c1ee8c80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Generate CMake config files which export Qt targets with a Qt:: prefix
(i.e. without a major version suffix in the namespace)
Change-Id: Ia07f98be6d0e24c196e3880b7469f1f0c6232c06
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also needs the include/ from the top-level binary dir added to the
include path.
Change-Id: I7e0d82a2ee24d9bf9ffe9da5fd02b3b223fd48e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This is needed because dependencies added after add_qt_module with extend_target
are currently not taken into account.
Task-number: QTBUG-75538
Change-Id: I2c72207fb88b2480e41a2c8550978fb194275617
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* When using a sysroot, just setting CMAKE_PREFIX_PATH to the
QT_HOST_PATH is not sufficient in finding for example Qt5CoreTools
because the QT_HOST_PATH would be prefixed by the sysroot. So this
patch switches the mode to also enable looking outside of the sysroot.
(done by Alexandru)
* Once the Qt5CoreToolsConfigVersion.cmake was found, the built-in check
for 32 vs. 64 bit compatibility by looking at the provided
CMAKE_SIZEOF_VOID_P (4 when target is armv7 for example) and comparing
it against the void* size used when building the tools would fail.
Explicitly unsetting CMAKE_SIZEOF_VOID_P disables this check, and
that's fine as we're not interested in any exported library targets --
where this could cause problems -- but merely programs to run.
Change-Id: If2931dad023e39a3dbdaa17ac095131ad2c0ca60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This is because some FindPackage may produce some targets only on some
platforms - e.g. qt_find_package(OpenGL) needs to define
the provided target OpenGL::GLX which will only exist on linux but
is required by various CMakeLists.txt files.
Change-Id: I74515470f5d56c246f489df74901ad4223a92a70
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>