Commit Graph

416 Commits

Author SHA1 Message Date
Alexandru Croitor
dd57f99004 pro2cmake: Handle source files in example scopes
Change-Id: I653801d6b13eb144719a4e6eac4779b1cd15e75c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-11 12:40:47 +00:00
Alexandru Croitor
0a85f4f834 pro2cmake: Handle simd assignments in scopes
Make sure to process simd assignments in scopes by enclosing
the add_qt_simd calls into if blocks.

Change-Id: I3c7f2466cfa5bb0136d40deffb190ea8aabfb572
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-11 12:40:27 +00:00
Leander Beernaert
dbb29e8235 Expand test install path
Expand target.path value for tests.

Change-Id: Ic35122b0ef1440950c0ef2ba9a04e8697ca2cdfe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 12:14:28 +00:00
Simon Hausmann
f2d15b9683 Minor fix to qt_process_qlalr API
It's probably best to make it follow the usual calling convention that
the associated (consuming) target is the first parameter of the
function. So first this change accepts both formats.

Change-Id: I1f20706b23d5e819e0eb689eecedb3afb49df3b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 12:02:08 +00:00
Leander Beernaert
1dd82a8843 Add SKIP_INSTALL to add_qt_plugin()
Provide a SKIP_INSTALL argument to add_qt_plugin for test cases with
plugins lacking install information.

Change-Id: Iddb3843fab1790d69d64686530a46057a2ff0477
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 09:23:13 +00:00
Alexandru Croitor
fd431fadc1 Fix styling of configurejson2cmake script to make flake8 happy
Amends a986455d10

Change-Id: I5a6327f5bfd9d73e518f0ec1d9bb418282c45077
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-11 09:20:19 +00:00
Alexandru Croitor
a986455d10 configurejson2cmake: Re-add wayland_server library for qtbase
Now there are two of them, one used in qtbase and one in qtwayland.
In the future we should merge them.

Amends 08aba5ea0a

Change-Id: Ife98df28c762836277a02a34dd07e82ce7a1e871
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-10-11 09:17:09 +00:00
Frederik Gladhorn
ffb28b9930 cmake scripts: format with black
There is agreement to use black for formatting, run it and make flake8
happy with its output.

Change-Id: I800d764a50cacba0eac1d8efb5c1dee0cf10a4ad
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-11 08:13:54 +00:00
Frederik Gladhorn
2d1aee8595 cmake scripts: minor cleanup
not in is considered easier to read and thus recommended (flake8) and
avoid one temporary name that is never used.
Adjust flake8 to be compatible with black formatting.

Change-Id: Ia049adb2344f11b53c78574972f6d9d670f4e66d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-11 07:49:20 +00:00
Frederik Gladhorn
c31f2683cc cmake scripts: make pro_conversion_rate.py mypy clean
Change-Id: Id5b210361b6df61bb54324507fcff259cc4091e4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-10-10 14:59:55 +00:00
Leander Beernaert
20f4f50a3a Fix invalid condition in module generation
Fix invalid condition which would cause valid qt modules not to be
written out as modules.

Change-Id: Id4b408f2502a34c011595c4602145b6980ee9d58
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 14:51:37 +00:00
Alexandru Croitor
f1be97e01e Reformat conversion scripts with black
Change-Id: Ida7d42dc86c81315bc0727839a620fb68b7f0268
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 14:35:52 +00:00
Frederik Gladhorn
174b17d65d cmake scripts: flake8 cleanup
At least setting the example install dir looks like a bug.

Change-Id: Ibcced739d05de5445fa455e509cc6f42b9ed935b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 14:26:49 +00:00
Leander Beernaert
6167031ecc Add 'add_cmake_library' to QtBuild.cmake
Add add_cmake_library to allow us to create normal cmake targets using
all the information we have collected via the conversion script.

This function is only meant for tests. For an example,
see tests/auto/corelib/plugin/qpluginloader/lib/lib.pro.

