Commit Graph

41640 Commits

Author SHA1 Message Date
Leander Beernaert
e619a387fb Extend globbing support in resources
Extend globbing support in resource in order to be able to handle
globbing expression present in qmake expression such as
RESOURCE.files = *.qml

Change-Id: I55a38c0bdc231a6a1ddbd65be7f57ca6f7dc2932
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-20 08:21:59 +00:00
Johan Klokkhammer Helsing
d6a491d607 CMake: Use FindWaylandScanner.cmake from extra-cmake-modules
Change-Id: Iaf78f215396671fc6f351ac20e686cfd2c39664f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-20 07:28:32 +00:00
Cristián Maureira-Fredes
3b7aa8aee8 pro2cmake: skip tuple declaration on condition str
In some cases after cleaning and simplifying the conditions
you can end up with the following line:
    ((()))
Python interprets that as an empty tuple:
    >>> a = ((()))
    >>> a
    ()
and then the simplify_condition (sympy) method fails to continue
with an error:
      File ".../util/cmake/pro2cmake.py", line 1993, in simplify_condition
        condition_expr = simplify_logic(condition)
      File ".../sympy/logic/boolalg.py", line 2292, in simplify_logic
        expr = expr.xreplace(dict(zip(variables, s)))
    AttributeError: 'tuple' object has no attribute 'xreplace'

You can see this behavior with the file:
    qtmultimedia/tests/auto/unit/multimediaqml.pro

Change-Id: Ied4285b67f1e567660be49f6610311199bc48a22
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-20 06:38:56 +00:00
Alexandru Croitor
c40cc543d0 Display message when trying out SIMD tests
This clarifies the weird pause when configuring, right after
the HAVE_reduce_relocations test.

Change-Id: I0edcbbd085286c20c4eaea8d8e15a509ec93d85f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-19 21:43:01 +00:00
Mårten Nordheim
25c53ce00e PCH: Only enable automatically for libraries/modules
Some tests are changing headers using defines inside the tests.
Let's more closely mirror what qmake does to fix this. And it will also
save quite a lot of space since most tests don't include all of
e.g. QtCore

Change-Id: I6f7e530f922418944d690bd2a1ee5f459ba755e1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-19 17:33:20 +00:00
Alexandru Croitor
13b54ea477 Re-add dependencies.yaml so repos outside qt5 can be built with Coin
Change-Id: I732f4f7520e49ec0cca8a497638fa389fc7bc032
(cherry picked from commit 575aa0d201)
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-19 17:07:36 +00:00
Joerg Bornemann
f5fef44df0 Fix add_qt_gui_executable for non-Gui projects
...which is needed, because pro2cmake thinks everything is a Gui project.

Change-Id: Ib68f3eb0e796365e03b3805a3f742824cc263157
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-19 15:18:37 +00:00
Leander Beernaert
2feb54b15b Store generated resource files in hidden directories
Store generated qrc, cpp and qmlcachegen file from invocations of
add_qt_resource/qt6_add_resources/qt6_process_resources under .rcc
in the target's binary directory.

Change-Id: I844f97acfabe6b54db85e7a7a0c9c25694452bd3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-19 14:33:58 +00:00
Cristián Maureira-Fredes
9bc3968aae pro2cmake: exclude 3rdparty libs from examples
There are some libraries inside examples that cannot be
properly translated due to the fact that the is_example
variable is True.
This condition excludes it, for example:
    qtmultimedia/examples/multimedia/spectrum/3rdparty/fftreal/

Change-Id: I68a1e7d1684ab4604f54b6d16bf88d04e3214ba9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-19 14:16:25 +00:00
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
Cristián Maureira-Fredes
3ba61c0354 Check if Qt source dir is not empty to use syncqt
In an extreme case where /bin/syncqt.pl does exists,
is better to check if the QtBase_SOURCE_DIR is not empty
to avoid a mismatch script version that is being used.

Change-Id: Ia5694eadc5517998b827eccf70bdf6f3c14ebfa3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-18 15:26:26 +00:00
Leander Beernaert
1496a88429 Fix QtDeclcarative static builds
Incorrect variable name was being used to set the target in the parent
scope.

Change-Id: I73ea644ebf94c9b9a62b34b1ad493e488729ff2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-18 14:28:29 +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
655b2ed90c Re-generate main module CMake files
This fixes the calls to add_qt_docs to include the target.

