Commit Graph

543 Commits

Author SHA1 Message Date
Leander Beernaert
cd88c30ce3 Fix formatting for test data
Add missing f parameter and globbing expression.

Change-Id: I0eedb59e47537f9cf42a0b9d9471ddfc87ee48f2
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-09-19 14:06:38 +00:00
Joerg Bornemann
7e91bd1f27 cmake: Add scxml to the library mapping
Change-Id: I86653af25fbbc2d269eb439ceefaa2f4d4ebde28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-19 10:35:28 +00:00
Leander Beernaert
d03d12a74f Add Qml plugin example support
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>
2019-09-19 08:06:08 +00:00
Simon Hausmann
f4aa7255e6 Fix casing of public API functions
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
2019-09-19 08:01:05 +00:00
Simon Hausmann
ceb2937498 Fix add_qt_docs calls
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>
2019-09-19 07:43:13 +00:00
Mårten Nordheim
2214be5e5a Add SDL2 to 3rd-party library mapping
Change-Id: I9f9df259340271b22a75ddfa6112ecba0f25bbbf
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-18 19:14:25 +00:00
Alexandru Croitor
c58df80cf7 pro2cmake: Handle qmake env variables in file paths
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>
2019-09-18 14:22:46 +00:00
Cristian Maureira-Fredes
b72adf8a91 Add option to generate pro2cmake on failed ones
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>
2019-09-18 14:02:22 +00:00
Cristián Maureira-Fredes
255a6d91db Fix indentation inside group_and_print_sub_dirs
Change-Id: I34a737ae4914795f96900f2b72d0d15a3f5652d5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-18 13:33:07 +00:00
Cristian Maureira-Fredes
91634c3c9b Improve styling of util/cmake scripts
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>
2019-09-18 12:00:26 +00:00
Simon Hausmann
c1cf305be0 Don't create "gui" applications when linking against testlib
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>
2019-09-18 11:28:52 +00:00
Simon Hausmann
cb5fbbde27 Fix up documentation integration placeholder
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>
2019-09-18 09:45:12 +00:00
Frederik Gladhorn
d6ca7306ad CMake: add Qt::TextToSpeech to library mapping
Change-Id: Ib682dede7d8e99461b146e9ef71e6d455daa8b6e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-18 07:45:38 +00:00
Frederik Gladhorn
bb95a030d9 CMake: add library mapping for QtSpeech
Change-Id: I274e7382b1593dcb010f5f03ba0e2ccc9a37e5b8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-18 07:07:21 +00:00
Johan Klokkhammer Helsing
08aba5ea0a cmake: Add library mappings for qtwayland
Change-Id: I9d394229073579df104e21c539bbbb614ef8efbd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-17 17:12:11 +00:00
Karsten Heimrich
17e11745f1 Add initial support for QtKnx cmake
Change-Id: I419d15ca0bb0b02e11001b75d0c612dddfa3abec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-17 17:11:37 +00:00
Alexandru Croitor
c3b79e79af pro2cmake: Handle nested lists in handle_function_value
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
2019-09-17 17:01:52 +00:00
Alex Blasche
b935fa8e08 Add a mapping for QtSerialBus
Change-Id: I3664dfe5a7aa064ea4fa8f9455242815a359f346
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-17 14:17:12 +00:00
Friedemann Kleint
9b31bdacc6 pro2cmake.py: State dependencies
Change-Id: I26234c68b781b983022c73a2d4206550f25b0232
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-17 12:57:19 +00:00
Friedemann Kleint
69caeada8d run_pro2cmake.py: Run on Windows
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
2019-09-17 12:57:10 +00:00
Jüri Valdmann
933d383a24 pro2cmake: Support QML IMPORTPATH with multiple elements
Change-Id: I8113d7dd4e7967d020d59a5b4104e8366d55283c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-17 10:39:34 +00:00
Sona Kurazyan
ce8337dbeb Add Qt Coap to the library mapping
Task-number: QTBUG-78308
Change-Id: I6ba6f84354d7d008e128c784e24db00ecd67647a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-17 09:57:01 +00:00
Joerg Bornemann
bc4f17e7dc pro2cmake: Remove warning about line continuations
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>
2019-09-17 08:59:05 +00:00
Leander Beernaert
4acb0b8582 Add expansion for $$files() in RESOURCES
Expand $$files() when processing resources.

