Commit Graph

723 Commits

Author SHA1 Message Date
Friedemann Kleint
9c31acbf47 Move windowsuiautomation API support into QtGui
Task-number: QTBUG-83255
Change-Id: Ibface71931b6384494842ba9744d76f738c5ca85
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-27 22:28:41 +02:00
Tor Arne Vestbø
7a1650e343 Move QtVulkanSupport into QtGui and QtOpenGL
Task-number: QTBUG-83255
Change-Id: Ib021cecebda89fa2ab9332752124a8cec0a51a10
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-22 15:38:28 +02:00
Tor Arne Vestbø
f76161d61f Move QRasterBackingStore to QtGui
Task-number: QTBUG-83255
Change-Id: I339173de6e109c5a9b9572972ba894c15053c034
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-21 20:28:37 +02:00
Tor Arne Vestbø
42024666a3 Move QMacInternalPasteboardMime to QtGui
Task-number: QTBUG-83255
Change-Id: I00fda24479ad2c04781c5fefaa15fac1118033a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-21 13:21:53 +02:00
Joerg Bornemann
759da6742a CMake: Generate information about 3rdparty libs in module .pri files
For modules that are not yet ported to CMake and that use
   QMAKE_USE += libfoo
we need to provide the information about libfoo in the qt_lib_XXX.pri
files.

Also, we now generate qt_ext_XXX.pri files for bundled 3rdparty libs.

Task-number: QTBUG-75666
Change-Id: I9e4b057a197554ecb37c294c0bf09e2a2b3aa053
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:26:53 +02:00
Joerg Bornemann
d5cb44cd3a pro2cmake: Fix Scope.get_string for list values
QMake variables are always string lists, but some variables are used to
represent single string values. People tend to fill those variables with
multiple values and expect them to be joined by spaces.

Exhibit A: qtdeclarative/tools/qml/qml.pro
    QMAKE_TARGET_DESCRIPTION = QML Runtime

QMake supports this for many values. Do the same for Scope.get_string().

Change-Id: I6af22bc1bfed07a4d8eac94d7315051a5bcb7a4d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-15 08:54:21 +02:00
Joerg Bornemann
286d79d2ed pro2cmake: Handle QMAKE_TARGET_XXX variables
Change-Id: I62151e04d21c20d8c8ad5825464f26074c8abc3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 14:31:12 +02:00
Alexandru Croitor
64f62105ce CMake: pro2cmake: Fix cmake api detection for plugins
We should search for the values of function names rather than
the mapping key.

Change-Id: Iedef7fcf4d716ff7f6d277d9626d9dc2dd781401
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-12 13:03:11 +02:00
Friedemann Kleint
d2ae13b75b cmake: Add MinGW platform check
Task-number: QTBUG-78167
Change-Id: Id203925d69c5b4d7e0841c0dbdd298269a13f06a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 08:57:04 +02:00
Joerg Bornemann
95b441d097 pro2cmake: Add library mappings for the restructured ActiveQt module
Change-Id: I643cb2afc0e4b74abcbd67bb9002ab334337be37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 16:23:15 +02:00
Christophe Giboudeaux
5dcaa11cc2 pro2cmake: Honor INSTALL_EXAMPLESDIR if defined
When building examples standalone, 'INSTALL_EXAMPLESDIR' may be
undefined.

The converted .pro files now check whether the variable is
set to prevent installation into unexpected locations.

Fixes: QTBUG-81797
Change-Id: I9f97568923c8103011a41d9af7cfe02dd1e40b56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 15:41:26 +02:00
Mårten Nordheim
9c85078dc2 Support special casing in configure.cmake
Change-Id: Ib899a5446a81e2604ba3642b9ad37aedc18ca650
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-05 15:34:15 +02:00
Mårten Nordheim
6ffe9b1c42 pro2cmake.py: Generate .cmake.conf files for versioning
And create one for QtBase at the same time.

Fixes: QTBUG-83835
Change-Id: Icc6b022165a57bd4e22c23bdb0016522b99a5b80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 17:44:03 +00:00
Tor Arne Vestbø
ebc3350be7 pro2cmake: Translate (QT|QMAKE_USE)_FOR_PRIVATE into PRIVATE_MODULE_INTERFACE
Fixes: QTBUG-83063
Change-Id: I5b02cd236ef0fd3a9ed389294c05f8e3024463cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 14:20:26 +02:00
Tor Arne Vestbø
4618fa6f8d Fix pro2cmake help text
Change-Id: I84980dda981c50da159e4bb81b08190b882d6978
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 14:20:26 +02:00
Fabian Kosmale
14c713e759 pro2cmake: convert QMLTYPES_FILENAME to QT_QMLTYPES_FILENAME
Change-Id: I9afc6d4c0c9b3fd87ef28f15da0a984d778b83ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 10:13:56 +02:00
Joerg Bornemann
062b50abff CMake: Namespace all our IMPORTED targets
CMake IMPORTED targets should be namespaced so that CMake knows that
the name refers to a target and not a file.

Use the existing WrapXXX naming scheme where applicable.

Fixes: QTBUG-83773
Change-Id: I5b0b722c811200c56c260c69e76940a625228769
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-29 23:08:32 +02:00
Joerg Bornemann
4545eadd3e CMake: Port the 'static_runtime' feature
This feature is Windows-only and must be turned on manually.
For MSVC it sets the MSVC_RUNTIME_LIBRARY target property.
For MinGW it adds the -static linker flag.

Change-Id: I9da3b88d545b34bc34a3a80301b2dd1b5986fa88
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-23 10:09:15 +02:00
Leander Beernaert
6fbeef4c6b CMake: Add qt6_add_plugin public API
This patch adds a publicly callable qt6_add_plugin() API to create
plugins. This API is meant to cover cases such as the plugandpaint
example.

