Commit Graph

984 Commits

Author SHA1 Message Date
Leander Beernaert
681e8b4ead Add add_qt_manual_test()
This patch adds add_qt_manual_test() which is a simple wrapper around
add_qt_executable() which does not build under ${CMAKE_BUILD_DIR}/bin
or install the targets.

This could potentially be used later to tag manual tests.

Change-Id: Ic4e0a1d133009f5a858b9394347a0996cf42683f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 14:46:44 +00:00
Alexandru Croitor
f33069be24 pro2cmake: Consider _LOADED operations as always processed
To remove wrong unused keys comments from the project file.

Change-Id: Ib52b1738b6136a54f6accb86156b9b2609f331c3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-11-12 14:18:58 +00:00
Alexandru Croitor
a0967c2a4f pro2cmake: Handle operation evaluation order when including children
Instead of processing included_children operations either before or
after the parent scope, collect all operations within that scope and
its included children scopes, and order them based on line number
information.

This requires propagating line numbers for each operation as well as
line numbers for each include() statement, all the way from the
parser grammar to the operator evaluation routines.

This should improve operation handling for included_children
(via include()), but not for regular children (introduced by ifs or
elses), aka this doesn't solve the whole imperative vs declarative
dilemma.

Sample projects where the improvement should be seen:
tests/auto/gui/kernel/qguiapplication and
src/plugins/sqldrivers/sqlite.

This amends f745ef0f67

Change-Id: I40b8302ba6aa09b6b9986ea60eac87de8676b469
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 11:47:42 +00:00
Leander Beernaert
026471378d Add mapping entry for LinuxOfonoSupport
Change-Id: I4c88b58cad6b4f4a88f02a38dd84d3a667bcc063
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:27:51 +00:00
Alexandru Croitor
d7c4fa46ac pro2cmake: Allow skipping subdirs projects via command line
Pass either --skip-subdirs-project to pro2cmake or
--skip-subdirs-projects to run_pro2cmake.

Change-Id: Ic444858f6fc6deb3c893782c0770993aa39d5579
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:13:24 +00:00
Alexandru Croitor
c1e0e0adb2 pro2cmake: Fix incorrect replacement of x86 conditions
The regular expression used to eat the character that comes after
the x86 token, which was incorrect when matching x86SimdAlways.

Fix the regular expression to use a lookahead with a negative
character class of word characters.

Change-Id: I9ed8f9a490369bf5704b752f8bba3b7118a2cd5b
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:13:13 +00:00
Alexandru Croitor
4fe8330b5b pro2cmake: Fix formatting and mypy errors
Change-Id: Ic41998c39f5f5b890b3aa8ec43c6f3f03fee54da
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:13:02 +00:00
Alexandru Croitor
2c66bdde5a pro2cmake: Skip errors regarding not found generated .pri files
A lot of project files include files like qtsqldrivers-config.pri
which do not exist when running pro2cmake. It should be safe to hide
this error messages when converting projects.

Change-Id: I4205010e537f67f9b276b4cb94ec30f847c43c68
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:12:50 +00:00
Alexandru Croitor
37ab7eae9d pro2cmake: Clean up debug messages
Don't needlessly show a bunch of special case debug messages
unless debugging is enabled.
There used to be a barrage of scary message when using
run_pro2cmake.

Change-Id: I49ab3522e11844a99653034b5f15a634a368d227
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:12:35 +00:00
Alexandru Croitor
de3a806def Make standalone tests build via top level repo project
Previously repo/tests/CMakeLists.txt was a standalone project on which
CMake could be called. This was useful for Coin to be able to build
and package only tests, but was a bit troublesome because that means
having to specify the usual boilerplate like minimum CMake version,
which packages to find in every tests.pro project.

Instead of having a separate standalone project, modify the top level
project and associated CMake code to allow passing a special
QT_BUILD_STANDALONE_TESTS variable, which causes the top level project
to build only tests, and find Qt in the previously installed qt
location.

This also means that when building a repo, we generate a
${repo_name}TestsConfig.cmake file which does find_package on all the
modules that have been built as part of that repo. So that when
standalone tests bare built for that repo, the modules are
automatically found.

qt_set_up_standalone_tests_build() is modified to be a no-op because
it is not needed anymore. Its usage should be removed from all the
other repos, and then removed from qtbase.

Non-adjusted tests/CMakeLists.txt projects in other repositories
should still be buildable with the current code, until they are updated
to the new format.

Adjust the Coin build instructions to build the standalone tests in a
separate directory.

Adjust pro2cmake to generate new structure for the tests/tests.pro
projects.

Adjust the qtbase tests project.

Fixes: QTBUG-79239
Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-08 15:42:32 +00:00
Leander Beernaert
942d391b53 Add condition maps for special cases in tests/manual
Change-Id: I426766c68f6f118d0706455689d968534e406d3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-08 10:27:54 +00:00
Leander Beernaert
706e7fdb0c Add generic lessThan|greaterThan|equal condition map to pro2cmake.py
Change-Id: Ib611aa9a808a05b38a83bd3fd7d95081bdf6e256
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-08 09:56:30 +00:00
Leander Beernaert
512aae3abe Fix Android x86 builds
Replace condition x86 to i386 to match other platforms.

Regenerate src/gui/CMakeLists.txt

Disable SSE4 on android x86 to match qmake.

Change-Id: Ic0d330206f2d70a79d72553aa3ff0f91ff58119c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-08 09:40:24 +00:00
Qt Forward Merge Bot
78c687f98e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I963b5f48b5d6f3500ca379fbd7f1a4290b570175
2019-11-08 09:11:02 +01:00
Qt Forward Merge Bot
e3cc16e9fb Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	.qmake.conf
	mkspecs/features/mac/default_post.prf
	src/corelib/tools/qsimd_p.h
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	util/qfloat16-tables/gen_qfloat16_tables.cpp

Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
2019-11-06 11:41:19 +01:00
Leander Beernaert
cd9813d276 Add support for benchmark conversion
Convert benchmark executables to add_qt_benchmark().

Currently add_qt_benchmark just calls add_qt_executable() and
ensures that it they build under CMAKE_CURRENT_BUILD_DIR and do not
install.

Add QT_BUILD_BENCHMARKS option to enable/disable building of benchmarks.

Change-Id: Id0bc676698d21d50048d97d9abef51d92ccb6638
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-04 15:48:30 +00:00
Frederik Gladhorn
5c6cf6692e Prevent infinite recursion
In qtvirtualkeyboard/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri
we have TARGET = $$TARGET$$qtPlatformTargetSuffix which keeps on recursing.

Change-Id: Ia0e020c7258cd87bba9b9681ed7b4568e8f0c9c2
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-01 09:43:12 +00:00
Edward Welbourne
c3eb521a0f Update UCD data to Unicode 12.1.0's Revision 24
Had to teach the update program to accept category Lm as for
Joining_Transparent, for the sake of a new ArabicShaping.txt entry.
Added three new Unicode versions, several new scripts and a new
word-break class.

Updated UCD's test data for tst_QTextBoundaryFinder.  This left 57
tests failing; I have commented out the data rows for those tests,
pending someone with more knowledge addressing this.

Task-number: QTBUG-79631
Task-number: QTBUG-79418
Change-Id: Ic33d3b3551195d47a84d98e84020f57a68f0b201
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-30 17:38:02 +01:00
Simon Hausmann
3e5e7b8201 Fix formatting to conform to black rules
Ran make format.

Change-Id: Ib4fc021c30834a69a9a5df653435dd92dc6a9c05
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-29 09:28:26 +00:00
Leander Beernaert
4046b970e7 Add replacement for '*g++*' to pro2cmake.py
Change-Id: I3dc04a6169a98b7ff22392b979e743c41d6e0475
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-28 10:40:46 +00:00
Leander Beernaert
69fb4ae343 Distinguish between qt_plugin and regular plugins
If we do not encounter the load(qt_plugin) statement in the .pro file
but we do see the entry CONFIG+=plugin, treat the target as a regular
CMake library instead of treating it as a qt_plugin by default.

Change-Id: I67ad5c865a1a5ab691a6b0d86c2db4b686aa04dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-28 09:20:37 +00:00
Edward Welbourne
43f64b4dc8 Update CLDR to v36
Released on October 4th.
Adds Windows names for two time zones, Qyzylorda and Volgograd.
Added languages Chickasaw (cic), Muscogee (mus) and Silesian (szl).

Norwegian number formatting has flipped back to using colon rather
than dot as time separator; it's flipped back and forth over the last
several CLDR releases.  The dot form is present as a variant, the
colon form was long given as the normal pattern, then went away; but
now it's back as a contributed draft and that's what we pick up.

The MS-Win time-zone ID script was iterating a dict, causing random
reshuffling when new entries are added. Fixed that by doing the
critical iteration in sorted order.

Omitted locales ccp_BD and ccp_IN due to QTBUG-69324.

Task-number: QTBUG-79418
Change-Id: I43869ee1810ecc1fe876523947ddcbcddf4e550a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-10-25 11:44:48 +02:00
Edward Welbourne
6852ba815d Correct some references to corelib/tools/ to say corelib/text/
The Unicode data tables moved with QString and friends.
So did the locale data generated from CLDR.

This amends commit a9aa206b7b.

Change-Id: If12f0420b559dcb78993adc00e9f39751bca684a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-25 11:44:27 +02:00
Edward Welbourne
a9ac6c89be Compile-fixes in the generator for qurltld_p.h
This is a follow-up to c0ab2ad98f.

Change-Id: Ic05d80fa0561f7609703407cc58a0caccbcb1061
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-25 11:43:04 +02:00
Leander Beernaert
d5dc755c65 Convert ANDROID_PACKAGE_SOURCE_DIR for android (pro2cmake)
Change-Id: I76730852e4433d095bc42ff617254a77f2d1bf51
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-23 08:11:47 +00:00
Frederik Gladhorn
f745ef0f67 cmake scripts: do not override local target through includes
This is needed for tests/auto/gui/kernel/qguiapplication which includes
the qcoreapplication test. Without this change, the target name is taken
from the included .pro file, instead of from the current file.

Change-Id: I2d8a207fd70a49ad956fb9a83a59811d89682082
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-23 08:07:54 +00:00
Frederik Gladhorn
61fa61ec16 cmake scripts: do not add spaces in empty lines
When adding resources inside a condition, we'd end up with lines
containing just spaces.

Change-Id: I623203d042e2492bdd72f97d8b9d90517040b0df
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-23 08:07:30 +00:00
Frederik Gladhorn
ccdbd32416 cmake scripts: handle aix-g++
Change-Id: I62b9e9fa9aae3350dc8c668a98453c2373c1a709
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-23 08:07:18 +00:00
Leander Beernaert
58964af094 Handle Library dependencies in compile tests
Update configurejson2cmake.py to also write out the libraries compile
tests depend on.

Change-Id: I22dbc227a33b9b5d39a2198c6ee6062e7e1bf3de
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-21 14:36:35 +00:00
Leander Beernaert
373be4200b Add conversion code for Java code
Add support to pro2cmake to convert java code for android.

