Extend the example writing section to handle qml plugins. Detection
is based on whether the plugin config is detected an the target links
against Qml.
add_qt_qml_module() now uses the the public facing API underneath.
Change-Id: I2ccd06548e7b5b18c9dc3338b835bc115fa97809
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Use lower case for the function name as that's cmake style.
Change-Id: I6c53166aa3a8cece4abe8a485e06bd359fc12a06
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Brown paper bag for me, don't use a comma to separate parameters when
calling a function.
Change-Id: I21e16142fab4fd1c2714df13cd6a892b036e899a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Replace things like $$(FOO) to $ENV{FOO}.
This is needed to stop the script from crashing when it sees $$(FOO)
in a .pro file, like in
qtmultimedia/src/plugins/directshow/directshow.pro
A better approach in the future will be to write a Find module that
uses the env var to find the relevant headers, and then instead use a
CMake cache variable, to make the build more robust in case the env
var is removed after first configuring the project.
Change-Id: Ia5b3dc3a90e1d4159a8b90acdade85f34b5165f9
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
The option --only-missing was added to check only the
cases where there is a pro file and not a CMakeLists.txt
Change-Id: Ifc6233552757e0afe8e7242a79f958e8bc77f823
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In qmake land, testlib.pro has "console" in MODULE_CONFIG, so linking
against testlib implicies CONFIG += console. The need for a console app
is typically also covered by other cases, except in qtdeclarative's
qqmldebugjsserver binary (and some others). They are not test helper
binaries, they are not Qt tests themselves, but they must be console
apps and due to their QT += testlib in the .pro they become console
apps. So with cmake they also must be console apps so that the unit
tests that launch them and read their stdout can pass.
Change-Id: I687fdc910b550051750be74ecd176dd96626675c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In the future need will need to continue to tie qdoc runs still to
targets, just like with qmake. This change prepares us for that by
ensuring that add_docs takes two parameters and that any re-generated
CMakeLists.txt from now on gets it right.
Change-Id: Id0256dc1e2f2f59f3b4e4ca98f0d10d025d189fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Needed to successfully parse qtconnectivity projects
where there are expressions like:
WINDOWS_SDK_VERSION =
$$member($$list($$split(WINDOWS_SDK_VERSION_STRING, .)), 2)
Also fix '$$member' to be handled in the function.
Change-Id: I35b5cff8c39b3a35d485d1d72f5d668cccbe9b2f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Prefix by python executable and drop os.nice.
Change-Id: Idd1d0de6695887652db84261da1130a084e5af78
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Change-Id: I8113d7dd4e7967d020d59a5b4104e8366d55283c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Almost every non-trivial .pro file has line continuations.
Remove the warning as there's nothing the user can do about it.
Change-Id: Ic8a54e5e5cc39a31267800edde4b0ff2b0276a48
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Given HEADERS = $$PUBLIC_HEADERS $$PRIVATE_HEADERS
$$PUBLIC_HEADERS can be expanded into a list of source files
which in turn contain $$PWD/foo.cpp.
The $$PWD needs to be expanded as well.
This is the case for qtwebsockets/src/websockets/websockets.pro
project.
Change-Id: I3aa14203ee8d177fadd12a7e3212c3250970e0a8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We should use the new relative path to the project, instead of the old
specified on command line.
Change-Id: I54cb1cefd4df079a95c364b7c7c66c36941add01
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Some modules define their own manually-maintained lists, and we can rely
on the headers generated by each module to include in the pch as well
e.g. QtCore/QtCore.
There's also e.g. QtWidgetDepends for QtWidgets, but this only
works for modules, not for tools, examples or other applications.
For now we'll use the Qt<Module>/Qt<Module> headers for the
modules we depend on.
Building with PCH can be disabled with -DBUILD_WITH_PCH=NO, and it only
works for versions of CMake newer than 3.15.20190829.
Change-Id: Iae52bd69acfdfd58f4cd20d3cfa3c7f42775f732
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Specifically skip cmake tests projects (because they are only needed
when Qt is built with qmake).
Also skip test qmake projects in qmake's test suite.
We might find more tests to skip in the future.
Change-Id: I4c3a42db669b31e81fd06206652371b6a70fd8ce
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
If the project path starts with "examples/" relative to the repo
source directory (which is decided by location of .qmake.conf),
consider the given project file to be an example.
This makes the usage of run_pro2cmake.py easier, specifically by
being able to point it to a repo source directory, and getting most
project conversions correctly.
Change-Id: I93de98f8fc97af509c1f96cdebad3681190a53d1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The script now detects whether the project file given is a:
- top level qmake project (qtdeclarative.pro)
- top level tests project (qtdeclarative/tests.pro)
- top level examples project (qtdeclarative/examples.pro)
This is done by finding the .qmake.conf file in parent directories of
the given project, and comparing the project's location to the
.qmake.conf location.
For the top level qmake project and the tests project, the script will
now use a predefined block of code that we usually had to copy paste and
change manually. Now only small bits will have to be adjusted manually
(project name and dependencies).
For the examples project, the content is surrounded by the required
build examples commands.
As a result, developers will have to worry less about knowing where to
copy paste from.
Change-Id: I4f751b371e74eeb86e070d58635c3d99b970ab18
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Change-Id: I8cb97afaaed46ee64b5a133e797179d7ddecdeef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We use
qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz)
which would set harfbuzz_FOUND. Since variable names are case-sensitive,
this is also the name we must check for in the qt feature condition.
Change-Id: I43420489c3310bc9c3e5cc798a005c8d5b0ab646
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Conditions scopes that had "else" were not handled properly.
The "else" condition should be expanded to its proper negative full
form.
Also every condition "piece" should be wrapped with parentheses before
being passed to sympy simplification, to be sure that boolean
operator precedence is applied properly.
Refactored the code a bit to make it easier to read.
Change-Id: I4726845b867f93c3afbc9362cdce1cd063ccff63
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Essentially pass them through without failing the whole
conversion process.
Change-Id: I7bbd198203f79b45120a7254e2ecdf58e32f9525
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
no-png is an old unused scope that should be mapped to the png
feature instead.
Map contains(QT_CONFIG, shared) to correct variable check.
Sympy doesn't like dashes in indentifiers, so replace all of them
with a _dash_ token which will be replaced again at the end
of the condition simplifying.
When doing sympy preprocessing, fix mapping of target names that
don't contain double colons.
Change-Id: Id3d37800665c96505b7cbb1d80fdbed59c3ae9c0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Designer components target names need to be prefixed with Qt.
Change-Id: I13037820b080d88cd670f2db97232509eb868daf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The libclang test is implemented as a custom FindWrapLibClang module.
The module does mostly the same things as the configure test in qmake
land.
Change-Id: I965f284baf7daef074e22f033047c35a917c8808
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Remove repeating '../' pattern from target names, since we generate
the targets in the correct location with CMake.
Change-Id: I89d527a9ad717f742f8d0e5921f378e6ac0a229d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use GLOB_RECURSE for testdata instead of globbing the top level folder.
Although RCC supports scanning directories, it will result in alias
collosions and test not being able to find the files on platforms
where test data is embedded into the binary.
Change-Id: I35d3d46a5d9fcafa5c8dc833eafdd0044ffe355f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Update all public Qt macros to use qt6/QT6 instead of qt5/QT6.
Change-Id: Ib178f4fa21f37dfb8da7d4d8c097aa0e96c9d9f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also add support for modules that have no private module counterpart.
Both are needed for Designer's QtUiPlugin in qttools.
Change-Id: Ia7e9d8837140e1de5cd59e196b4f63481ab68298
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Update pro2cmake to generate CMake projects where resources are handled
via the QT5_ADD_RESOURCES command.
Change-Id: I66dc2174a45fc652fd8c9b7e3c0f46f58ae02c0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Add command line argument to make run_pro2cmake invoke pro2cmake with
the --is-example option so we can convert examples in bulk.
Change-Id: I162eddffc509f16a97de5517698e8daca5207b74
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>