This patch also renames qt_add_plugin to qt_internal_add_plugin in order
to avoid clashes with the public API. To avoid breaking the existing
projects, a compatibility wrapper function is enabled by default unless
QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified.

Fixes: QTBUG-82961
Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-22 09:51:12 +02:00
Joerg Bornemann
2a0585e7cb CMake: Port the 'pkg-config' feature
Change-Id: If571208aaaba8c1d0af834e8ae11869872d42135
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-04-21 09:01:39 +02:00
Joerg Bornemann
3eed6d76b7 CMake: Port the 'ccache' feature
This maps to the CMake variable QT_USE_CCACHE.

Change-Id: I3258027301284d907f6ecde6c65d2c0dde8f0a11
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 23:10:11 +02:00
Joerg Bornemann
8a5ffc4f73 CMake: Port the 'ltcg' feature
This maps to the CMake variable CMAKE_INTERPROCEDURAL_OPTIMIZATION.

Change-Id: Id0ce48f176b95c27e74ab80276e89503b1660f79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 23:10:09 +02:00
Joerg Bornemann
9b45ca7411 CMake: Port the 'cross_compile' feature
Change-Id: Iccd1d55e95797740a4a8689462ce9ab1e49a62c1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:42 +02:00
Joerg Bornemann
6f5c91e985 configurejson2cmake: Remove mention of the system-xcb feature
This feature was removed in commit 60588e1a.

Change-Id: I061410dfab13a2210474014892d1bc828a5b21cf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:41:44 +02:00
Alexandru Croitor
67ee92f4d8 CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.

For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.

On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).

Frameworks, app bundles and shallow bundles should also be handled
correctly.

Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).

Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.

Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.

By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .

Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.

Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.

configurejson2cmake modified to include correct conditions for the
rpath feature.

It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).

Amends e835a6853b

Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-17 15:59:25 +02:00
Leander Beernaert
30f69f7ff6 CMake: Add library mapping for xcb-fixes
Change-Id: Ida893674fa0782446acdac4ee5dfec4849d4605f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-15 16:25:19 +02:00
Leander Beernaert
812cc76b02 CMake: Update pro2cmake and friend to convert QtVirtualkeyboard
Expand $$MODULE_BASE_DIR to ${QT_BUILD_DIR}.

Add library mappings for Hunspell.

Add test mappings for QtVirtualKeyboard regarding 3rdparty Hunspell and
T9Write.

Change-Id: Ief007456d0471cbcf9a03d819291edec5f63680f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-15 14:15:52 +00:00
Leander Beernaert
a77cd07b24 CMake: pro2cmake expand variables for qt_add_resource()
Change-Id: Ida1196645dabcb0c3aee210d9bc5ee5632a9ccc5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-14 13:19:23 +02:00
Mikhail Svetkin
ae57e4fba5 cmake: Add library mapping for QtHttpServer
Change-Id: I3e12f164f7f6891c60c0d9da700b888850021e53
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-09 20:11:31 +02:00
Alexandru Croitor
066e8a4557 CMake: Handle missing packages in project compile tests
If a find_package() in a try_compile project doesn't find a package,
and we then link against a non-existent target, the configuration
failure of the compile test also fails the configuration of the
project.

To avoid that, separate library targets from non-targets, and make sure
to only link against the targets if they exist.

pro2cmake now outputs modified compile test project code which iterates
over targets and non-target libraries, and links against them when
needed.

Change-Id: Ib0f4b5f07af13929c42d01a661df2cabdf9b926b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-09 11:26:42 +02:00
Alexandru Croitor
e0346df1b2 CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.

Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.

Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.

FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.

The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.

Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.

Adjust the projects and tests to use the new target names.

Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).

Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-04-08 22:03:24 +02:00
Alexandru Croitor
0a13c3a3f0 CMake: pro2cmake: Handle $$PWD in included .pri files correct-ish
Previously the $$PWD was evaluated within the including .pro file,
which generated incorrect relative paths to source files.

Now we use a horrible hack to evaluate keys ending with SOURCES
and HEADERS. If such is a case, use a map_file transformer which
will use the included scope, thus creating correct relative paths.

Fixes projects in qtdeclarative like src/qmltypregistrar and qmllint.

Checked that it doesn't break projects in qtdeclarative and qtbase.

Change-Id: I21f1e4c638c2cf8d0f67e94e1a583ebc54c175a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-08 21:58:41 +02:00
Alexandru Croitor
0bfbe10ff2 CMake: Implement proper exclusion of tools including installing
The previous approach didn't work for prefix builds. While a target
might be excluded from building via EXCLUDE_FROM_ALL property, when
calling make install it would still try to install the target and
thus fail.

It's not possible to modify an install() command in a post-processing
step, so we switch the semantics around.

pro2cmake will now write a
qt_exclude_tool_directories_from_default_target() call before adding
subdirectories. This will set an internal variable with a list
of the given subdirectories, which is checked by qt_add_executable.

If the current source dir matches one of the given subdirectories,
the EXCLUDE_FROM_ALL property is set both for the target and the
qt_install() command.

This should fix the failing Android prefix builds of qttools.

Amends 622894f96e

Change-Id: Ia19323a2ef72a3fb9cb752ad2d4f2742269d11c4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-07 23:22:33 +02:00
Joerg Bornemann
067ae2df45 CMake: Port the 'static' feature
Now that we have the 'shared' feature implemented we can easily port
the 'static' feature.