Add support to override API_LEVEL for the Android sdk jar file. If the
sdk is not found, we'll default to the one located by QT_ANDROID_JAR.

Change-Id: If0b746dc7f9148ac43e6592a4a4dd23d46bbd4cd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-18 13:20:46 +00:00
Simon Hausmann
2fa23e46c0 Fix C++ standard detection
We cannot use a generator expression in an if statement, it does not
work. Instead, we could inspect the CMAKE_C/CXX_COMPILE_FEATURES list,
but unfortunately that's not reliable. For example it detects that ICPC
supports C++17 when in fact that depends on the installed libstdc++.
Therefore this patch revives our own configure tests.

Change-Id: Ic3bc5762fbe81837722523e3881ac16e84628519
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-17 16:57:25 +00:00
Oliver Wolff
ca33f45d70 Fix message about missing portalocker
Change-Id: Ia82c0aab7c9085eee8a07c4a15485c0804e65e5a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-10-15 12:23:46 +00:00
Leander Beernaert
355a002704 Fix add_qt_resource condition scopes
Calls to add_qt_resource from extend_target were not being wrapped in
a condition scope.

Change-Id: I78cf889fcf4663660fd870bfb93eec90a4ca1c47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-15 09:07:39 +00:00
Leander Beernaert
1f9d241216 Update android arch condition conversion
Only convert the architectures if they are in a stand alone form. This
means conditions such as 'if(x86 OR x86_64)', 'if(x86)', among others.

This also correctly converts statements such as 'equals(QT_ARCH,x86)'.

Change-Id: I1c3b8580ff9e4077c03a229d894d2bd3d95dba3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-15 08:06:00 +00:00
Alexandru Croitor
190e9dcdcf Regenerate files after dev -> wip/cmake merge
Note the following bigger things that had to be done:
Handle GSS library / feature with a new custom find module.
Implement rudimentary support for relocatability (does not currently
handle extprefix).

Change-Id: Ic6cd27dda7ebca9829f51cb42ea76fff6d1767ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-14 19:01:19 +00:00
Alexandru Croitor
440286655e Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
2019-10-14 17:46:34 +02:00
Simon Hausmann
dcb1253d93 Fix up android architecture suffixing
Don't globally map any variable use of QT_ARCH to ANDROID_ABI, as
that'll break if somebody uses it in a different context. Instead the
CMAKE_SYSTEM_PROCESSOR variable provides a reasonable value and it is
also set by the Android toolchain files.

Change-Id: Ibf203c39db586bbec5b800a365d83b3a509dbb62
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 14:38:48 +00:00
Leander Beernaert
6694689a26 Fix Android build from multi-arch qmake changes
Add condition replacements for the android ABIs.

Add a replacement for QT_ARCH to ANDROID_ABI, since QT_ARCH is only used
with the android build for now.

Change-Id: I553d7910546de32236f723ec2e9a05a18da76130
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 13:49:40 +00:00
Leander Beernaert
665f75f1f1 Run blake on pro2cmake.py
Change-Id: I16cc7058f817d22e2c72fb6d42c472250a7e6cfb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 09:14:59 +00:00
Leander Beernaert
d62a2797ae Handle empty contents for condition scopes in examples
Only print condition scopes when there is something to print.

Change-Id: I24151ca4834317940712b6173046abe91aac5628
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 09:11:29 +00:00
Alexandru Croitor
f4b4c4f79b Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
2019-10-11 16:23:19 +02:00
Joerg Bornemann
9bd6cec74d pro2cmake: Translate C++ standard version checks
Translate checks like
    contains(QT_CONFIG, c++11)
to
    cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES

Also allows contains(CONFIG, c++11) and different versions of course.

Change-Id: I0f51a1ee7c92df6b87c31d0fb64c22fdba2002ec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 12:49:26 +00:00
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
Mårten Nordheim
c718213548 Make SDL2 library-mapping use a wrapper
Since at least one system provides config files without an included
target.

Change-Id: If1f336aab4cec9704412349d7951849ee8c3dabb
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-03 10:45:58 +00:00
Alexandru Croitor
1b0710a393 pro2cmake: Handle SOURCES subtractions
SOURCES -= foo.cpp statements should now be handled correctly by the
script. The script uses the same principle as for subdir handling:
go through all scopes to collect source removals, and then generate
new scopes with total conditions that take into account both
additions and subtractions and their conditions.

Should handle NO_PCH_SOURCES case as well.

Tested on gui.pro, network.pro and qtconnectivity bluetooth.pro.

Change-Id: I0cc913ef64cecf09e8ada4e6a3ce3ccb4365b44e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-10-01 14:16:14 +00:00
Alexandru Croitor
f23b7e1476 Implement persistent caching for simplify_condition
Store the results of simplify_condition in a json cache file,
next to the pro2cmake.py script.
Dramatically speeds up re-conversion of projects.

The cache is cleared whenever the content of the
condition_simplifier.py file changes, effectively presuming that the
condition computing code has changed.

Sample times.
Initial corelib.pro conversion - 142.13 seconds.
Next re-conversion with hot cache - 1.17 seconds.

Change-Id: I8790b2736358236e4b23bcb5f10f45a36fdfa426
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-01 14:14:16 +00:00
Alexandru Croitor
590213e531 Move sympy condition simplification code into separate file
Change-Id: I3f062bf939b452bb41b7a27508a83cbf93abff8c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-01 14:13:12 +00:00
Johan Klokkhammer Helsing
447c868a5d CMake: Generate wayland protocol code for examples as well
Task-number: QTBUG-78177
Change-Id: Id1c49013244e5ba51b99c1538b314181efe786fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-01 13:49:18 +00:00
Joerg Bornemann
3886828c1f pro2cmake: Add qtremoteobjects
Change-Id: I6cb2ee0c83e0dd3bf830a063f5790e35cbf73285
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-01 08:56:59 +00:00
Jean-Michaël Celerier
309f96ccb6 Add CMake support for directfb plug-in
Change-Id: I126545e1da54018ce081b42a29e62ca30ee04d64
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-30 11:31:54 +00:00
Alexandru Croitor
6f5b1dd9ab pro2cmake: Handle WINDOWS_SDK_VERSION and simplifications
Add custom code to handle WINDOWS_SDK_VERSION comparisons,
similar to how it was done for QT_GCC_MAJOR_VERSION.

Also fix simplify_condition to do mapping of conditions to unified
tokens, similar how it was done for target conditions, so that the
simplification process does not fail because of whitespace.

Change-Id: Ia0cec6e1ffeed4c7859bb2a44423d0160222f425
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-27 08:43:16 +00:00
Alexandru Croitor
316353b3e0 pro2cmake: Handle one more hardcoded condition CONFIG(osx)
We can't really handle this in a generic way now, because the values
of CONFIG() can not be directly mapped to features. It might be
possible in the future if we make sure that all configure.json entries
that have output publicConfig or privateConfig also generate a
feature. For now just hardcode the case.

Change-Id: Ie6b82b87973deb84012c3620b41920b343ffb2da
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-27 08:42:59 +00:00
Alexandru Croitor
7bed351c6c Fix run_pro2cmake only_qtbase_main_modules option
There was a missing f prefix for the f-string, and thus no
replacements were done.

Change-Id: If778d4ce25905c302de22a76c27af00a63f3c515
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-27 08:42:42 +00:00
Oliver Wolff
724281d1aa cmake: Add BlueZ to the list of libraries used by Qt (connectivity)
Task-number: QTBUG-78181
Change-Id: I4eda42c4e42ccb28ebb64eb060d02a33c3af6b03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-25 12:08:54 +00:00
Johan Klokkhammer Helsing
eaf0b27091 CMake: Add missing library-mappings for QtWayland
I haven't checked if the config for wayland-kms actually works, as that
requires building for a target that supports it (RCar M3 or similar).

Task-number: QTBUG-78177
Change-Id: Ib30a63a4e5feb955d17763c37e32ad3f2c13d358
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-25 11:38:22 +00:00
Joerg Bornemann
4b592ba90c pro2cmake: Do not error out if $$files is called with a 2nd parameter
Do not stop the whole conversion if we encounter $$files(..., true).
Ignore the 2nd parameter for now.

Change-Id: If9334ce9719b98c33716dc7f18ba8aede05fe8b1
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-24 17:53:00 +00:00
Leander Beernaert
6e2ca1d6cb Add SKIP_TYPE_REGISTRATION option to add_qml_module
If the qml files are not listed in the qmldir file they do not need
to be written again, since it is expected that they are registered
by the c++ plugin code.

Change-Id: I624aedb182583f942bf1d1a322861c47a64b5065
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-24 12:54:57 +00:00
Joerg Bornemann
c3131f9f5e pro2cmake: Fix call of write_statecharts for examples
Change-Id: I5417a20deda07b96499ac4f2707e7234b0f4eb7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-24 11:45:02 +00:00
Alexandru Croitor
0441e3743e pro2cmake: Don't generate GUI applications for config.tests
On macOS the config.tests executable should not be a bundle,
and on Windows it should be a subsystem console application.

Change-Id: I2c8078cc9537df42683f3ff3bcce409402824555
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-24 09:57:19 +00:00
Alexandru Croitor
1d5e8996b0 configurejson2cmake: Generate label for out-of-line tests
Change-Id: Iaaf8d2f19269043dfad34d4ec32ec8163e9616e4
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-24 09:57:10 +00:00
Alexandru Croitor
9f6e1abfdb pro2cmake: Skip requires "skip build" message for subdir projects
It makes too much noise when configuring.

Change-Id: I0a65cb99d0dc9a6c0d288cf548035cca1bea57bc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-24 09:56:51 +00:00
Johan Klokkhammer Helsing
0bcd50b40a pro2cmake.py: generate code for WAYLAND*SOURCES
WAYLANDCLIENTSOURCES and WAYLANDSERVERSOURCES is used heavily throughout
QtWayland.

Task-number: QTBUG-78177
Change-Id: I4507447054c435f78e82c2ca3e9404288db6c1f6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-24 08:58:18 +00:00
Joerg Bornemann
8049ef3d4d cmake: Implement the ~= operator in pro2cmake
Change-Id: I3fadd0038d517d197cce898d10edd6ba452adea9
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-23 13:09:58 +00:00
Joerg Bornemann
6ff123be87 pro2cmake: Ignore generated .qrc files
...instead of complaining about non-existing files.

qtscxml/tests/auto/scion/scion.pro has
    RESOURCES = $$OUT_PWD/scion.qrc

Change-Id: I5737fe5078c87689152fc7fa0d8d25ddc2b1a00f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-23 11:23:29 +00:00
Alexandru Croitor
d8b18385e8 pro2cmake: Improve handling of requires clauses
Change the grammar to parse and extract the whole expression
that is present in the requires clause.

Make sure to preprocess the parsed content as a condition,
so that the value passed to map_condition and simplify_condition
is valid and the functions can handle more complicated conditions
like qtConfig() and if().

Wrap the final condition with an extra pair of parentheses, so that
the negated condition is computed correctly.

Handle the require clause in subdir projects, top level tests projects,
regular test projects, as well as top level repo projects.

Examples are not yet handled, because the would require some kind of
CMake public api to e.g. query if a feature is enabled.