Change-Id: I2c4c807bca8faa48bb49f4b8710035f21abfca0e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-18 09:45:23 +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
7885beec15 Fix typo in CMake Android setup instructions
Change-Id: I793283080dbd8e208c136e368036721a00e9fee2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-09-18 07:26:14 +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
Alexandru Croitor
a0e3c1b399 Print build instructions when configuring qtbase
This is similar to how we show the instructions when configuring
in qmake land.

Change-Id: Iabd28acc3d74fd0175eab812a412744dac89e6f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-17 17:13:38 +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
Mårten Nordheim
89e347ba42 Fix for getting windows running tests
By adding the path to the DLLs early on in the path. This fixes the
issue seen in CI (0xc0000135, DLL not found) and resolves local issues
where you might have forgotten to add this to path yourself potentially
grabbing libraries from elsewhere.

The ${path} seems to be a holdover that is no longer used, so it was
removed while the code was changed anyway.

Also disable WIN32_EXECUTABLE for all tests so that we can actually get
some output from them :)

Change-Id: Iec42c809c37be4f31c7f0a7af3a30c3528022dbe
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-17 17:11:59 +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
Alexandru Croitor
6bfe16922a Teach automoc to run moc when it sees Q_ENUM_NS
Needed for qtcoap, otherwise AUTOMOC doesn't run moc
on qcoapnamespace.h.

Change-Id: I4ca43fcbbc5db6163f9f9f788b920eae86f5b174
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-17 08:49:56 +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
Simon Hausmann
0f312d3c02 Prospective fix for QtGui private symbol versioning
In qmake, the header files used for private symbol versioning is done
via

    private_api_headers = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.QPA_HEADER_FILES

So we must do the same with CMake.

Change-Id: Iaebeb13592241b6c4d89f70d2e6ac3ebfb374207
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-17 08:06:28 +00:00
Alessandro Portale
736397ba4b cmake/README.md: Make more obvious how to set BUILD_EXAMPLES/TESTING
BUILD_EXAMPLES and BUILD_TESTING are supposed to be defined via arguments
when executing cmake. The current text does not make that clear. Change
the wording, so that it matches other places in the document that explain
which cmake arguments to set when.

Change-Id: I058cf9d6bc7660c9f4820e2a7342bc64e99d6a72
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 14:51:14 +00:00
Frederik Gladhorn
ed487cb00a CMake: Fix detection of AT-SPI-2 on second run
The if around the find logic meant that the module was never shown as
found after the first round.

Change-Id: I3dd47b37baf7c630c54adbce6872b99f9ff56ad0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-16 14:47:51 +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
Leander Beernaert
4b698b33fd Fix merge typo in QtResource.cmake.in
Output target was named output_target_quick instead of just output_target

Change-Id: I3ee0598bb61e654e42cb82b84da46f292d87e2cb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-16 12:24:14 +00:00
Leander Beernaert
21dd3624a5 Fix OUTPUT_TARGET propagation in qt6_add_resource()
Value was not being propagated to the parent scope when set.

This patch also changes OUTPUT_TARGET to OUTPUT_TARGETS since it is
possible that two targets can be generated.

Change-Id: If489a609ed363a319224fcd6c5a4fc878d0d8617
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-16 11:41:48 +00:00
Mårten Nordheim
5884f793b9 Don't set the MODULE_HEADER property on header-only modules
They're INTERFACE-type targets and can thus only have whitelisted
properties set. That fixes the cmake configure step for the UiPlugin
target in qttools.

This has the unfortunate side-effect that the headers will not be picked
up for our pre-compiled headers. Although it is not a big issue since we
don't have many header-only modules. An example is QtTools' UiPlugin.

Amends 2cf0ba1fba

Change-Id: If722928f64727ffaf2e9d0746668c0198fa1a647
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-13 11:19:46 +00:00
Alexandru Croitor
7857256f59 Regenerate src/testlib
Change-Id: Ia0208ebffc2ad9c87595533d6c09d3f4f068613d
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-11 19:37:19 +00:00
Alexandru Croitor
5486648a20 Regenerate src/printsupport
Change-Id: I9aeb6408cac243c5b5c55b1f14db1f4ef90996f3
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-11 19:37:06 +00:00
Alexandru Croitor
92c8f0df8c Regenerate src/opengl
Change-Id: I68738f98cab12e888a49f52ba8fbd6901752ccd2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-11 19:36:47 +00:00