Change-Id: Ia9b54b68d532d73c3d62d12a86c9e8b83e7909c8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 21:42:53 +02:00
Alexandru Croitor
9b21dbbd79 CMake: Reformat python scripts
Change-Id: I1dfac318cdbbc4b4b7c76b113edca7db8f52f56b
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 11:00:53 +02:00
Alexandru Croitor
d64a7c9f5a CMake: pro2cmake: Allow specifiying custom output file
Change-Id: If984d2bbc3e4b655a5eb58c68b282e3d13d51218
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-06 11:00:53 +02:00
Alexandru Croitor
34c7344e2a CMake: configurejson2cmake: Port precompile_header feature
We don't need the test, we can just check the value of BUILD_WITH_PCH
to know whether the feature is enabled.

Regenerate configure.cmake files.

Change-Id: I5691a22af2913bc398f99825e0c41cf2daf5a587
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 11:00:53 +02:00
Sona Kurazyan
6a6482cb8d Add Qt Core5Compat to the library mapping
Change-Id: Iad613c75705b09f7ae043cff417b0fcf3f5dd946
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 17:45:43 +00:00
Alexandru Croitor
8a0a31ed68 CMake: pro2cmake: Skip conversion of doc snippets
Most of them are hand-written.

Change-Id: Ia3d83cdc9e279420c9b4700993b428e10cf8fb22
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 16:05:26 +02:00
Alexandru Croitor
61d9428d8c CMake: Make sure that the library config.test is used for assimp
Change-Id: Ia5b2a2ffca2dda460a323fd3f564c548be84c0aa
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 16:05:22 +02:00
Alexandru Croitor
d2931a2626 CMake: Handle standalone config.tests in configure libraries section
Some library entries in configure.json have a test entry.
An example is assimp in qtquick3d.

qmake tries to find the library via the sources section, and then tries
to compile the test found in config.tests/assimp/assimp.pro while
automagically passing it the include and link flags it found for assimp.

We didn't handle that in CMake, and now we kind of do.

configurejson2cmake will now create a corresponding
qt_config_compile_test call where it will pass a list of packages and
libraries to find and link against.

pro2cmake will in turn generate new code for the standalone
config.test project. This code will iterate over packages that need to
be found (like WrapAssimp) and then link against a list of passed-in
targets.

In this way the config.test/assimp/main.cpp file can successfully
use assimp code (due to propagated include headers).

qt_config_compile_test is augmented to take a new PACKAGES argument,
with an example as follows

PACKAGES PACKAGE Foo 6 COMPONENTS Bar
         PACKAGE Baz REQUIRED

The arguments will be parsed and passed to the try_compile project,
to call find_package() on them.

We also need to pass the C/C++ standard values to the try_compile
project, as well as other try_compile specific flags, like the
toolchain, as given by qt_get_platform_try_compile_vars().

Change-Id: I4a3f76c75309c70c78e580b80114b33870b2cf79
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 16:05:19 +02:00
Alexandru Croitor
622894f96e CMake: Allow excluding tools and apps from the default 'all' target
Qt uses the qtNomakeTools() function to mark a directory which will
not be built as part of the default target. This is especially
important when cross-compiling (to iOS for example) because the build
process might fail.

The condition for not building these "GUI tool sub-directory projects"
is the absence of the "tools" value in qmake's QT_BUILD_PARTS
variable.

Introduce a QT_NO_MAKE_TOOLS CMake variable. If the value is true,
it's equivalent to "tools" not being present in QT_BUILD_PARTS.

Introduce qt_exclude_tool_directories_from_default_target().
It's the qmake counter part to qtNomakeTools().

Teach pro2cmake to generate it where appropriate.

Change-Id: If2e5958d91847ab139af0e452608510286e73fa0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-02 09:39:36 +02:00
Alexandru Croitor
560e8547b3 CMake: Report which qt parts will be built by default
Like libs, tools, examples, tests. Built by default means
they are part of the default make / ninja target.

Change-Id: I304e5724fc5dbd39626e9d589a6e1e92a4dd7882
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-02 09:39:31 +02:00
Joerg Bornemann
7909de1beb CMake: Define QT_STATIC for static builds
QT_STATIC must be defined for static builds to have the right
import/export symbol macros defined. Originally, this macro is wrapped
in a condition. That's why we extend qt_feature_definition to be able
to write a prerequisite to qconfig.h.

Change-Id: I610e60acc7f5bdc031eff6d53a76e0b229a5c8c2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-01 21:19:35 +02:00
Joerg Bornemann
c20f23e03b CMake: Port the 'rpath' feature
This is needed for qmake mixing.

Change-Id: I368169606606a8de4dc8f2db5b98660a0a2fa349
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-04-01 21:19:32 +02:00
Leander Beernaert
b6446a5ffa CMake: Fix exception in pro2cmake about missing v1 api
This patch silences the exception about missing v1 api entry for the
qt_add_3rdparty_library() function.

Change-Id: I74a473ed1c063b13f0a9ca64dcb568b8f8b27235
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 17:00:27 +01:00
Leander Beernaert
8dcf7d2674 CMake: Add support for bundled SQLite library
Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 13:52:05 +01:00
Leander Beernaert
f716a87352 CMake: Fix configuration of FEATURE_JPEG
Without this patch JPEG support is always disabled, even though we can
build it from 3rdparty sources.

Change-Id: I9e619f0ca8ec3ca3e7c58981bb6af9b33426a029
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 10:51:55 +01:00
Joerg Bornemann
7e4361ffbd CMake: "Port" the c89, c99 and c11 features
We can ignore the tests for those features and directly ask CMake
whether the compiler supports the respective language version.