Change-Id: I9af96cf022e47b66f24db3ca15d3803dda7a5d7c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-23 05:28:31 +00:00
Alexandru Croitor
303095e686 pro2cmake: Fix regexp for parsing env var expansion
The qmake syntax for env var expansion is "$$()".
The parantheses are not optional, so the optional "?"
modifiers should be removed.
This fixes the failing test_recursive_expansion pytest.

Amends c58df80cf7.

Change-Id: I5d7217555287ee7d96d6b38027964b1141af208a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-23 05:28:18 +00:00
Alexandru Croitor
5f856a6d0c pro2cmake: Handle if() conditions with pyparsing
Previously we used a regular expression that matched parentheses,
but the regexp didn't match the parantheses in a balanced way
if there was more than one pair.

Instead use a helper function that uses pyparsing to match
balanced parantheses, and removes the if keyword, leaving
just the nested expression.

Change-Id: Ie621e6a305e57aa411838288599366ccfba063cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-23 05:28:05 +00:00
Alexandru Croitor
f0a22bd78d pro2cmake: Fix regressions introduced by reformat change
Sympy uses eval() inside its code, and that can raise an
AttributeError exception, so we have to catch that.
This happened when converting qml.pro in qtdeclarative.

Also the formatting change removed the raising of an exception
when an unhandled function was encountered in handle_function_value,
which caused not returning any value in such a case.
Instead just return the whole expression string, without checking
if the function is in some whitelist.
Also encountered in qml.pro.

Amends 91634c3c9b.

Change-Id: I47b73af1de0180becb9ef4fb78a8c35a04928d34
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-23 05:27:50 +00:00
Alexandru Croitor
1144c08be8 pro2cmake: Fix default mutable arguments usage
Change-Id: I91f2632f46539a1e5009b598625d78f61a051588
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-22 10:29:20 +00:00
Alexandru Croitor
6920acd894 pro2cmake: Small fixes and adjustments reported by flake8 and IDE
Change-Id: I13fd2f20414647b75c8da237857248808dddaa40
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-22 10:29:11 +00:00
Alexandru Croitor
d6bbf6944c Reformat python files using black
Change-Id: I0cc8ed89e2057b65f4fa34294eccffae642f2c73
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-22 10:29:01 +00:00
Alexandru Croitor
d71609610a pro2cmake: Handle generation of config.tests
Handle conversion of config.tests that are used as out-of-line tests
in configure.json.

The script should able to handle conversion of simple config tests
including nested scopes.
One thing that will probably be needed in the future is handling of
pkconfig which is used in qtwebengine config.tests.

There is also a hardcoded list of config tests which should not be
automatically converted by pro2cmake, either because they were hand
written, or because it doesn't make sense to convert them for now.

Incidentally, we should fix example conversion to also handle nested
scopes, similarly to how it's done for config.tests.

Change-Id: I862e67c4d19d5ed8cb7fc7c9f9aaf6e3d503aa03
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-22 10:27:30 +00:00
Alexandru Croitor
f35cc5090a configurejson2cmake: handle out-of-line config tests
Generate appropriate qt_config_compile_test() calls for config tests
that have CMake projects. These are protected by an if(EXISTS) check
so that configuration doesn't fail for repos where the config tests
have not been ported yet.

Adjust the qt_config_compile_test() function to use try_compile for
projects specified via new PROJECT_PATH argument.

Change-Id: I83c061e384f68688a654b782fd7a9bede282d1e3
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-22 10:27:22 +00:00
Alexandru Croitor
900df48122 Skip converting projects under tests/auto/installed_cmake
Change-Id: Id26320fb55f7f0ae4b18726b0794a4a1f169c80f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-21 15:48:52 +00:00
Cristian Maureira-Fredes
cfa3c64625 Adapt string formatting in util/cmake
Second and final batch of changes related to string
formatting styling.

Change-Id: Ifc0e999ee95fe52fd076ac2f001b4a58f82ab5be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-21 15:48:40 +00:00
Joerg Bornemann
f771b8f6b1 cmake: Let pro2cmake use private statechart API for non-examples
Change-Id: If6206f2377e90ba7f8502029a1cc74856a2e03a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-20 14:43:45 +00:00
Simon Hausmann
9fe82283c6 Add support for requires() statements in top-level .pro files
For example qtserialport has

    requires(!winrt)

and with this patch it gets translated to

    project(...)

    if(WINRT)
        return()
    endif()

    find_package(...)
    qt_build_repo(...)

Change-Id: Ic38b803b464037a42adc55930947f57c5efa7b45
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-09-20 14:10:58 +00:00
Simon Hausmann
9ef4ffb1a4 Add platform mapping for emscripten
EMSCRIPTEN is the name in cmake land as per emscripten's toolchain
file.

Change-Id: I11fa444204003f25f14fbf993ecf6766bf37d884
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-20 14:07:03 +00:00
Oliver Wolff
be3287d779 configurejson2cmake: Add special case handling for Windows BT config tests
Change-Id: Id73c44f5b7faff7392e7a8245e5e26e7dfe78cd8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-20 12:44:58 +00:00
Joerg Bornemann
bb8f8381c6 pro2cmake: Translate STATECHARTS to qt6_add_statecharts
Change-Id: I461768e67ce8fa7dae70a057df340e9c9a2bc14e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-20 11:35:25 +00:00
Tobias Hunger
d245ba48e7 CMake: pro2cmake: Do not mis-report used values as ignored
Do not mis-report "PLUGIN_TYPE", "PLUGIN_CLASS_NAME", "CLASS_NAME"
and "MODULE_PLUGIN_TYPES" as ignored.

The script evaluates these.

Change-Id: I26546a7eff61a20afe68168a865fe3ac99f66319
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-09-20 09:27:51 +00:00
Tobias Hunger
6cefa950e9 CMake: pro2cmake: Handle OBJECTIVE_HEADERS
Change-Id: I9a7b9c96530e8c922cf4aa5b6580e5579829db87
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-09-20 09:27:41 +00:00
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
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
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
Marc Mutz
effbf147a4 QUnicodeTables: use array for case folding tables
Instead of four pairs of :1 :15 bit fields, use an array of four :1,
:15 structs.  This allows to replace the case folding traits classes
with a simple enum that indexes into said array.

I don't know what the WASM #ifdef'ed code is supposed to effect (a :0
bit-field is only useful to separate adjacent bit-field into separate
memory locations for multi-threading), but I thought it safer to leave
it in, and that means the array must be a 64-bit block of its own, so
I had to move two fields around.

Saves ~4.5KiB in text size on optimized GCC 10 LTO Linux AMD64 builds.

Change-Id: Ib52cd7706342d5227b50b57545d073829c45da9a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-09-04 16:35:37 +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
Marc Mutz
2737b5e36a QUnicodeTables: pack Properties struct
GCC doesn't like the sequence

   : 5
   : 5
   : 8
   : 6
   : 8

and inserts a :6 padding between the :5 and the :8 and a :2 padding
between the :6 and the :8, growing the bitfield by 8 bits of embedded
padding and another byte to bring the struct back to sizeof % 2 == 0.

Fix by reshuffling the elements and adding a static_assert for the
next round.

Saves ~5KiB in QtCore executable size.

Change-Id: I4758a6f48ba389abc2aee92f60997d42ebb0e5b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-04 10:06:19 +02: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
Soroush Rabiei
7026645712 Add support for the Islamic Civil calendar
This has its own locale data, extracted from CLDR. This data may
potentially be shared with other variants on the Islamic calendar, so
is handled by a separate base-class, QHijriCalendar, on which such
variants may base their implementations.

[ChangeLog][QtCore][QCalendar] Added support for the Islamic Civil
calendar, controlled by feature islamiccivilcalendar, with locale data
that can be shared with other implementations, controlled by feature
hijricalendar.

Fixes: QTBUG-56675
Change-Id: Idf32d3da7034baa8ec5e66ef847e59a8a2f31cbd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-22 10:10:02 +00:00
Soroush Rabiei
e71bf9d5c7 Add support for the Jalali (Solar Hijri or Persian) calendar
This has its own locale data, extracted from CLDR.

[ChangeLog][QtCore][QCalendar] Added support for the Jalali (Persian
or Solar Hijri) calendar, controlled by feature jalalicalendar.

Fixes: QTBUG-58404
Change-Id: Id5c56a10db05a4fd612aafc01615273db81ec743
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-21 22:18:48 +02:00
Soroush Rabiei
aa8393c94f Add support for calendars beside Gregorian
Add QCalendarBackend as a base class for calendar implementations and
QCalendar as a facade via which to access it.

QDate's implicit implementation of the Gregorian calendar becomes
QGregorianCalendar and QDate methods now support choice of calendar.

Convert QLocale's CLDR data for month names to a locale-data component
of each supported calendar and relevant QLocale methods now support
choice of calendar. Adapt Python scripts for locale data generation to
extract month name data from CLDR (keeping on version v35.1) into the
new calendar-locale files. The locale data for the Gregorian calendar
is held in a Roman calendar base, for sharing with other calendars.

Add tests for basic uses of the new API.

[ChangeLog][QtCore][QCalendar] Added QCalendar to support diverse
calendars, supported by implementing QCalendarBackend.

[ChangeLog][QtCore][QDate] Allow choice of calendar in various
operations, with Gregorian remaining the default.

Done-with: Lars Knoll <lars.knoll@qt.io>
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Fixes: QTBUG-17110
Fixes: QTBUG-950
Change-Id: I9d6278f394269a183aee8156e990cec4d5198ab8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-20 13:41:21 +02:00
Alexandru Croitor
c7ec7cd2a1 Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
2019-08-15 16:53:19 +02:00
Alexandru Croitor
b8dae2c617 Handle test helpers better
Teach pro2cmake to use add_qt_test_helper instead of
add_qt_executable when the qmake 'qt_test_helper' feature is used.

Don't use macOS bundles when building tests on macOS, because that
breaks path assumptions for certain tests.

Introduce a new OVERRIDE_OUTPUT_DIRECTORY option for add_qt_test_helper
that allows placing the binary into a folder other than the test parent
folder. I considered changing the default behavior not to place into the
parent folder, but that would break all existing tests, so I opted for
override approach instead. Ultimately we might want to revisit this
later.



Change-Id: I68fd1dea608333c2af0d3896050b40a6964dd87f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-15 10:56:02 +00:00
Leander Beernaert
7fda42ef9a Rename alias property on source files to QT_RESOURCE_ALIAS
Rename the alias property used by add_qt_resource() to QT_RESOURCE_ALIAS
to match property naming conventions.

Change-Id: I97b12b0b794e158f03dabeed5ec23a3b7d56cfbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-15 09:34:09 +00:00
Leander Beernaert
8630c5ac7e Add support for QtQuikCompiler retained resources
Support translating the QTQUICK_COMPILER_RETAINED_RESOURCES variable.

Fix missing PROPERTIES keyword for set_source_files_properties() commands.

Apply source file properties to standalone source files as they appear
in the project as it was possible for them to inherit values that were
not meant for them.

When creating resource lists, prefix them with the resource name
to avoid collisions.