Change-Id: I738cb8ac241b8da1a1da3ef957c24dc7a754d43f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 14:15:06 +00:00
Frederik Gladhorn
441a9f562e cmake scripts: add portalocker as dependency for Pipenv
Change-Id: I0b377e042a7abe69664776a6676df53e601c07af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 13:58:26 +00:00
Frederik Gladhorn
cac594683d Add a makefile to conveniently run python tests
Change-Id: I9b1bbc9b21d9292eac60715116f02533563fa606
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 13:47:24 +00:00
Leander Beernaert
ec706c05e1 Set STATIC argument for plugins
Set the STATIC argument when we have 'static' in the qmake
configuration.

Change-Id: Ia8369bbd5ec4cfce0be51f36c61a811d53522729
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 13:37:23 +00:00
Frederik Gladhorn
a5060e9f99 cmake scripts: move parser into separate file
The code is nicely separated between parsing and processing. Splitting
that into two files makes it easier to follow which function belongs to
which part.

Change-Id: I576b8613b0d05b2dae3f9c6fa65d9ed5b582a0f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 13:35:43 +00:00
Frederik Gladhorn
2659d31d93 cmake scripts: fix test_scope_handling
The file parameter for a new Scope got renamed to qmake_file.

Change-Id: I6cb9d010892f3e3132fac09eead1dbf45d6ba86d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 13:12:38 +00:00
Leander Beernaert
b42feb02ce Add install directory for plugins without type
When we run into a plugin that does not have a type and is not a
qml plugin, we try to see if we can find the target installation path
and provide INSTALL_DIRECTORY AND ARCHIVE_INSTALL_DIRECTORY to the
add_qt_plugin call.

We run into this frequently with the unit tests.

This patch also changes add_qt_plugin() to use the value provided in
INSTALL_DIRECTORY for ARCHIVE_INSTALL_DIRECTORY if no value is provided
for the latter.

Change-Id: I61278904a4d2d72308079cd362bd085b4e2f540c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-10 13:06:51 +00:00
Frederik Gladhorn
fbf2759598 cmake scripts: add mapping for mkspec conditions
Improves for example tests/auto/tools/moc/moc.pro conversion.

Change-Id: I80f82be75299a0407be510824df35f0ea101c0c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-10 12:10:56 +00:00
Alexandru Croitor
fbace1f4e0 pro2cmake: Make condition cache work well with run_pro2cmake
When using run_pro2cmake, multiple pro2cmake processes try to access
and override the condition cache.

Make sure that reads / writes of the cache file are protected by
a file lock, and the content is merged rather than overridden.

This requires use of a new pip package, portalocker.
The script will tell the user to install it if it's missing.

Change-Id: I44798c46ff0912981b186bec40e3e918f249fb4d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-10 10:04:50 +00:00
Frederik Gladhorn
3a9bca6574 cmake scripts: when writing resources, replace OUT_PWD
Needed in tests/auto/corelib/plugin/qfactoryloader/test/ for example.

Change-Id: I5a2904e25d2895355fe11d4fc3e2e7c742346e42
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 07:17:41 +00:00
Leander Beernaert
4691b4fbae Use regular -framework for examples
Do not replace framework libraries in examples as they tend to use only
system level frameworks.

Change-Id: Ide604b3ecc90f1f4c81b9ddaaa8e0a5acb486080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 14:40:03 +00:00
Leander Beernaert
decce2cd76 Extract public/private libraries from scope for Examples
Public/public libraries were always processed from the global scope.

Change-Id: I1223f04f100f91790ced1da41fda2fb9b52c5987
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 12:15:13 +00:00
Leander Beernaert
5484629f2b Add scope conditions for examples
Update example conversion to process scopes and conditions.

Change-Id: If1bbbd25092a8d5371b2d1fa2830d91e5aa591c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 11:59:25 +00:00
Frederik Gladhorn
c0618eb583 cmake scripts: Do not add empty child conditions into condition list
c.condition can be None, there is no point in adding it into the set of
conditions.
An example is tests/auto/corelib/codecs/qtextcodec/test.pro