Change-Id: I31cd35493443fea0c6d0b0a5e641768c3bcbe736
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 16:42:59 +01:00
Alexandru Croitor
e4efd56637 CMake: pro2cmake: Consider system-assimp for conditions
Change-Id: Idee55dfdd88b04792dc1485a818ab41218fa2707
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-23 09:55:05 +01:00
Leander Beernaert
3c2aa878dc CMake: Skip inclusion of selfcover.pri
Do not process selfcover.pri in the conversion as the output requires a
lot of special case fixs ups.

Change-Id: Iebee484db887973369b5604344a6d486f4bea20b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-19 12:52:09 +01:00
Alexandru Croitor
ab60f32d6f CMake: Don't use GUI for tests that use QT += testlib-private
Change-Id: I90cac19928d6e6e30214a6480a5855479a8d4d77
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-19 12:47:50 +01:00
Mitch Curtis
8185da097a CMake: pro2cmake: Add alternative package installation instructions
I kept getting

Ignoring pytest: markers 'python_version >= "3.7"' don't match your environment

when using the pip command, but this alternative worked.

Change-Id: Ibfc7f36de04153d2247f8f62bd129b0c0c723bf2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-18 14:44:10 +00:00
Alexandru Croitor
f66a5c2d61 CMake: pro2cmake: Handle javascript files not present in qmldir
If a file is present in a QML_FILES variable inside a qmake .pro
file, but is not listed in the static qmldir file, mark the file
so no qmldir entry created for it.

Change-Id: I3ec77b6eedf70ea9124bf7f447ee3477204bc4f7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-17 09:18:05 +01:00
Alexandru Croitor
605a36800f CMake: pro2cmake: Handle system tiff feature
Don't exclude it, because we use it in qtimageformats.

Change-Id: I0004830580dd9711cf7a5bd934ecd5a7f9036800
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-17 09:18:01 +01:00
Tor Arne Vestbø
77885f8402 cmake: Remove APPLE prefix from platform names
None of the other platforms have it.

Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:56 +01:00
Tor Arne Vestbø
db745fdd2d cmake: Fix naming when referring to Apple macOS
Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:52 +01:00
Leander Beernaert
a5ec9bea63 CMake: pro2cmake handle ${QT_SOURCE_TREE} for include statements
Replace ${QT_SOURCE_TREE} with top level project directory when
encountered in include statements.

This is required to parse tests/auto/testlib/selftests/test/test.pro.

Change-Id: I80f31142cf5a35441d1424c38e21bb097e44cd0f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 16:30:46 +01:00
Alexandru Croitor
d4018dac8b CMake: Reformat the python scripts using black
Change-Id: I1e2eba46eb7c9dfefd267be91790be7898634c3a
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:53 +01:00
Alexandru Croitor
d2419b0d8c CMake: pro2cmake: Handle LIBS_SUFFIX define correctly
Matches the LIBS_SUFFIX define we use in Android conditions
and replaces it with a sane amount of escaped characters.

Change-Id: I7d870f992c70b105dd80b6fa94f87d3fa5644006
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:29 +01:00
Alexandru Croitor
f46c11989a CMake: pro2cmake: Fix opengles condition substitution
Missing parenthesis caused wrong condiiton simplification in scopes.

Change-Id: Ia2a1a97f4da36b185631a2a3c7855ae01595b0f7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:27 +01:00
Alexandru Croitor
02f08d5038 CMake: Remove old 3rdparty mechanism for harfbuzz-non-ng
Change-Id: I37c1e561ac83c51a06aae50ccb176094785d52f5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:13 +01:00
Alexandru Croitor
729a73a9cf CMake: Remove old 3rdparty mechanism for double conversion
Change-Id: I2b20d4d9d95a1f7f59bc506046a1ebc20eb305f7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:07 +01:00
Alexandru Croitor
d71545e115 CMake: Add python version requirement note to pro2cmake
Change-Id: Iccaf61e19fb7257ed21f656c287976d7d778ed1c
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-09 23:09:29 +01:00
Alexandru Croitor
d0400b1cb8 CMake: Disable framework builds on macOS when target config is Debug
This prevents Coin from trying to automatically enable the framework
feature when no configuration is specified on the command line.

By default if no configuration is specified, and there's a .git
subfolder, "Debug" will be the chosen config, and that would conflict
with the framework feature, which would cause configuration to fail.

Change-Id: Ia9db3e8178794737692307b4662a2e77cc574ccd
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-03-09 23:09:12 +01:00
Alexandru Croitor
28fff4a551 CMake: Fix handling of QML_IMPORT_VERSION in pro2cmake
Change-Id: Iaab6796204a6bb13b3d061d2589b2aebd4f342a8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-09 23:09:07 +01:00
Alexandru Croitor
95e1469eb8 CMake: Port most of the configure summary support
Teaches configurejson2cmake about summaries / reports, so things
like enabled features, configure sections, notes, etc.

Add relevant CMake API for adding summary sections and entries,
as well as configure reports. The commands record the passed data,
and the data is later evaluated when the summary needs to be printed.
This is needed, to ensure that all features are evaluated by the
time the summary is printed.

Some report and summary entries are not generated if they mention a
feature that is explicitly exclduded by configurejson2cmake's feature
mapping dictionary. This is to prevent CMake from failing at configure
time when trying to evaluate an unknown feature. We should re-enable
these in the future.

A few custom report types are skipped by configurejson2cmake (like
values of qmake CONFIG or buildParts).
These will have to be addressed a case-by-case basis if still needed.

Change-Id: I95d74ce34734d347681905f15a781f64b5bd5edc
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-09 23:08:57 +01:00
Joerg Bornemann
d0911d0a92 CMake: Port the 'separate_debug_info' feature
For this, we have to uninline the separate_debug_info configure test,
because supporting the conversion of this in configurejson2cmake is not
worth the hassle.