Change-Id: I69ef85ea9414c0e7c07b1ebfb76d24bd878ce70f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-14 12:45:11 +00:00
Alexandru Croitor
87078650a5 Wrap resource file paths in quotes
This is required for paths that contain spaces, otherwise the .qrc
file generated by the build system is invalid, and the RCC run fails
at build time.

Change-Id: I887100b08052b49dd7ea4dd92b94f357a7d9d16e
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-12 12:41:14 +00:00
Leander Beernaert
e614e837fa Add QT_QML_DEBUG define conversion
Add QT_QML_DEBUG to target when we have qml_debug in qmake's CONFIG
variable.

Change-Id: I266c7313db12667498d4f770c73aec9e79c0b50e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-12 11:42:00 +00:00
Simon Hausmann
1720970102 Fix resource prefix calculation
tools/qml/qml.qrc uses prefix="something", which means that the leading
slash is implied.

Change-Id: Ia856fcef36873442a84b9162f1901cb31ca37b49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 15:56:57 +00:00
Leander Beernaert
3549f51c98 Fix cases where DESTDIR equals ./ or ../
When DESTDIR has relative paths as a parameter we should prefix those
with ${CMAKE_CURRENT_BINARY_DIR} in order for them to be placed in
the correct location.

Change-Id: Ie9e9d656cbb54457bdf99425e3e1b05e09f20d7c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 14:12:49 +00:00
Simon Hausmann
1fc117e29d Add support for immediate resources
Collect files passed to RESOURCES and write out an add_qt_resources()
call. Similarly, for each "object" passed to RESOURCES (not a file),
write add_qt_resources(), too.

Change-Id: Idbb368ebb4d003a48e7c47ebaf53a78f65ebf9b9
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 12:28:24 +00:00
Simon Hausmann
95c27e325f Fix add_qt_resource behavior with regards to unspecified prefixes
This change makes the PREFIX parameter a required parameter if the
target does not specify a default. This way the behavior is clear when
reading the code: add_qt_resource() without PREFIX means it must come
frmo the target.

Change-Id: I79024e70e7b4d32a5164b93aa08ec9ff409b2d39
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-09 11:50:11 +00:00
Simon Hausmann
73ba2ba2de Simplify resource embedding for qml modules
* 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
2019-08-09 11:47:25 +00:00
Simon Hausmann
8ba882a0b3 Add support for QTQUICK_COMPILER_SKIPPED_RESOURCES
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>
2019-08-09 09:21:12 +00:00
Soroush Rabiei
c595878aa3 Extract a large format string as a module constant value
The template for the "This is a generated file" notice made a clumsy
intrusion in the code in which it appeared, so split it out as a
constant of the module and access it by name where it's used.

Change-Id: Ic4dfb8e873078c54410b191654d6c21d082c9016
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-08 18:04:05 +02:00
Leander Beernaert
5424c72ab6 Extend handling of special condtions
Extend the hanlding of special condtions outside single line statements.
Conditions such as 'qtHaveModule(gui):qtConfig(opengl(es1|es2)?)' would
not be handled properly.

Change-Id: I992f75311b82d84c574c9cb4ef6d7d648f425d81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-08 13:11:00 +00:00
Leander Beernaert
5d7bb2e4f0 Add support for converting qtTargetLibrary() value assignments
Add support to pro2cmake to handle variable assignments via functions,
e.g: TARGET = $$qtTargetLibrary($$TARGET). The evalulation of the
functions happens during parsing and is very rudementary in nature.

Currently it only covers the qtTargetLibrary(), required for certain
projects, and quote(), required for passing unit tests.

If we run into any unhanlded function an exception will be thrown.

This patch also changes the TARGET property on Scope to expand the
value.

Change-Id: I678b7058067348a3972944bdba110f556cf22447
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-08 13:03:28 +00:00
Leander Beernaert
6396840182 Fix conversion of SUBDIR pro files not in current directory
This patch fixes the processing of pro files that do not reside in
the current directory. Before this patch statements such as SUBDIRS +=
Foo/Bar/z.pro would cause z.pro to be parsed in the current
CMakeLists.txt. What we want instead is a call to
add_subdirectory(Foo/Bar). Failing to do so leads to issues with
relative paths specified in z.pro being invalid.

Change-Id: I7bfa7837d54877e5340081d1c9aebe855cf6796d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-08 08:07:11 +00:00
Leander Beernaert
d8a7c0f40f Handle DESTDIR override
Set OUTPUT_DIRECTORY on a target when DESTDIR is specified.

Change-Id: I72061ae8156356fcb2aa9ba6cb87049fcef600c7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-07 13:47:51 +00:00
Leander Beernaert
f9db9a22e9 Handle qmake's CONFIG=plugin
In some tests in qtdeclarative we have projects that are built
as a lib with CONFIG=plugin. Without these changes they would be
translated to an add_qt_module call.

Change-Id: I208d31d43b087ed0b87eb4715f6c49b218fcc2c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-07 12:34:59 +00:00
Alexandru Croitor
b4ef975a0a Handle conditions for SUBDIRS *more* correctly
There are project files that not only do SUBDIRS -= foo depending on
some condition, but also SUBDIRS += foo. To handle these cases
correctly we need to do a whole pass across all scopes and collect
all addition and subtraction conditions.

Once we have that information, we can compute a final condition for a
particular subdirectory. After we have the condition information for
all subdirectories, we can simplify all those conditions using SimPy,
and group all subdirectories that have the same simplified condition.

Finally we print out the subdirectories grouped by the simplified
condition.

The end result is similar to how we have extend_target() calls with
multiple sources grouped into a single conditional call, except in
this case it's subdirectories.

Amends b26b1455d7.

Change-Id: I5b648ac67264ba9a940561baee5b49c43c13b721
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-07 11:55:28 +00:00
Leander Beernaert
9ca1d79539 Fix regular expression for add_qml_module
Values such as Foo.2 would no longer be converted into Foo due to an
error in the regular expression.

Change-Id: I6a11d02662782094f5b264f86a930d9aaf002c77
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-06 13:27:20 +00:00
Leander Beernaert
d943252741 Fix shared resource paths in tests
Resources shared by tests were incorrectly setup. Resources would
always be registered with BASE/filename as alias. In these cases the
fix is to set the alias with the original file name.

Change-Id: I667ce7b74ae5f86740c8bb8a040cc2895a3dc116
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-06 13:17:17 +00:00
Leander Beernaert
709538096c Fix add_qml_module URI
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>
2019-08-06 13:10:22 +00:00
Leander Beernaert
a3e149d92a Fix qml plugin conversion: always install qml files
Always install qml files regardless of whether the install_qml_files
configuration is present in qmake. This was causing most unit tests to
fail due to missing qml files.

Change-Id: I53c7200cfa66805d0e459190ef105c1a73c34a5f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-06 10:29:28 +00:00
Leander Beernaert
5d88ba001e Fix $$_PRO_FILE_PWD substitution
PRO_FILE_PWD should return CMAKE_CURRENT_SOURCE dir without any
compenstation for mistmatching directory locations as we are doing with
PWD.

There are test that use a shared .pri project file which gets included
into the .pro file of test. In this .pri file we have a statement such
as DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\".
Since the .pri project file is located in ../../shared/shared.pri the
substitution would result in
${CMAKE_CURRENT_SOURCE_DIR}/../../shared/data instead of the expected
${CMAKE_CURRENT_SOURCE_DIR}/data.

Change-Id: Id899d6a624acc45425af47ca9aa1b332cf63e659
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-05 12:58:10 +00:00
Alexandru Croitor
e2ab42c2aa Implement condition simplification for add_subdirectory conditions
This makes the SUBDIRS -= foo conditions simplified and nice to look
at.

Amends b26b1455d7.

Change-Id: I9ffe3db1e358f94fb65a885cc90c44218482825b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-01 18:33:16 +00:00
Alexandru Croitor
67bbb9179f Fix pro2cmake to handle QT default values properly
Setting the "QT" SetOperation which defaults to "core" and "gui",
should only be done once on the top-level .pro scope. To distinguish
the top level scope, we need to check for both an empty parent_scope
and an empty base_dir.

Amends 9e96c38426

Change-Id: I9db1cbf0e6592c8c195d11b97b3eff40b1adbcbd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-01 14:50:17 +00:00
Alexandru Croitor
cb370593df Small fix to correctly handle default arguments
Dictionaries are mutable, and should not be assigned as a default
parameter.

Change-Id: Id08c17f89c17b404560241849603e1e1a0ec6562
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-01 14:50:07 +00:00
Leander Beernaert
97b76704ea Refactor QML_FILES for add_qml_module
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>
2019-08-01 14:07:01 +00:00
Jędrzej Nowacki
9e96c38426 Properly convert default QT directive
If unset QT by default has value: "core gui". This patch adds this
behavior by pre-defining the value in the root scope.

qmimedata CMakeList.txt was re-generated.

Change-Id: Ib8b6064bc46c72d829e0077d09f21bbfb494e137
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-01 13:38:21 +00:00
Jędrzej Nowacki
b26b1455d7 Implement SUBDIR-= conversion in pro2cmake tool
CMake doesn't support removing subdirectories therefore one need to
convert all removal to conditional adds. The resulting code doesn't
win a beauty contest. That is because handle_subdir works on already
processed strings which means it doesn't have access to the boolean
operations. As such it can not minimize the expressions, but it works
and in the most simple cases it is pretty good.

The patch re-generates CMakeLists.txt under tests/auto/corelib/kernel
excluding qcoreapplication, qmetatype, qmimedata, qobject, qtimer,
which are suffering from unrelated problems, like for example Gui,
pthread linkage issues.

Change-Id: I18a02f6eda7a3b41b1313211c8bc9ce277bb67be
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-01 13:36:39 +00:00
Leander Beernaert
a920c16ef2 Add Qt Quick Compiler support
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>
2019-07-31 12:52:20 +00:00
Alexandru Croitor
a285bcba26 Ugly fix for handling QT_SOURCE_TREE
QT_SOURCE_TREE is a variable that is set in qtbase/.qmake.conf.
In qtbase, it's used throughout various
projects to find cpp sources when building standalone tests (among
other things).
Everything works fine with qmake, because even if qmake is invoked
on the tests subfolder, qmake searches up the source directory tree
until it finds a .qmake.conf file, and uses that.

When building qttools with qmake, the qdoc project expects
to have a QT_SOURCE_TREE value, but it's not actually set in the
qttools/.qmake.conf file, so the generated include paths that use
that value are incorrect. Curiously the build still succeeds.

Now in CMake land we replaced QT_SOURCE_TREE with
CMAKE_SOURCE_DIR, but that does not work properly when doing a
standalone tests build, because the project in that case is the
tests one, and not the qtbase one, so configuration fails in a
developer build when trying to configure some private tests.

So far I've found that only qtbase actively uses this value.
A temporary fix is to save the qtbase source directory into a
QT_SOURCE_TREE variable inside the generated
BuildInternalsExtra.cmake file.

The pro2cmake script is changed to handle presence of QT_SOURCE_TREE
in a qrc file path. This is handled by finding the location of a
.qmake.conf file starting from the project file absolute path.
This is needed to stop the script from crashing when handling
the mimedatabase test projects for example.