Change-Id: I55a10dad65461db8640450609414fcfb0bb5d103
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-17 08:40:50 +00:00
Alexandru Croitor
59b940ff41 pro2cmake: Recursively expand $$FOO variables
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>
2019-09-16 12:48:13 +00:00
Alexandru Croitor
8489fe4ba4 Use posix paths in pro2cmake and configurejson2cmake even on Windows
Makes the conversions script usable on Windows.

Change-Id: Icb37f3ee8ae1c942556f524984ce3aed0d21cee0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-09-11 08:50:23 +00:00
Alexandru Croitor
9d893641b9 Minor fix path handling when considering whether to convert project
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>
2019-09-11 08:50:15 +00:00
Mårten Nordheim
2cf0ba1fba Use pre-compiled headers when building Qt with cmake
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>
2019-09-11 08:25:54 +00:00
Alexandru Croitor
b0dbfc3094 Skip converting certain projects when they are passed to pro2cmake
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
2019-09-09 19:20:57 +00:00
Alexandru Croitor
e87677ad4f Try to detect if project given to pro2cmake is an example
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>
2019-09-09 19:20:49 +00:00
Alexandru Croitor
3215f5457a Handle top level tests, examples and main qmake projects in pro2cmake
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>
2019-09-09 19:20:38 +00:00
Ville Voutilainen
b2a11daaa1 cmake: Enable building of the oci plugin
Change-Id: I003d6da10c7e47402fb373d3956817817328cf0f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-05 08:24:07 +00:00
Ville Voutilainen
95c9c5a308 cmake: Enable building of the db2 plugin
Change-Id: I26810cccba5f3128cb47e0bf53b5ec78de2eec8c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-04 09:50:15 +00:00
Ville Voutilainen
3ff31ed020 Enable building of the mysql plugin
Change-Id: I8cb97afaaed46ee64b5a133e797179d7ddecdeef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-02 15:16:42 +00:00
Simon Hausmann
8da5305102 Fix Harfbuzz detection
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>
2019-08-30 13:21:32 +00:00
Maurice Kalinowski
e5bf0290d9 Add Qt Mqtt to the library mapping
Change-Id: Ifa50161a579647002d3349b49da7012660c59f81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 15:51:44 +00:00
Alexandru Croitor
0798ed8a83 Fix subdir handling in pro2cmake
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>
2019-08-28 11:15:59 +00:00
Alexandru Croitor
c3ef1a012b Fix handling of more functions in handle_function_value
Essentially pass them through without failing the whole
conversion process.

Change-Id: I7bbd198203f79b45120a7254e2ecdf58e32f9525
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-28 11:15:44 +00:00
Alexandru Croitor
5c75f6a21a Fix some corner cases of condition mapping in pro2cmake
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>
2019-08-28 11:15:32 +00:00
Alexandru Croitor
3416a83f05 Augment conversion scripts with requirements for qttools part 2
Designer components target names need to be prefixed with Qt.

Change-Id: I13037820b080d88cd670f2db97232509eb868daf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-28 11:15:24 +00:00
Alexandru Croitor
5a5dc6294b Augment conversion scripts with requirements for qttools
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>
2019-08-28 11:15:14 +00:00
Leander Beernaert
060784c981 Remove ../ from Targets
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>
2019-08-26 10:39:40 +00:00
Leander Beernaert
103d1aa910 Use GLOB_RECURSE for testdata
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>
2019-08-26 08:20:14 +00:00
Leander Beernaert
bf298499a0 Update public CMake macros' version
Update all public Qt macros to use qt6/QT6 instead of qt5/QT6.

Change-Id: Ib178f4fa21f37dfb8da7d4d8c097aa0e96c9d9f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-23 10:04:30 +00:00
Alexandru Croitor
60ceb1b0c5 Handle contains(CONFIG, static) in pro2cmake
Change-Id: I36717688dd3b2ff0f6730bf3d65be421e391895f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-23 09:26:42 +00:00
Alexandru Croitor
54aeb4ccd7 Add support for Qt header_modules aka a header only INTERFACE library
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
2019-08-23 09:26:16 +00:00
Alexandru Croitor
02074bf345 Fix more uses of functions in handle_function_value
Change-Id: Ie6b6f79b50e9eaf605427f19a8c2ca86050e2f74
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-23 09:26:07 +00:00
Leander Beernaert
f96faa95aa Update pro2cmake example generation to use QT5_ADD_RESOURCES
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
2019-08-23 07:52:19 +00:00
Leander Beernaert
3a105b9d11 Extend run_pro2cmake.py to pass --is-example to pro2cmake
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>
2019-08-23 07:06:48 +00:00
Alexandru Croitor
c7ec7cd2a1 Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
2019-08-15 16:53:19 +02:00