Separate debug information can be turned on for a target by calling the
function qt_enable_separate_debug_info. For Qt's shared libraries and
tools separate debug information is generated if the
'separate_debug_info' feature is manually turned on.

Change-Id: Ic2ffc15efef3794dc0aa42f3d853ef6d651a751c
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-06 13:38:37 +01:00
Joerg Bornemann
a3d0ef019a CMake: Fix condition of the 'debug' feature
For the moment, in feature conditions that use STREQUAL, the lhs must be
a variable.

Change-Id: I56fe24baeb8067662ea81984fd48383da4c5b67b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-06 13:38:13 +01:00
Leander Beernaert
8ffb9053ad Handle configure.json library tests
This patch updates configurejson2cmake.py to generate compile tests for
library entries. The test also support the inherit keyword, which is
currently limited to one level of inheritance.

LibraryMapping has been extended with a test_library_overwrite as a
means to overwrite the mapped library during a compile test. Certain
tests such as openssl_headers form src/network are mapped with *_nolink
libraries which do not exist when the test is run. Failing to do so will
cause the test to run as it is skipped when the library target isn't
found.

To avoid redundant checks, the library tests need to be opt in by
setting run_library_test to True on an instance of LibraryMapping.

Change-Id: I607b24eda389fa67afad301c616e31bb7ab38d20
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-06 12:32:48 +01:00
Joerg Bornemann
1057d568bb configurejson2cmake: Fix non-inline compile tests
If there's no test dir set, use "config.tests" as default value, and
perform the check for the existence of CMakeLists.txt in
configurejson2cmake, not the configure.cmake file.

Change-Id: I8d3be8f2b68767c7592665c374022353c2dc6c57
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:20 +01:00
Joerg Bornemann
343865201a configurejson2cmake: Fix compile tests without a "test" entry
Set the default value of the "test" entry to the test's name like the
qmake-based configure does.

Change-Id: Ic1027c54c6312c47dca241dd7e3dc65b3e35d36f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:16 +01:00
Joerg Bornemann
b99321b78b CMake: Port the 'force_debug_info' feature
This feature is read-only and is ON if CMAKE_BUILD_TYPE is RelWithDebInfo
or if that value is in CMAKE_CONFIGURATION_TYPES.
It mainly exists for the qmake support.

Change-Id: I25cb57e832dcfcab100834a104b1a3d34f01086b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:11 +01:00
Joerg Bornemann
46a2366d12 CMake: Port the 'debug_and_release' feature
This feature is read-only. It's controlled by the multi-config feature
of CMake. It mainly exists for the qmake support.

Change-Id: I322459598fe92568eda4d42319ded444537e95d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:06 +01:00
Joerg Bornemann
20410cdc11 CMake: Port the 'shared' feature
This feature is read-only and supposed to be set by BUILD_SHARED_LIBS.
It mainly exists for the qmake support.

Change-Id: I722b0de53211d0aab1924e45a77120c890f31f50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:01 +01:00
Joerg Bornemann
becbd07f55 CMake: Port the 'debug' feature
This feature is read-only and supposed to be set by variables like
CMAKE_BUILD_TYPE. It mainly exists for the qmake support.

Change-Id: Ic7e32cbda0f3c2d92dd446b07a3bf1a8d85ec3b9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:47:56 +01:00
Alexandru Croitor
d50b22e75d CMake: Remove incorrect hardcoded harfbuzz condition
The non-system harfbuzz feature doesn't actually have a condition
in the json file.

Change-Id: I4b74915f28da97d6ef8f89690e91306d243913ee
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-04 16:16:27 +00:00
Joerg Bornemann
1a30a82830 CMake: Fix stack-protector-strong test and feature
And in order to do this we must teach qt_config_compile_test a
COMPILE_OPTIONS argument.

Change-Id: I66fa45142b544e3a2fc599af1c1a4c69b442b318
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-04 16:31:13 +01:00
Edward Welbourne
b6fad7588a Correct pro2cmake's Requirements message
It only told me about two packages to install, so I got an error after
I'd installed them and ran it, because I hadn't installed the
rest. Save the next person an extra round-trip.

Change-Id: I8b544fc2637b86656ec2adddce8e95e6e9e1daf5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-28 10:47:36 +01:00
Joerg Bornemann
119ffd4781 CMake: Port the reduce-relocations feature
As reduce-relocations implies bsymbolic_functions, we also add the
-Bsymbolic-functions linker flag.
Also, handle the .dynlist files that are passed to the linker by
bsymbolic_functions.prf in the qmake build.

Change-Id: I535c33fba888596d2f8975b16864bbe9f0a7caa4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-25 15:47:50 +01:00
Alexandru Croitor
26059d1b9b CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that:

- the python scripts do not ignore certain system_foo features anymore
  (it is a hardcoded list for now just to be safe)

- configurejson2cmake now outputs
  qt_find_package(WrapSystemFoo) calls for bundled libraries
  (see below)

- the harfbuzz .pro file is modified to accommodate pro2cmake
  not being able to correctly parse some conditional scopes

- the freetype .pro file is modified to make sure linking of the
  library succeeds without duplicate symbol errors, which qmake
  doesn't encounter due to magical exclusion of cpp files that are
  included in other cpp files (presumably for include moc_foo.cpp
  support)

- feature evaluation for Core, Gui, Network now happens in the
  qtbase/src directory, so that bundled libraries can be conditionally
  built

- for each bundled library there are now two FindWrap scripts:
  - FindWrapSystemFoo which finds an installed library in the system
  - FindWrapFoo which either uses the system installed library or
    the built bundled one depending on a condition