The change also regenerates the relevant failing test projects, and
thus standalone tests (when doing developer builds aka private_tests
enabled) now configure and build successfully.

Change-Id: I15adc6f4ab6e3056c43ed850196204e2229c4d98
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-29 13:16:14 +00:00
Alexandru Croitor
1307736c7d Fix testdata handling
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>
2019-07-29 13:14:44 +00:00
Leander Beernaert
88bf485f91 Add EMBED_QML_FILES option to add_qml_module
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>
2019-07-25 09:44:03 +00:00
Leander Beernaert
a92f029e2a Fix QML_FILES conversion
Use a the more appropriate scope.get_files() to retrieve the qml file
list from the qmake project. This makes it more consitent with the
rest of the conversion script and fixes some issues with incorrect
aliases in qrc files.

Change-Id: I8907516be9457ba0d60d14af53d241197637aa9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 09:42:09 +00:00
Leander Beernaert
2cc865b943 Extend add_qt_test to support qmltestcase
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>
2019-07-24 10:49:20 +00:00
Alexandru Croitor
e86509016c Fix mapping of Apple platforms in pro2cmake.py
"mac" scope in qmake actually means all mac platforms,
just like "darwin", aka macOS, iOS, watchOS, etc.

Regenerate corelib, gui and testlib after this modification.
This is a requirement for the iOS port.

Change-Id: I029c7e907d13f6ec31816a08602a5930f9ac16a7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-23 10:31:15 +00:00
Leander Beernaert
31341ad63a Simplify add_qml_module code
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>
2019-07-22 14:28:19 +00:00
Leander Beernaert
ff5a75a60e Process private libraries set in QT_PRIVATE
The pro2cmake conversion was not processing private libraries specified
with the QT_PRIVATE variable.

Change-Id: I0c44595bb8e1ed9a748af51a2a859bee62e7d264
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-22 08:34:54 +00:00
Simon Hausmann
fecefdd369 Fix mapping of features to private features
When a feature generates a private feature, we should not just repeat
the condition but also make it depend on the original feature. In qmake
features had different outputs, while we have a 1:1 mapping. For example
the developer_build feature had "private_tests" as an output feature.
There's no condition attached to the feature and auto-detect is off, so
we'd generate

    qt_feature("developer_build" AUTODETECT OFF)
    qt_feature("private_tests" AUTODETECT OFF)

and that's wrong, because when the user enables the visible feature
(developer_build) we want it to propagate to the private_tests feature.

Change-Id: Id8408864802fa1e1ed9e67a5f47d1d2fde38d321
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-22 08:29:33 +00:00
Leander Beernaert
3212f1b866 Add special case handling for corelib mimetypes resources
We have to treat the resources from mimetypes in corelibs specially
as they are reused for two test cases. Since we no longer use the qrc
files, we have wrapped the relevant code in a function that can be
called for every target that depends on it.

This change also corrects formatting for the generate CMake code
regarding resource commands.

Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-18 08:05:58 +00:00
Leander Beernaert
341ccc3b59 Enable recursive expansion of simple qmake variables
Allow _expand_value to expand variables that may have more than
one level of expansion when the regular expression covers all
of the input. E.g.:

A = Foo
B = $$A/Bar
scope.expand('$$B')

While the original code was able to expand the string '$$B/source.cpp' to
'Foo/Bar/source.cpp', it could not expand the string '$$B' completely.
The latter would always return '$$A/Bar' instead of the expected 'Foo/Bar'
string.

A test case has been added which coveres the above example.

Change-Id: Ie3b5739c24ecbeb67d408dd204b0f54bab1d0f3f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-18 07:26:01 +00:00
Leander Beernaert
ec1546afc4 Handle TESTDATA for Qt Tests
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>
2019-07-16 06:48:56 +00:00
Leander Beernaert
30b3746370 Add support for QML plugins
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
2019-07-15 12:28:12 +00:00
Leander Beernaert
faac0ef8c6 Add missing expansion for $$_PRO_FILE_PWD_
Tests in qtdeclarative were failing because the above variable was
expanded to an empty string. This causes the tests to be unable to
locate their test data when executed.

Change-Id: Ibc3c094123f25d688a73c11886ac1673b6930c54
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-15 09:36:46 +00:00
Alexandru Croitor
4dac45c9ee Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
2019-07-11 17:17:51 +02:00
Edward Welbourne
a9aa206b7b Move text-related code out of corelib/tools/ to corelib/text/
This includes byte array, string, char, unicode, locale, collation and
regular expressions.

Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 17:05:30 +02:00
Edward Welbourne
8bfae093ed Add data for Windows Time-Zone IDs added in the last two years
We've not run util/locale_database/cldr2qtimezone.py for a while, so
CLDR has had time to add several more zones.  Catch up, inserting the
new entries in order.

Change-Id: I8625548b0f7775958230eccbd89b897d7afed9e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-01 17:48:53 +02:00
Edward Welbourne
13242673cf Tidy up in cldr2qtimezone.py and document the need to run it
It wasn't mentioned in cldr2qlocalexml.py's instructions, so I didn't
know to run it.  The data it used in an illustration was out of date.
Two tests could be combined with no loss.

Change-Id: I26e619e6210ea5b1258326fc4bc2b6aee9d6a999
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-01 17:48:32 +02:00
Edward Welbourne
bbd64f64b2 cldr2qtimezone.py: report all missing zones, rather than just the first
When scanning the CLDR data, the script raised an exception if it
didn't recognize a zone ID.  Instead, collect up such unrecognized IDs
in a list and report them all at the end, so that whoever runs this
can do them all in one go, rather than doing one, running the script,
doing the next, running the script, ad nauseam.

Change-Id: Ia659f1d1c7e1c1b4ccb87cc23828a0588a5bf958
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-01 17:48:16 +02:00
Edward Welbourne
2f19a3053e Use simpler data structures in cldr2qtimezone.py
Use tuples for the fixed data.  The numbering of rows in the data
tables isn't part of any public API, so we can change it freely; it is
thus unnecessary, as we can just enumerate a tuple of the data values
to generate sequential indices on the fly.  (Updates to the data shall
no longer need to renumber in order to insert entries.)

Restore ordering of the data tables, and remove wanton spacing from
inside parens, in the process.

Change-Id: I59956cfb6191fe729300b57070671b7e66bd0379
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-01 17:47:51 +02:00
Sona Kurazyan
ff2b2032a0 Remove usages of deprecated APIs from QtAlgorithms
Task-number: QTBUG-76491
Change-Id: I9dab736a0cbd2e86588919640c26e8ce6b3674d0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-06-29 21:58:36 +02:00
Simon Hausmann
8c60782124 Fix XCB feature detection
The xcb feature controls whether to build the xcb platform plugin. The
feature depends among other things on

    qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)

to succeed. This means at the moment setting XCB_FOUND to true, that's
what the condition checks.

Later on, in configure.cmake, we also check for other components in the
XCB package, for example:

    qt_find_package(XCB COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT)

If this component is not available, the xcb platform plugin has perhaps
reduce functionality, but it should be built and the feature should be
abled. However it isn't, because when that find_package call fails,
XCB_FOUND will be set to false. And that in turn will disable the
feature as the condition fails.

Therefore this patch changes the condition to check for the presence of
the XCB::XCB target instead.

Change-Id: I534087d8c3b7ff5edf81a5ffcf16cc0bb78b9fb7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-26 09:07:20 +00:00
Leander Beernaert
a9d2c5b6d7 Android: Final changes for APK generation
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>
2019-06-26 08:34:37 +00:00
Alexandru Croitor
fe3bd212fc Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
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
2019-06-14 16:31:09 +02:00
Simon Hausmann
efa9998521 Fix compiling of examples on Android
* Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE
  but provide it implicitly. It's redundant :)

* When on Android, build a module (shared library), just like qmake.
  This requires an additional library destination in the install() call,
  but that's ignored on other platforms.

* Fix typos in the android deployment generation settings function

* Use the correct cache variable to determine whether we're inside a Qt
  build or not. Right now this only works inside Qt builds anyway as
  QtPlatformAndroid.cmake is not publically accessible.

Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-12 14:19:53 +00:00
Simon Hausmann
6732fa3a29 Fix linking of examples
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>
2019-06-12 14:19:34 +00:00
Alexandru Croitor
118e04013a Improve special case handler to work on Windows
There were some issues with not finding the git executable and
trying to remove read-only files / files that are still held
by a process.

Change-Id: I7f587c4e96cff763cc0b3438d9ed2249da8f122f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-11 14:09:54 +00:00
Alexandru Croitor
44c9ad5617 Improve pro2cmake.py more
Fix incorrect usage of CMAKE_CURRENT_BUILD_DIR, there is no such
CMake variable, it's actually CMAKE_CURRENT_BINARY_DIR.

Also if the host_build option is set when building a module,
the library should be a static library.

Change-Id: I9fb39905118dbd7f33d9821960eaed11f20b30c6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-08 08:23:06 +00:00
Alexandru Croitor
38b1474c51 Handle minimal_syncqt as not running syncqt for now
This is needed for QmlDevTools in qtdeclarative.

Change-Id: I41adec15f292c91192e171b45d1e5d48764c37c4
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-07 09:49:15 +00:00
Alexandru Croitor
4e907f1f62 Fix comment fixup in pro2cmake
Comments should be removed before line continuations, otherwise
the semantics of an assignment change.
Found this during reconversion of qtimageformats.

Adjust test to specifically test for all the expected values.

Amends 76f5b784ce.

Change-Id: Iaa46bbc9cbd7b2390fe9b5f0078ac33d225a9258
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-06 08:38:08 +00:00
Alexandru Croitor
82941a3f1b Fix some configure.json conditions for qtimageformats
The auto-generated add_subdirectory conditions in qtimageformats use
QT_FEATURE_foo and not QT_FEATURE_system_foo.
But the non-system ones don't actually check if the respective
qt_find_package(TIFF) got found.

Fix the conditions of the non system features to be the same as the
system ones.

Change-Id: I96f889cf7061721b829d562707c42aa0e29720df
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-06 06:59:48 +00:00
Simon Hausmann
a6c11d3e09 Add support for private module .pri files
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>
2019-06-05 14:39:11 +00:00
Cristian Adam
527f3bb31c CMake: Add WrapPCRE2 package
The WrapPCRE2 package handles the PCRE2 packages that have targets,
and reuse them.

Change-Id: I24b0b51f507703cd8287f845f7e425f62dd2c3d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:42:55 +00:00
Alexandru Croitor
2401435d89 Map module.gui to if TARGET Qt::Gui in configure.cmake
Some features check for module / target existence. Adapt conversion
script to handle that.

Reland after fixing it.

Change-Id: If4fb942c2e0d16e76a0b9b767bf478527851b0f7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:15:04 +00:00
Albert Astals Cid
bfa209dfa5 cmake: build with exceptions disabled by default
Only re-enable exceptions for the modules that do
CONFIG+=exceptions
in qmake