Initializing the set to an empty set instead of None makes mypy happy,
since we could otherwise end up passing None where frozenset was expected.

Change-Id: If88a86d810b4c55aae7f1ee97a62db559abfc86d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 11:30:30 +00:00
Frederik Gladhorn
03f365f93e cmake scripts: fix conversion of qmldir files
I broke the depends in 3a103b3608 wrongly
assuming it was dead code. Bring it back and actually fix the type to be
a list of tuples.

Change-Id: I96f04843ff2e2293969b5ba0efe02fb51dc88404
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 11:19:25 +00:00
Leander Beernaert
af7b0534c6 Correct Examples install directory
Set the example install directory based on the path specified in
target.path qmake property.

Change-Id: Ia791995a3241fbf2f5ea1e48f2b9f93a90f1c3d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-09 10:31:31 +00:00
Frederik Gladhorn
f959882616 cmake scripts: more type cleanup
Change-Id: Ic32394548bb997af96756f260b453e830d8b9e9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 09:14:19 +00:00
Frederik Gladhorn
3a103b3608 cmake scripts: fix type issues
Some of the changes are just cosmetic, but a bunch of them must be bugs,
such as mixing lists and str randomly.

Change-Id: Idd8340e17bcea7af3b87e595e251e13f5df1aa3f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-09 09:13:44 +00:00
Frederik Gladhorn
b7adc85642 cmake scripts: do not redefine built-ins
Try not to override built-ins, the code becomes confusing to editors and people.

Change-Id: I9e9421e1506a206551ccfc550f882a075e208181
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-08 19:25:20 +00:00
Alexandru Croitor
f7bb15a11b pro2cmake: Ignore QTRO_SOURCE_TREE if unused
Gets rid of new flood of QTRO_SOURCE_TREE unused commented lines
when regenerating projects.

Amends 152c593423

Change-Id: I5485643459078cd53face3080aa600df7d082595
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 16:56:23 +00:00
Joerg Bornemann
152c593423 pro2cmake: Handle QTRO_SOURCE_TREE
...which is the source root of qtremoteobjects.
Set to CMAKE_SOURCE_DIR for now.

Change-Id: I6797e170749ed01bbc1bac4daa7709d3aae1f84b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-08 16:01:36 +00:00
Joerg Bornemann
1aaa53b6db pro2cmake: Handle REPC_{SOURCE|REPLICA|MERGED}
Change-Id: I7c058bdc5a93038e7b67a727125c315062560d8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-08 16:01:27 +00:00
Joerg Bornemann
37c330fe07 pro2cmake: Handle QLALRSOURCES
Change-Id: I8e6b2d542c96947d487b934c27544a8a4ae8745c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-08 15:48:39 +00:00
Joerg Bornemann
82c86856d1 pro2cmake: Use get_files for STATECHARTS
...to get proper variable replacements.

Change-Id: I533a6abfbc7721313840fd75125eeaa7b26f2eba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-08 15:48:30 +00:00
Leander Beernaert
5260c1d62a Update add_qml_module() to use INSTALL_QML_FILES
Update add_qml_module() to use the new INSTALL_QML_FILES argument from
qt6_add_qml_module().

This patch also updates pro2cmake.py to remove the QT_QML_SOURCE_INSTALL
property from qml files.

Change-Id: I6623b2de76bb55bd6750e48f7d45c53ca536b391
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 13:42:17 +00:00
Alexandru Croitor
a546492481 pro2cmake: Allow skipping regeneration of a project via inline marker
If a CMakeLists.txt file has the special marker
 # special case skip regeneration

then pro2cmake will skip the convertion of the .pro file that is
present in the same folder as the CMakeLists.txt file.

The --ignore-skip-marker can be used to force conversion of such
a project file.