- projects that intend to use bundled libraries need to link against
  WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets
  (this is handled by pro2cmake).
  Unfortunately manually added qt_find_package(WrapFoo) calls might
  still be needed as is the case for WrapFreetype and others.

- a new cmake/QtFindWrapHelper.cmake file is added that provides
  a macro to simplify creation of WrapFoo targets that link against
  a bundled or system library. The implementation is fairly ugly
  due to CMake macro constraints, but it was deemed better than
  copy-pasting a bunch of almost identical code across all
  FindWrapFoo.cmake files.

- a qtzlib header-only module is now created when using bundled
  zlib, to provide public syncqt created headers for consumers
  that need them. These are projects that have
  'QT_PRIVATE += zlib-private' in their .pro files
  (e.g. qtimageformats, qtlocation, qt3d, etc.)
  This is unfortunately needed due to QtNetwork using zlib
  types in its private C++ API.

The change includes support for building the following bundled
libraries:
- zlib
- libpng
- libjpeg
- Freetype
- Harfbuzz-ng
- PCRE2

The following 3rd party libraries are still using an old
implementation within the CMake build system, and should be migrated
to the new one in the near future:
- double-conversion
- Old harfbuzz

The are a few libraries that are not yet ported:
- system-sqlite
- systemxcb
- maybe others

Among other things, this change allows building qtbase on Windows
without requiring vcpkg.

Task-number: QTBUG-82167
Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-25 15:43:16 +01:00
Alexandru Croitor
160184d6a5 CMake: Fix X11 and xkb library usage in the platform projects
This is a prerequisite for building the bundled 3rd party libraries.

Because the feature evaluation will be moved into src/CMakeLists.txt,
some of the X11 packages were found in the src dir, and then a second
time inside the x11-related projects.
These qt_find_package calls in the x11 related projects tried to
promote the imported targets to global, which failed, because they were
created in a different directory scope.

To avoid this, the special case qt_find_package calls are removed from
the nested projects.

Also, fix the mapping of some of the x11 libraries to be correct
- xkbcommon_x11 was incorrectly mapped to XKB::XKB instead of the
  xkb common x11 library
- xlib was mapped to xcb, whereas X11 is the correct CMake target

Change-Id: I30781b2ecbdd478c98419b14baa0492037e49c61
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:16 +01:00
Frederik Gladhorn
e3c4870feb Do not try to find .qmake.conf past the root directory
In case of .qmake.conf not existing, this would result in an infinite loop.

Change-Id: I577aaed7a502efb7b01dc6b199dcf464358bf5a9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-21 16:04:19 +01:00
Johan Klokkhammer Helsing
00eeed234f Move QOpenGLWidget from QtOpenGL to its own module
Same pattern as QtQuickWidgets. Gets rid of QtOpenGL's dependency on QtWidgets.

Task-number: QTBUG-74409
Change-Id: I4f9b55c23e25a1e0519734037b768a16e870c7d2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-02-18 09:22:51 +01:00
Leander Beernaert
99da0c164b Use INSTALL_QMLDIR instead of Qt6_DIR for qmltypes properties
Change-Id: Ic7e6230656670ebe925530eea5e34b16b6fea59b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:45:38 +00:00
Mårten Nordheim
f126d44db6 Add library mapping for QtShaderTools
Change-Id: Ideefd13d75bdd4e0463c0f7b1e15c0781cfffe8c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:44:51 +00:00
Leander Beernaert
572c03eb7a Add support for qt_helper_lib()
Add qt_add_3rdparty_library() function as a replacement for qmake's
qt_helper_lib feature.

All 3rdparty libraries will be available under the Qt:: alias when built
through this method so that they can properly register as dependencies
of a Qt module.

This patch also adds Qt3rdPartyLibraryConfig.cmake.in to export the
CMake configuration for static builds and shared libraries.

Change-Id: I52bf3a95ca22fccd9ab54343468847bb1b570c28
Fixes: QTBUG-81969
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:43:29 +00:00
Mårten Nordheim
360d9fba23 Use posixpath when generating relative path
Fixes generating some paths with the backslash in the beginning

Change-Id: Ic7705d61f9362d3b854b2eb95f95a8951beca72d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-02-07 13:57:59 +00:00
Mårten Nordheim
b14ee53a08 Add necessities for qtquick3d
Change-Id: I39aadda7ed2b088a475ba5f940d1cb65b5b62f94
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-06 13:22:34 +00:00
Alexandru Croitor
c5b61d2e90 pro2cmake: Handle QT += core-private correctly for modules
If a module project (Quick) contains QT += core-private, the
qmake semantics translated to CMake would mean the following:

target_link_libraries(Quick PUBLIC Core)
target_link_libraries(Quick PRIVATE CorePrivate)
target_link_libraries(QuickPrivate INTERFACE CorePrivate)

Whereas a QT_PRIVATE += core-private only means
target_link_libraries(Quick PRIVATE CorePrivate)

without adding any public dependencies to QuickPrivate.

To achieve that, we need a few modifications to both pro2cmake and
QtBuild.cmake

- pro2cmake doesn't automagically add public and private dependencies
  to targets when encountering a private module assigned to QT.
  Instead it generates the logic described above by passing correct
  LIBRARIES, PUBLIC_LIBRARIES, and PRIVATE_MODULE_INTERFACE values.

- pro2cmake doesn't do any dependency magic for non-module targets
  anymore, like executables, plugins, internal_modules. This means
  that QT assignments are now regular public dependencies.

- qt_add_module and qt_extend_target now accept a new
  PRIVATE_MODULE_INTERFACE option.