Change-Id: I9f19078adbdc1b8fa3d4102fb51a099e7e35522e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:10:51 +00:00
Alexandru Croitor
9ad193cc3d Fix write_all_source_file_lists type annotation
Change-Id: I6e22d21562a0923079b90cf9b3e6d15dfe16ff29
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-05 08:36:51 +00:00
Alexandru Croitor
38b7ee3533 Revert "Map module.gui to if TARGET Qt::Gui in configure.cmake"
It breaks some conditions, and then the build fails not finding
some private header files in qpa, etc.

This reverts commit 35dc8f496d.

Change-Id: I1b51eac06fe9186181d3f0a7c78f22da7be534e2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-05 08:33:21 +00:00
Alexandru Croitor
35dc8f496d Map module.gui to if TARGET Qt::Gui in configure.cmake
Some features check for module existence. Adapt conversion script
and QtBuild feature condition parser to handle that.

Change-Id: I063e49a6fe9f8e9cf3aec985fd78ed4430398586
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 08:13:42 +00:00
Alexandru Croitor
d0eb985f74 Improve run_pro2cmake.py
Add two new options:

If you pass --only-existing, the pro2cmake script will only be
executed on .pro files that already have a CMakeLists.txt next
to them. This is useful if you modify pro2cmake, and only want
to regenerate existing files.

If you pass --only-qtbase-main-modules, the script will be
executed on the main modules in qtbase/src. This is useful
if you want to check if your pro2cmake modification
works correctly on the more complicated projects.

Change-Id: I5228411a252dbef6d77f01ca742a7b98583c5a75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-05 07:41:46 +00:00
Alexandru Croitor
9231204e2c Fix extra_keys in write_all_source_file_lists to be optional
Initially it was added as a required argument, but not all usages of
the function where adjusted, so the script failed. Make it optional.
Also change the styling of the argument to be snake cased.

Amends 8fea3ec4e7.

Change-Id: I568800401bb5af153b7bb5229f134c2f74b87468
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-05 07:39:10 +00:00
Alexandru Croitor
b64e8e721f Fix special_case_handler to handle git add prev_CMakeLists.txt better
When using run_pro2cmake.py, it spawns multiple instances of
pro2cmake.py.
If more than 1 of the instances need to git add prev_CMakeLists.txt at
the same time, git add might fail due to the acquired index.lock.

The cleaner solution would be to use a file lock as a mutex, but that
requires an external pypi package.

Use a poor man solution of retrying the git add with a time delay for a
finite amount of times.

Change-Id: I2031f6e29ae499526cb4f1753e4387e7f4fab0ab
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 20:46:45 +00:00
Alexandru Croitor
8842cb5337 Improve special_case_helper.py
Make sure to set the author user and email for the temporary git repo,
so that the commits succeed on systems that don't have a global git
author.

Also fix run_process_quiet to print stderr and stdout in case if the
execution failed for some reason.

Change-Id: I0ddb61730114b3e9c59e2d23480df0ced8d6e772
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 20:18:21 +00:00
Kevin Funk
75bb0b6cd1 pro2cmake: Add PUBLIC to target_include_directories
Change-Id: Ie4e882a5713022bfaec7182172be69616ff8b91c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 15:34:33 +00:00
Kevin Funk
772f5dbf1c pro2cmake: Always add a newline after func calls
Fixes the situation where we end up with e.g.:
```
target_link_libraries(...
)target_link_libraries(...
)
```

Change-Id: I455563b24850db7f389746385af53cd606343274
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 15:34:27 +00:00
Kevin Funk
8fea3ec4e7 pro2cmake: A couple more fixes regarding examples
Changes:
- Make sure the footer is passed along to callees
- Make sure RESOURCES are part of add_executable(...) for AUTORCC

Change-Id: I4546bacd2e41ca8acc1a9351af54d325afb715ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 15:34:21 +00:00
Jean-Michaël Celerier
0900298d46 cmake: register plug-ins, create dependencies file
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>
2019-06-04 10:08:07 +00:00
Albert Astals Cid
9e6781b69e cmake: Fix xcb build
Need
	qt_find_package(X11_XCB)
in src/gui/configure.cmake since we're using it in the file
	qt_feature("xcb_xlib" PRIVATE
	    LABEL "XCB Xlib"
	    CONDITION QT_FEATURE_xlib AND X11_XCB_FOUND
	)

Need
	qt_find_package(XRender PROVIDED_TARGETS PkgConfig::xrender)
in src/plugins/platforms/xcb/CMakeLists.tx since we're using it in the
file
	extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
	    PUBLIC_LIBRARIES
	        PkgConfig::xrender
	)

Use capital XRender in pkgconfig to be more consistent on how XRender is
called everywhere else

Change-Id: I403ead2cc123b08f741c5142f20db88987657ba8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 08:45:46 +00:00
Alexandru Croitor
962ee4ea37 Handle a few more condition types in pro2cmake
qtdeclarative has a few conditions that check the gcc version
via variables like QT_GCC_MAJOR_VERSION.
To handle that, parse the CMake compiler version using
qt_parse_version_string() into separate variables like
QT_COMPILER_VERSION_MAJOR, QT_COMPILER_VERSION_MINOR and
QT_COMPILER_VERSION_PATCH. We can then map the conditions
appropriately.

Also, handle isEqual(foo, bar), which is equivalent equals(foo,bar).

Change-Id: I74575c733b44f1f42451e00038b3f113fd353915
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 08:37:26 +00:00
Thiago Macieira
041a5ff076 gen_qfloat16_tables: add a comment explaining what the tool is
For our future selves.

Change-Id: I2b1955a995ad40f3b89afffd15a4c127686662bc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-03 10:42:55 -07:00
Thiago Macieira
5e40d3d982 qfloat16: Check in the tables to Git
It's a 38k source file, which makes it MUCH smaller than other generated
files like qlocale_data_p.h (982k) and qunicodetables.cpp (718k). The
constants are platform-independent, since they are defined by IEEE 754,
so they will never change.

The generator tool is moved to util/ and removed from the build. That's
one fewer bootstrapped tool to have to worry about.

The output file is committed as .cpp so it won't get installed.

Fixes: QTBUG-76165
Change-Id: I2b1955a995ad40f3b89afffd15a3ded58dc3e35f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-03 10:42:53 -07:00
Alexandru Croitor
0a96302dc1 More fixes to conversion script while porting qtdeclarative
Hardcode a few cases regarding scopes containing "qtConfig(opengl)".
These arew few, and contain regular expressions, to just manually
check and replace them.

Add a new entry to _qt_library_map for handling QmlModels module.

Fix Scope.children property to recursively access the .children
property on included scopes (instead of just ._children) so that
we get the full list of scopes from included children that include
other scopes. This is needed for nested .pri files.

Fix mapping of "win*" to WIN32.

Change-Id: If949a8051f517683e56cda605733719daadb384a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-03 14:41:52 +00:00
Alexandru Croitor
e88864578a Generate the c++xx standard features instead of skipping them
The features are reused in qtdeclarative (and maybe somewhere else
too), so they should be present. We can still map the conditions
to proper CMake compile feature tests.

Change-Id: I4d307d29d4d293cc23ab005b195ea346087c7162
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-03 14:41:28 +00:00
Alexandru Croitor
e4079eca49 Merge remote-tracking branch 'origin/dev' into wip/cmake
Take 5.

Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
2019-06-03 15:14:42 +02:00
Simon Hausmann
8fa646dbe2 Add basic support for compiling applications with qmake
* 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>
2019-05-31 12:53:09 +00:00
Leander Beernaert
d908e0a47d Fix uncessary relative dir suffix in pro2cmake.py
When we replace the PWD key from qmake files and both the base and
current directory are the same, there's no need to add an extra './' to
the current working directory.

This also fixes a unit test in qtsvg as it requires the passed in path
to match exactly to the one outputed in the log files.

Change-Id: Ide9ca6a70493e8039d3af84a9e576d8f6a313f2a
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-29 08:58:52 +00:00
Leander Beernaert
d843bceb0c Add Library Mapping for QtNetworkAuth
Added library mapping information for any projects referencing the
QtNetworkAuth project.

Change-Id: I9c4309d26ee9895f94995d4844ffde4ee4444766
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-28 15:07:25 +00:00
Alexandru Croitor
499771f3ea Enhance the porting scripts with some new functionality
These were some hard requirements while porting QtQml .pro files so
that the generated CMake code is syntactically correct and the result
buildable.

This include handling of a few more different condition scopes
and disabling the c++ make_unique feature test.

Change-Id: Iae875ffaf8d100296e8b56b57d076455e5d72006
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-28 14:04:40 +00:00
Alexandru Croitor
cbb143e9f1 Improve configurejson2cmake.py to handle non-compliant qmake JSON
Some configure.json files contain new lines inside quoted strings,
which is not conformant with the JSON spec.

Add a new json_parser python module which uses pyparsing to preprocess
the json files to remove the new lines inside the quoted strings, and
then hands over the preprocessed content to the regular json module.

Change-Id: I5f8938492068dda5640465cc78f5a7b6be0e709a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-27 07:48:51 +00:00
Edward Welbourne
548513a4bd Separate out the time, zone, date code from corelib/tools/
We'll be adding calendar code here as well, and tools/ was getting
rather crowded, so it looks like time to move out a reasonably
coherent sub-bundle of it all.

Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-06 15:54:32 +02:00
Alexandru Croitor
bfed22e3b7 Remove all line continuations when processing qmake syntax
We constantly had to adjust the qmake grammar to handle line
continuations (\\\n) in weird places. Instead of doing that,
just do a preprocess step to remove all the LCs like we do with
comments, and simplify the grammar not to take into account the
LCs.

From some manual testing it doesn't look like we get any regressions.

Change-Id: I2017d59396004cf67b6cb54977583db65c65e7d3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-23 14:19:22 +00:00
Alexandru Croitor
a2e0f19b61 Make debug token output actually work for the pro2cmake qmake parser
setName() and setDebug() need to be called on a parser element before
the parser element is used as a sub-element in another parser element,
otherwise the debug output is not shown.

Hence the "iterate over all locals" approach works only partially.
Instead add a new decorating function add_element() for the
construction of each parser element, and make sure to enable debugging
inside that function.

Unfortunately there is no clean way to avoid duplicating the parser
element name both in the local variable and in the function argument.

Change-Id: Iaa9ed9b7dbb22ec084070b9c049cf51c841d442c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-23 14:19:11 +00:00
Alexandru Croitor
6dfeb81bcb Improve qmake syntax parser in pro2cmake.py
Some qtdeclarative pro files caused exceptions when trying to parse
them using the script. This included the following:
- handling conditions divided by newlines and backslashes
- handling conditions that have no scope

The parser has been fixed to deal with those cases and relevant
tests were added.

After the change, all qtdeclarative project files are parseable by
the script.

Change-Id: Ib9736423f7fb3bcc1944b26cfb3114306b4db9a7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-23 14:17:46 +00:00
Alexandru Croitor
80271e8280 Improve qmake parser debug output in pro2cmake
Override the default debug actions to be decorated with proper
indentation for easier reading.

The setup only has to be done once, and not on each QMakeParser
creation.