Change-Id: I73aae742d1843148b5c22217cb3fc6b0f8e87b82
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 13:11:42 +00:00
Alexandru Croitor
361a24ae1c run_pro2cmake: Fix the file preference sorter
When invoking the script with "." as the only argument, and there
are multiple .pro files in the current directory, the script would
not choose the correct preferred .pro file (the one that has the
same name as the current directory).

Fix the sorter to handle such a case.

Change-Id: I6df70d7c577649f8854bca9b8879f13bdb1b4d26
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 11:42:15 +00:00
Alexandru Croitor
d56e627427 pro2cmake: Don't add default Qt libraries to bootstrapped tools
Change-Id: I3ccc20ed5fcd2eaceb5af09df4a8bf7ccb2d525f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 22:46:09 +00:00
Alexandru Croitor
887a56f8cc pro2cmake: Handle parentheses in if() scopes better
The unwrap_if handler just removed the if keyword from a condition
expression, and return the rest of the condition as-is. This proves
not be enough, because map_condition splits on spaces and tries
to map platform keywords, which would fail for values like "unix)".

Change unwrap_if to add additional space between the values in the
parentheses.

Change-Id: I769ab430363d008a9fd91eaba014c88bd5ee43bd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 22:44:55 +00:00
Alexandru Croitor
dca364ed19 pro2cmake: Fix QT_BUILD_TREE variable mapping
CMake doesn't have a PROJECT_BUILD_DIR variable, but it does have a
PROJECT_BINARY_DIR variable.

Note that this might still be the wrong thing to do according to
35a30c7ebb , but it's still somwehat
better.

Change-Id: I493f82a791d933a16011d91774aaac4bcaffc5e5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 22:44:42 +00:00
Alexandru Croitor
b86630b4b0 pro2cmake: Allow disabling condition cache
New option --skip-condition-cache allows forcing recomputation of
condition simplification.
Useful when debugging certain condition mappings.

Change-Id: I68a85c2e4085ad7a3043d7334db71a334a6469e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-07 13:36:11 +00:00
Frederik Gladhorn
f55565b77a Fix pro2cmake.py path replacement
I forgot to add .items() in ed35e1ac84.

Change-Id: Ic46134daffa8f1a1b5b59040c8bcca76d32dbb35
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-07 09:16:18 +00:00
Frederik Gladhorn
ed35e1ac84 CMake: clean up target.path and DESTDIR replacements
Change-Id: I0891008cff939aa98b39a28a23710add0781901e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-07 08:58:37 +00:00
Frederik Gladhorn
123ef6c391 CMake: allow $$[QT_INSTALL_PREFIX]
This is used in QtPurchasing.

Change-Id: I29c3a87d844eeaf3fd1b64057e33d64054f14a89
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-07 08:57:58 +00:00
Frederik Gladhorn
7bca6edc16 cmake: add tests in corelib/serialization
The DEFINES -= QT_NO_LINKED_LIST is no longer needed, so just remove it
from .pro and CMakeLists.txt.
Handle $$[QT_INSTALL_TESTS] and $$TARGET in target.path.
When we have DESTDIR set, do not use target.path for OUTPUT_DIRECTORY.

Fixes: QTBUG-78219
Change-Id: I5161a955b25ff2f3b35428dc4b935a7c9d2d425b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-10-07 08:57:31 +00:00
Leander Beernaert
9e5e98047e Add expansion for QQC2_SOURCE_TREE
Test in QtQuickControls2 rely on this variable, which basically points
to the root of the project. We can't use PROJECT_SOURCE_DIR since it
will vary depending on whether we build tests as stanadlone or part
of the build.

Change-Id: Ic59a79af2b4b62611d6c32391c936e98e469dea0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 07:46:11 +00:00
Frederik Gladhorn
a98f64af91 cmake: add more tests in corelib/thread
This fixes the qatomicinteger magic by making $$basename work for one
particular case.

qthreadstorage still needs investigation.

Task-number: QTBUG-78221
Change-Id: I7bb38f6ca24273bcf0443ab25685c8e815814c3c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-04 06:27:19 +00:00