- qt_extend_target does not automagically make private modules be
   public dependencies on other private modules.

- qt_extend_target correctly assigns PRIVATE_MODULE_INTERFACE values
  to Private module only. For other target types, it's a no-op.

The change requires regeneration of all projects.

When we fix pro2cmake and QtBuild.cmake to properly handle
internal_modules (create only Private modules without creating
a non-Private counter part), we will need another project regeneration
to correctly assign dependencies.

Change-Id: I4c21f26b3ef3b2a4ed208b58bccb65a5b7312f81
Task-number: QTBUG-81780
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 14:36:16 +00:00
Alexandru Croitor
ccdc6c2dd3 pro2cmake: Fix flake and mypy issues
Change-Id: I33ab818c53f751ede7a7840b1086a3ae8263e109
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 14:42:03 +00:00
Alexandru Croitor
957007a949 pro2cmake: Handle QML_IMPORT_MAJOR_VERSION and minor variants
This is needed for qtdeclarative examples, otherwise CMake configuration
fails due to missing QML import version info.

Change-Id: Iedde7b6a9e2d5ac7f6d81969ac7d6d874361c02e
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 14:41:40 +00:00
Leander Beernaert
88b7f64e73 Fix example generation without qmldir file
Do not return when no qmldir file is present and no dynamic qmldir
information is set.

Change-Id: I04e458f69e4e4a6ec9b1e7ca7ba0b0f7520996f7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-28 20:43:44 +00:00
Alexandru Croitor
3c6b0a07da pro2cmake: Don't set OUTPUT_NAME for qml plugins
Amends f67d8ae2d4

Change-Id: I288a9388d4ebd354199bfa0913eff34d93a58d75
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-27 15:10:16 +00:00
Alexandru Croitor
604aa83ad9 Reformat pro2cmake
Change-Id: I97175e8edbd4b911397f5b03a646006eff32a5bc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2020-01-27 11:49:25 +00:00
Alexandru Croitor
f67d8ae2d4 Fix plugin target names to be compatible with Qt 5
In Qt 5, qmake generates CMake Config files which expose the plugins
as imported libraries. The name of these libraries are derived from
the plugin class name. So QCocoaIntegrationPlugin, and not qcocoa.

To keep compatibility between Qt5 and Qt6 CMake target names,
the pro2cmake script should generate plugin target names based on the
plugin class names.
To avoid passing the same name in qt_add_plugin (target and CLASS_NAME),
derive the class name from the target if the class name is
not explicitly specified.

Also add a new OUTPUT_NAME parameter which is used to change the
final file name of the plugin, so that it's compatible with Qt5.
For example to generate a qcocoa.dylib file, instead of
QCocoaIntegrationPlugin.dylib file.

The same OUTPUT_NAME value will be used for generation of plugin .prl
files for qmake consumption.

Change-Id: I4d53e680d7beb62befecd359cdf6bba60a34ff0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-27 11:49:11 +00:00
Leander Beernaert
cce8ada814 Support for QML Type Registrar
Change-Id: Ifc1f44cf40b22c20ab768333ba9d5ce58a5f7250
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-24 12:29:30 +00:00
Leander Beernaert
b29cb7889a Run make format
Change-Id: If1107aefbfd374d6b664a94b21b9bbb5ed4cc178
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-16 08:41:08 +00:00
Leander Beernaert
99a824bbb7 Do not set OUTPUT_DIRECTORY if it is already set
This can happen in unit tests where a test has TARGET set to "../name",
which requires the target to placed in the parent binary directory.

It is possible to run into a second assignment for OUTPUT_DIRECTORY via
the DESTDIR property (e.g: qdbushmarshall test) which can then result in
two OUTPUT_DIRECTORY values.

However, the first one needs to take precedence or the tests won't
execute properly.

Change-Id: Ib263843fa86c3dd68d92a0989b95f2890335c92d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-16 08:36:43 +00:00
Leander Beernaert
ee5d7facc1 Adjust OUTPUT_DIRECTORY for tests when targets starts with ../
Automatically insert OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../
for each tests that has a target name which starts with ../. To do so we
added the TARGET_ORIGINAL property which does not remove the ../ from
the target name.

Change-Id: I55ba1385aa160610a0ff80ed56ff37a80c3590fa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-14 13:16:45 +00:00
Leander Beernaert
30af71d7eb Fix CMAKE_CROSSCOMPILING property name conversion
Change-Id: I481043166ce3b0b70834bf63f2a70e84203304e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-13 09:33:23 +00:00
Leander Beernaert
6d73b02ace Add library mappings for QtAxContainer and QtWekKitWidgets
Change-Id: I5d5b77e86437f752465bf8ae7c6dd6730b3bf471
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-11 11:33:01 +00:00
Leander Beernaert
19e79ca0a4 Add condition mapping for cross_compile to CMAKE_CROSS_COMPILING
Change-Id: I90220eda846299c14aca67ba59a2a9518bea2dee
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-11 10:37:57 +00:00
Leander Beernaert
e0205f1793 Add special condition replacement for libclang in qttools
Change-Id: Icf35a2e39307e6239d8704824105bdc6b9081ffd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-10 12:37:22 +00:00
Leander Beernaert
ea9c2e558c Add library mapping for QtTools
Change-Id: I59fdad5b56875b965a4831b07b5d8d13f9d7b10f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-12-09 14:42:51 +00:00
Leander Beernaert
0f220d473a Collect Json Metatypes from CMake's Automoc
This patch adds a new bootstrap tool which will read CMake's
AutoGenInfo.json and ParseCache.txt to determine what the current
list of json files is that needs to be passed to moc --collect-json
option.