Change-Id: If5f965b462c782c654ee8ebfdd33570e8f94b084
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-23 14:17:34 +00:00
Alexandru Croitor
0425ee0610 Change the default enabled AUTOGEN tools list to contain only moc
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>
2019-05-22 14:58:08 +00:00
Alexandru Croitor
4e7756a6cd Add a few more 3rd party libraries to helper.py
Handle a few more libraries that are used in qtimageformats repi.

Change-Id: Ia3b9a845bc6cb8ce98a477b9355011bbadc32c1a
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-21 15:28:24 +00:00
Alexandru Croitor
76f5b784ce Fix the fix to correctly handle comments in multi-line assignments
The previous fix where the Grammar comment style was changed to
remove the newlines was incorrect, because if you have

 foo=1#comment
 bar=2

after the Grammar comment ignoring, it would transform into

 foo=1bar=2

which will clearly fail to parse, so the new line has to stay.

But we would still have the following case which would fail:
 foo=a \
 # comment
 b

Apparently qmake things that's the equivalent of
foo=a b

but the grammar parses it as
 foo=a \
 \n (newline)
 b

Thus the parsing fails because there's a newline and then some
weird 'b' token which the grammar does not expect.

The best fix I found is to preprocess the source, to remove
completely commented out lines.

So:
 foo=a \
 # comment
 b

gets transformed into

 foo=a \
 b

Change-Id: I2487a0dbf94a6ad4d917d0a0ce05247341e9b7da
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-20 13:18:11 +00:00
Alexandru Croitor
e4b8c488bd Improve configure2cmake to find_package only in certain conditions
It doesn't make much sense to look for X11 related packages on
macOS and Windows by default. Usually they would not be there, and
as a result the configuration step would show a long list of scary
not found packages, and also eat precious configure time.

Change the conversion script to allow putting conditions around
generated find_package calls.

These conditions can be manually set in the conversion script
library mapping, using the emit_if argument,
which we do for the X11 and Wayland related packages.

They are also computed by checking which features use a given library,
and if the feature is protected by a simple emitIf condition like
config.linux, the relevant library find_package call will be protected
by the same condition.

If a developer still wishes to look for all packages, they can define
the CACHE variable QT_FIND_ALL_PACKAGES_ALWAYS to ON.

The relevant configure.cmake files are regenerated in this patch.

Change-Id: I6f918a94f50257ec41d6216305dae9774933389a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-20 13:15:16 +00:00
Alexandru Croitor
846adfe079 Handle the new cmdline config feature in pro2cmake
cmdline implies console, so use that also to determine if a binary
should get a GUI flag.

Change-Id: I084e0a45785df96a7dc2c101af5305fbb39efbc3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-20 09:23:14 +00:00
Alexandru Croitor
826821658d Workaround fix in pro2cmake Operation __init__ method
There are still call sites that call Operation.__init__ with a string
instead of a list. Restore the handling of such a case.

Amends 5fe8a38af3

Change-Id: I2a4d5c5cb5b460bf02b6da02d42d8cc8d5eb4192
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-20 09:18:56 +00:00
Alexandru Croitor
c454e622a1 Don't exclude QtCore from dependencies when generating modules
and plugins.

src/network/network.pro for instance depends on core-private, but
because we ignore adding QtCore as a public dependency, the exported
Config file for Network doesn't depend on QtCore anymore, so if a user
only links against Network, they won't automatically link against
Core.

Change-Id: I4a60ffae7e071927360b8ccf6b1b7479ab391060
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-20 09:15:31 +00:00
Alexandru Croitor
e0a6e9f3aa Fix parsing qmake assignments that have comments in between
For some reason the python comment regex that we used does not ignore
the line break at the end of a comment line.

This caused issues when parsing multi line assignments with comments
in between.

Use our own regex for comments to circumvent the issue. It was found
while trying to port the qtimageformats repo.

Added a pytest as well.

Change-Id: Ie4bbdac2d1e1c133bc787a995224d0bbd8238204
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-17 13:31:03 +00:00
Tobias Hunger
14bf7e952e CMake: Fix test_scope_handling
Adapt to updated APIs in pro2cmake.py

Change-Id: I39898b675e27d6295ef6cfa049c82b245d71188a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-17 13:26:29 +00:00
Tobias Hunger
5fe8a38af3 CMake: Fix test_operations
Fix test_operations and do some small mypy cleanups along the way

Change-Id: I6586b5d3491e5dcf44252c098516f0922fa60420
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-17 13:26:26 +00:00
Edward Welbourne
5b672693e7 Add locale support for Cebuano and Erzya languages (new in CLDR v35.1)
Change-Id: I5d0ee7bc27eeca1c046d442b0410128ea5abbdb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
b7d8169f02 Suggest name, when available, for unknown codes
When parsing the CLDR data, we only handle language, script and
territory (which we call country) codes if they are known to our
enumdata.py tables.  When reporting the rest as unknown, in the
content of an actual locale definition (not the likely subtag data),
check whether en.xml can resolve the code for us; if it can, report
the full name it provides, as a hint to whoever's running the script
that an update to enumdata.py may be in order.

Change-Id: I9ca1d6922a91d45bc436f4b622e5557261897d7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
248b6756da Rename util/locale_database/ to include the e that was missing
It was misnamed local_database, quite missing the point of its name.

Change-Id: I73a4fdf24f53daac12304de1f443636d89afacb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:10 +02:00
Tobias Hunger
400f94109d CMake: Wrap DBus1 find_package call to fix xproto not being picked up
DBus1 (1.12) configuration file breaks PKG_CONFIG environment
variables and will thus prevent other libraries to be picked up
by pkgconfig. Main sympthom is that xproto is not getting picked
up anymore, which results in hundreds of lines of warnings about
this being printed.

Work around that by wrapping the call to find_package(DBus1) and
restoring the environment.

Change-Id: Ia69f10b014dddc32045b40972500a843e5d29b38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-10 15:09:49 +00:00
Tobias Hunger
e9085f4162 CMake: pro2cmake.py: Add target_link_libraries to examples
Change-Id: Ic7054f0c88e228496b7f4855bffa5620ed717f9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:45 +00:00
Tobias Hunger
35ed41e547 CMake: pro2cmake.py: Generate find_package information into examples
Change-Id: I6dab13ebea4386019f14be5f29a143d194268aac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:37 +00:00
Alexandru Croitor
bc4687f5bb Keep "special case" modifications when regenerating project files
The pro2cmake.py file is now smarter, and can reapply "special case"
modifications after regenerating a CMakeLists.txt file.

This substantially lowers the maintenance burden when regenerating
many files at once.

See the special_case_helper.py file for details on how it works.

Make sure to commit the generated .prev_CMakeLists.txt file alongside
your CMakeLists.txt changes.

To disable the preservation behavior, you can pass -s or
--skip-special-case-preservation to the script.

To keep around temporary files that are created during this process,
you can pass -k or --keep-temporary-files.

To get more debug output, pass --debug-special-case-preservation.

Fixes: QTBUG-75619
Change-Id: I6d8ba52ac5feb5020f31d47841203104c2a061d8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-09 11:29:54 +00:00
Tobias Hunger
862ebbf7ea CMake: scripts: Extract code to write find_package lines
Extract code to write find_package lines from configurejson2cmake.py
and move this over into helper.py.

Change-Id: Iefd313b2a56cb78a99a7f3151c3f6c6284482f79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 11:29:35 +00:00
Tobias Hunger
80e0c615a9 CMake: pro2cmake.py: Separate library extraction logic from writing out data
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>
2019-05-09 11:29:25 +00:00
Tobias Hunger
c4dd1a8fe3 CMake: pro2cmake.py: Extract writing lists into cmake files
Extract the actual functionality to write a list of "things" below
headers and/or cmake parameter and followed by a footer.

Reuse this functionality everywhere we write a list of things.

Change-Id: Ia7647be465b4788a2b1e6a5dbede1ca868f24ae2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:38:17 +00:00
Tobias Hunger
ee3d9a8b67 CMake: scripts: Fix mypy issues
Change-Id: I706740be79eccd6bf08213fdaf747dde08cd053a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:37:58 +00:00
Tobias Hunger
5608bf3cba CMake: pro2cmake.py: Add basic support for examples
Examples need to be built stand-alone and as part of Qt, so they
need a special CMakeLists.txt file that supports both use-cases.

Add an --is-example switch to pro2cmake to make it generate these special
CMakeLists.txt files.

This is basic support only and is currently still missing the necessary
find_package calls.

Change-Id: Ie770287350fb8a41e872cb0ea607923caa33073d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:37:42 +00:00
Tobias Hunger
0c498ef4ff CMake: pro2cmake.py: Do not fail when run from .pro-file directory
Change-Id: I285b05986e3a58efc060ca0b5732f6e3f5121476
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-08 11:25:58 +00:00
Alexandru Croitor
9d96c8da78 Fix freetype target not being found when using vcpkg
vcpkg and upstream CMake find module define different target names for
the same package. To circumvent this, create our own Wrap find module,
and link against it. Inside the find module, try both target names.

Change-Id: Iba488bce0fb410ddb83f6414244f86ad367de72b
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 10:54:15 +00:00
Alexandru Croitor
aed2c1f5ae Force pro2cmake.py to always change the dir to the converted pro file
Otherwise if you call the script from a different directory, path
handling becomes broken and certain files are not found.

Change-Id: Ia2f60abbd312a771330b3d5e928e1ccd0b4a845b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-07 17:08:28 +00:00
Tobias Hunger
5ec3baa67a CMake: scripts: Make xcb_qpa_lib known as a Qt module
Change-Id: I65f48d86c4ec946b38004b945078f29625e32d93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 14:45:22 +00:00
Tobias Hunger
d5018720db CMake: scripts: Treat libraries mapped to None as known
This detects doubleconversion as a 3rd party library.

This fixes defaulting QT_FEATURE_system_doubleconversion to 'ON'.

Change-Id: I9d18dbbb6f7a99f6a5c674bed3013b96f19bf6e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 14:41:31 +00:00
Tobias Hunger
9ffcc76188 CMake: Scripts: Fix double entries in 3rd party library mapping
Change-Id: I35f29876874d6083d19382800d194e417d57bca1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:29:20 +00:00
Tobias Hunger
059f4ade7f CMake: pro2cmake.py: Fix library mapping
Fix library substitution again which broke when I merged all the
library related pieces of information.

Keep Qt and 3rdparty libraries separate so that dbus does not get
mapped into Qt::DBus (or the other way around).

Make names in helper.py more consistent while at it.

Change-Id: I5e5bf02bdabf8bafe991c5701deca76bde4df2c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:20:50 +00:00
Alexandru Croitor
6b2de61bf9 Make zlib a required package for QtCore
Change-Id: Ifbb969fafe05e355d6874d8bebe2e8f1e80510ff
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 14:16:23 +00:00
Tobias Hunger
7874ce7801 CMake: Improve mapping of libraries
Merge all data related to mapping libraries into one data structure
in helper.py.

Use that data for everything related to library mapping.

This change enables way more features now like e.g. adding find_package
calls into generated files.