Right now this is enabled for qt_add_module() with the option
GENERATE_METATYPES. pro2cmake has also been updated to detect qmake's
CONFIG += metatypes and to generate the above option for modules.

The implementation lives in Qt6CoreMacros so it can eventually be used
in the public facing apis.

The generated meta types file is saved under the target property
QT_MODULE_META_TYPES_FILE.

Change-Id: I03709c662be81dd0912d0068c23ee2507bfe4383
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-04 10:48:06 +00:00
Alexandru Croitor
461020a86a Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.

Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.

The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG    for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG   for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig

These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
  information for each module

Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).

These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.

In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.

This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.

The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.

Note that "c++11" like features are normalized to "cxx11".

Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.

Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.

Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-03 13:37:56 +00:00
Alexandru Croitor
55a15a1c1b Add initial support for cross-building to iOS
Tested locally with the following configurations:
- iOS device builds (arm64)
- iOS simulator builds (x86_64)
- iOS simulator_and_device builds (fat arm64 and x86_64 archives)

All iOS builds currently require a custom vcpkg fork which contains
fixes for building the required 3rd party libraries.

qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2
have also been tested to build successfully.

simulator_and_device builds are also supported, but require an umerged
patch in upstream CMake as well as further patches to vcpkg.

Task-number: QTBUG-75576
Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-12-03 13:35:59 +00:00
Alexandru Croitor
2637a1aee2 pro2cmake: Format again
Change-Id: I3c82e6c13d01203bda8ab28dc5cb2f9fe6a0c4c2
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-26 10:59:06 +00:00
Leander Beernaert
1c655fb0fc Post merge fixes
Change-Id: I78d3c9687f99c0a32da04257e297e88ef0b02581
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-25 14:53:27 +00:00
Alexandru Croitor
8d35ad8726 Add FindWrapHarfbuzz
Apparently we didn't have a wrap find module for it before. Add one,
and add special support to handle a Gentoo broken Config file which is
exported by an autotools build of harbuzz.

Change-Id: I83cbeb817caf2610104c16713d4eac6ab6f8c63b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-25 11:58:02 +00:00
Leander Beernaert
96d6e2276d Add support for DYNAMIC_QMLDIR to pro2cmake
Change-Id: I95575dc352343ec86a6f7cacd7b49521262a9a7a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-25 09:35:17 +00:00
Leander Beernaert
2dcab2b9e0 Fix formatting in helper.py
Change-Id: I8ee2abd27064bfc5bf3f291c2743570d11227fcf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-25 08:39:28 +00:00
Simon Hausmann
4ff9d6d523 Fix pro2cmake formatting
... by running make format.

Change-Id: I523a48abd2c483107f5c16c24daa695fcc0a55e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-23 07:07:45 +00:00
Mårten Nordheim
a640db0180 Add parts needed for QtQuick3D
There is a patch in progress to add mappings for Qt3D, so reuse the old
broken Qt3D mappings, delete the duplicates.

QtOpenGLExtensions is needed, so this patch includes it.

Change-Id: I27896ee88b9e6873c8cd52d86afc330e309e1e14
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-22 18:03:20 +00:00
Leander Beernaert
7a6c6da2eb Add more special condition conversions
Handle conversions for QT_NO_CURSOR, QT_NO_TRANSLATION and
qtConfig(opengles.).

Change-Id: Idd930f77e78f235b7997a5083ac7faf630ed9801
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-14 10:36:37 +00:00
Alexandru Croitor
ad98624f74 pro2cmake: Adjust script to generate new CMake API calls
The script can now generate both old style CMake API calls
(add_qt_module), as well as new style (qt_add_module).

The first case is considered api version 1, and the second case
is version 2.

You can force which api version to use for generation using
the --api-version command line argument.

This is useful when you want to regenerate an old project
(one that hasn't switched to new style), to keep the diffs
easier to read.

When no parameter is specified, the script will auto-detect
which api version is used in the existing CMakeLists.txt file
(if it exists), and keep using that, until someone force regenerates
the project with a new api version.

Change-Id: I41e4e6ed5db94ef7220c09b46fc5f12e6613e5d2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-14 10:22:01 +00:00
Alexandru Croitor
0956e2d990 pro2cmake: Allow limiting the number of projects to convert
Change-Id: I7c06d530cb98cc07e4a618427a7cf7b5c70aa171
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-14 09:04:41 +00:00
Alexandru Croitor
ab3bbc9d74 pro2cmake: Fix generic_version_handler not to be greedy
Otherwise in a condition with multiple comparisons, the regexp would
match too many characters, and not extract the correct variable
name. And to be extra safe, match until a comma is encountered.

Change-Id: I29d8344287efca5c5b232006f6bbdf39e6e4ee67
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-13 14:22:09 +00:00
Alexandru Croitor
3919ed58ab Allow passing args from run_pro2cmake to pro2cmake
Change-Id: Ic874d4cd3488903ffec438f5c127b589e6371f7a
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-13 13:35:50 +00:00
Alexandru Croitor
c219aaf4d1 pro2cmake: Reformat code with black
Change-Id: I699031d4a05dad84a0807039dcdba17fd5acf2e3
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-13 13:35:40 +00:00
Alexandru Croitor
2679ae3719 pro2cmake: If CONFIG-=app_bundle consider this a non gui app
Change-Id: I45804af3c43cf1af8b00ac3542e045fe697bf1b6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-13 12:34:28 +00:00
Alexandru Croitor
800cd1d8b9 pro2cmake: Fix broken is_manual_test usage
Amends 681e8b4ead

Change-Id: I5ac8761de10d945b6ac78ba95a179209c80cb893
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-13 10:00:45 +00:00
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
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
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
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
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
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