Change-Id: Ibbd2a1063cbeb65277582d434a6a672d62fc170b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 13:42:25 +00:00
Tobias Hunger
9618434de5 CMake: configurejson2cmake: Do not generate useless OPTIONALs
Do not set properties of packages to type OPTIONAL. That is the default
anyway.

Update generator script and generated files.

Change-Id: I7a4d043b69c93ce8c2929a2e27ac6a07e4e6d8cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 13:39:48 +00:00
Albert Astals Cid
64b31cafa1 cmake: Fix xcb_glx build
Use the actual cmake library target name

Change-Id: Icda1d232e3b920bf33ebceb00f39682050f7dedd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 08:13:56 +00:00
Alexandru Croitor
9b0b464e82 Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.

This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.

For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.

The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.

The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.

Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.

In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.

Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.

Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:42 +00:00
Alexandru Croitor
5668522413 Make freetype a required package
With qmake if we don't find a system package, we use the bundled one.
With CMake we don't provide a bundle freetype, hence it's required
to find a system one (or custom provided one).

Change-Id: I00a5e2ac55459957dae0729f89bafa792a102152
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-01 19:05:38 +00:00
Tobias Hunger
6630937e63 Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
2019-04-16 16:32:08 +02:00
Tobias Hunger
37ed6dae00 CMake: Map xkbcommon_support
Qt 5.12 comes with xkbcommon_support now. Map that accordingly.

Change-Id: Id10708349d377f6bdfed654428ebcef0b533bd69
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-04-12 14:06:07 +00:00
Tobias Hunger
ce809cab29 CMake: pro2cmake.py: Fix handling of libraries in QT
Change-Id: I5737a285ca0575a454e60fad231435d96b2f1be7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-12 11:35:18 +00:00
Tobias Hunger
95cdb0d1ae CMake: pro2cmake.py: Inherrit VPATH from parent scopes
Change-Id: I95b62fdf3a4cba674bef5a58f0d414464daa3b0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-12 11:35:09 +00:00
Tobias Hunger
2ec3f492a7 CMake: pro2cmake.py: Handle setting a key with $$key in the value
Change-Id: I86552ed2a30f07f8c6060b2bad04fd5489b1d482
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-12 11:35:01 +00:00
Tobias Hunger
8f0eb65579 CMake: Configurejson2cmake: Always enable system-pcre2 and handle dlopen
Handle dlopen properly. Code is ifdef-ed on it, so we need it:-/

Change-Id: I7f35d24b97530796a4cdcdc1acbe139757170215
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-04-12 11:33:39 +00:00
Qt Forward Merge Bot
e56d3b03ed Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/corelib/tools/qlocale_data_p.h
        (Regenerated by running the scripts in util/local_database/)
	src/gui/opengl/qopengltextureuploader.cpp

Done-With: Edward Welbourne <edward.welbourne@qt.io>
Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io>
Change-Id: I12df7f066ed0a25eb109f61c4b8d8dea63b683e2
2019-05-09 13:06:11 +00:00
Edward Welbourne
b58cfb2f1f Update cldr2qlocalexml.py's claimed CLDR version support
It was up to date with v34 (and seems to cope with v35.1) but only
clained support for v29.

Change-Id: I686cae1977824a4deec4633f19604b91061fe78a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-07 09:29:36 +00:00
Edward Welbourne
8c8b4b8fde Correct and expand support for CLDR's date/time format strings
Our conversion from CLDR's format to our own was missing some things
it could support sensibly, and some it could do better than ignore or
treat as literal, while mis-handling the 'E'-based formats for day
names.  At least in CLDR v34 this doesn't actually make any difference
(on regenerating our locale data, the only change is the date of
generation).

Task-number: QTBUG-70516
Change-Id: I9d27b9bf24afd168c2f8a5258143d3d695bca0ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-07 09:29:18 +00:00
Edward Welbourne
40d9ac93e0 Clean up help message for the public suffix list processor
The grep given in the help from the program to process the
effective-TLD list only worked for voodoo reasons.
Replaced it with an actually-correct use of grep.

The commands given used the name effective_tld_names.dat in the URL
fetched; however, the relevant file has (for some time now) said
explicitly "Please pull this list from, and only from
https://publicsuffix.org/list/public_suffix_list.dat"
Changed the name used to match that URL.

Revised the output file's suggested name and the instructions for what
to do with its contents, making clear they *replace* what was there
before ...

Fixed some typos and related ugliness.

Change-Id: Iacd186c0003227d657099716262eb3a89c9e5f1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-04-23 17:29:29 +00:00
Tobias Hunger
92b0d7b911 CMake: Support /nolink libraries
Add a helper function to QtBuild that generates Foo_nolink versions
of Foo library targets.

Map 'Foo/nolink' libs found in qmake to Foo_nolink.

Automatically run helper function to create _nolink targets as
part of extend_target.

Change-Id: I4c23ea68b3037d23c9a31d4ac272a6bd0565f7c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-10 09:36:40 +00:00
Allan Sandfeld Jensen
95f787bfdc Replace Q_DECL_NOTHROW with noexcept the remaining places
The first replacement had missed objective-C++ code some places ourside
the src dir.

In C-files Q_DECL_NOTHROW is replaced with Q_DECL_NOEXCEPT as we still
need to turn it off when compiled in C mode, but can get rid of the old
NOTHROW moniker.

Change-Id: I6370f57066679c5120d0265a69e7e378e09d4759
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-09 14:48:42 +00:00
Liang Qi
677a7a3066 CMake: Fix mappings in helper.py - WUIAS
This amends 9afc605eb5.

Change-Id: If246811d267d091c692875a1645c96767f781010
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-09 14:26:05 +00:00
Tobias Hunger
511124bf1d CMake: pro2cmake.py: Fix plugin type only prints first letter
Change-Id: Ib8989d2c13199d804d0c069903ca1c5eb61763e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-09 09:54:23 +00:00
Tobias Hunger
9afc605eb5 CMake: Fix mappings in helper.py
Some of the Qt names were wrong. Fix them and remove the work-arounds
in the library mappings.

Change-Id: I9b9afa3fb35c578e5c8d9cdef77224eb072ec8da
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:29:21 +00:00
Tobias Hunger
3bc9586e61 CMake: pro2cmake.py: Move defines from QMAKE_CXX_FLAGS into DEFINES
Change-Id: If3bfe715032b21dc046e63a79b0318a161d7a371
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:29:08 +00:00
Tobias Hunger
3cf92ab183 CMake: pro2cmake.py: Better separation between public and private libraries
Change-Id: I95a941ae92a77e049437d3cdd7d06eece11588f4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:28:58 +00:00
Tobias Hunger
8c28c85465 CMake: pro2cmake.py: Strip '-D' from compile options
Change-Id: I8239d36dc6af1b5eeded7f293dd6c151c10e289f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:28:44 +00:00
Tobias Hunger
9d83b54015 CMake: pro2cmake.py: Fix handling of file paths
This patch makes sure to store unchanged filenames as taken from qmake
into the scopes it creates.

The scopes are then kept longer: Merging/including scopes is handled by
adding the scope to a private _included_children member of the parent scope.

The methods to access data from scopes are then changed to take the
_included_children into account and a new "get_files" method is added,
that does all the necessary mapping to handle scope-dependent things like
$$PWD, etc.

This makes sure src/network is converted correctly incl. all the .pri-files it
includes as well as src/platformsupport/themes.pro. Both have been troublesome
before.

Change-Id: I28e92b7bcee1b91b248c17201c2729a54a3ce4a1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:28:30 +00:00
Tobias Hunger
52f676bf66 CMake: pro2cmake.py: Better representation of scopes as str
Include the current directory in the scope __repr__ output to make
it easier to understand where things wrt. include or file names go
wrong.

Change-Id: I09a6c17c6d8d547f1f64801bcde3c2e10c925ee1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:28:18 +00:00
Tobias Hunger
77a465ea2d CMake: pro2cmake.py: Better handling of debug features
Improve way that debug features are detected.

Change-Id: Ic0f0e74885e6d1e7f236c9efe4c77482ac212dbc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:28:08 +00:00
Tobias Hunger
9365a01531 CMake: pro2cmake.py: Fix typing information
Change-Id: Iaa6ea69c3c72eb1b626a976fcdb16243f15c609e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:27:59 +00:00
Tobias Hunger
81542ffb91 CMake: Map linuxaccessibility_supportPrivate to Qt::LASP
Change-Id: I6066f69c74c39fb97a286eb92748b5c4172b1efd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-09 07:27:48 +00:00
Alexandru Croitor
4f07e711c9 Add script to print out list of unconverted .pro files
Also prints some statistics.

Change-Id: Ieb55618c0d39604ca76d7a44390e61e02824a01f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-08 14:53:46 +00:00
Alexandru Croitor
547c7f8ca5 Fix architecture conditions
The actual variable that contains the architecture is
TEST_architecture_arch. TEST_architecture only contains the value
if the test was performed or not.

Fix the conversion script and all the generated files.

Change-Id: Icb3480832cab894948f4fef03b8bc8187cab6152
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-03 09:00:08 +00:00
Tobias Hunger
29f5c0ee70 CMake: Map cups to Cups::Cups, vulkan_support_private to Qt::VulkanSupportPrivate
Change-Id: Id03942becb08ca3ece589479ffe515f68034ddd4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-03 08:53:57 +00:00
Alexandru Croitor
e2e4525f78 Fix simplification of conditions involving apple
Previously a condition like APPLE AND (NOT APPLE_OSX) got simplified
to APPLE, which is wrong.

This happened by accident due to some sub-family simplifications
involving BSD, which APPLE was part of.

Technically APPLE is BSD derived, but for the purposes of the
conversion script consider APPLE not to be a BSD (hopefully there
should be no cases of using the bsd scope for apple machines in
qmake files.

Also regenerate the fontdatabase project, where the issue was found.

Change-Id: I18dcf4f29ffbff48c183ba95ca2a2e5cd5325d86
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-02 13:32:21 +00:00
Tobias Hunger
5c05c46e92 CMake: Set define for default QPA platform
This is used to set the default QPA platform and without it
all Gui applications trigger an assert in QString:-/

This is way simpler than going through configure.json.

Change-Id: I2c053e95c0f7e99e97a0b2918d8e4ac13d3494fd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-02 13:17:26 +00:00
Tobias Hunger
03a64ab80d CMake: pro2cmake.py: Handle QDBUSXML2CPP_*_HEADER_FLAGS
Change-Id: Ib5d34a6bf550a11154109064e4e718d0c79c722b
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-03-29 14:29:47 +00:00
Tobias Hunger
75658794e4 CMake: pro2cmake.py: Improve handling of dbus interfaces/adaptor sources
Change-Id: I3b642e1ae31996a81618e312183f4cc168bbbe1b
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-03-29 14:29:29 +00:00
Tobias Hunger
b9a3217c41 CMake: pro2cmake.py: Handle $$PWD better
Change-Id: I2e28b652c60d3490138ae0548b32d010faccc5a4
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-03-29 14:28:51 +00:00
Tobias Hunger
6a834a0c59 CMake: Map odbc to ODBC::ODBC
Change-Id: I55cf506cca87ac3e3fe9e0e1803f5118b46bf818
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-03-29 14:27:43 +00:00