Commit Graph

25 Commits

Author SHA1 Message Date
Joerg Bornemann
e32e4898dd CMake: Fix QMAKE_LIB_<NAME> variable names in module .pri files
QMake libraries that contain dashes are referenced by QMAKE_USE as is,
but the corresponding QMAKE_LIB_<NAME> variable must be normalized to
contain underscores.

Example from the qmake build:

./mkspecs/modules/qt_lib_waylandclient.pri
11:QT.waylandclient.uses = wayland-client xkbcommon wayland-cursor

./mkspecs/modules/qt_lib_waylandclient_private.pri
12:QMAKE_DEPENDS_WAYLAND_CURSOR_CC = WAYLAND_CLIENT
13:QMAKE_DEPENDS_WAYLAND_CURSOR_LD = WAYLAND_CLIENT
15:QMAKE_LIBS_WAYLAND_CURSOR = -lwayland-cursor

Pick-to: 6.0
Change-Id: If31bd45764d52f97d80d6388503008dc1ffb16ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-03 17:18:23 +01:00
Joerg Bornemann
92d60ae589 CMake: Fill QT.<module-name>.uses entries in module .pri files
Those entries were always empty. The INTERFACE_QT_MODULE_USES property
was never set.

Map each public dependency to its qmake lib name and place this value
into the module's QT.<module-name>.uses variable.

Take into account the "_nolink" target modifier and translate it to
qmake's "/nolink".

Pick-to: 6.0
Fixes: QTBUG-88951
Change-Id: Ib6ef65b842a1fe1da3ade55867583343b4ee76ee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-30 23:17:55 +01:00
Joerg Bornemann
bf483ca979 CMake: Rename internal variable
Rename QT_QMAKE_LIB_TARGETS_foo to QT_TARGETS_OF_QMAKE_LIB_foo, because
we want to introduce the counterpart QT_QMAKE_LIB_OF_TARGET_bar in a
subsequent commit.

Pick-to: 6.0
Task-number: QTBUG-88951
Change-Id: I33f00f4fe65c5977da6e74c632ebeab3b891c89a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-30 23:17:53 +01:00
Joerg Bornemann
fb21a5ce1a CMake: Name QT_NO_MAKE_*/BUILD_* variables consistently
For consistency, apply the following renamings:
QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT
QT_NO_MAKE_TESTS    -> QT_BUILD_TESTS_BY_DEFAULT
QT_NO_MAKE_TOOLS    -> QT_BUILD_TOOLS_BY_DEFAULT
BUILD_EXAMPLES      -> QT_BUILD_EXAMPLES
BUILD_TESTING       -> QT_BUILD_TESTS

This should help to better convey the difference between "BUILD" and
"NO_MAKE".

To configure tests, but not to build them by default, pass the
following to CMake:
-DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF

Analoguous for examples:
-DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF

Tools can be excluded from the default build with:
-DBUILD_TOOLS_BY_DEFAULT=OFF

The variable BUILD_TESTING is still available and initialized with the
value of QT_BUILD_TESTS.

Pick-to: 6.0 6.0.0
Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 20:38:03 +01:00
Cristian Adam
98e6234bd4 CMake: Generate less pri files and mark header modules as no_link
Plugins will no longer get .pri files generated in non-static builds.

Header modules are now marked in the .pri files as CONFIG += no_link.

Pick-to: 6.0 6.0.0
Fixes: QTBUG-88221
Change-Id: I06e31fa970ad021261c43ca3acd88055cc4c9555
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 16:06:17 +00:00
Tor Arne Vestbø
c2e1a773e0 Don't add module pri library entry for header modules
The QT.foo.module entry is used for linkage, so we shouldn't
add it for header only modules.

Change-Id: Ibb6e7ab08083ccab11d7e060f35c54153e3751c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-09 18:08:02 +01:00
Tor Arne Vestbø
8186f18c4a cmake: Allow module to specify initial depends
Change-Id: I85f39f16f2103dcb42ff467bbc79a0baf6c020e1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-09 16:01:51 +01:00
Alexandru Croitor
d38b29bfa6 CMake: Private module pri files should have internal_module
Change-Id: I35b4111e4044ae6283eb8175173453db9001c71b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-07 19:33:37 +01:00
Tor Arne Vestbø
6032a9ca1a Allow adding linker flags to qmake module pris
The flags go before the library in the final linker line, as opposed
to the dependencies declared in LIBS.

This allows us to declare the flags for the entrypoint
in the project file of the entrypoint, instead of in
a standalone prf.

Change-Id: I35c054fe9fdaa6add7cd0e8ba3f7304f975ff80f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-03 00:14:04 +01:00
Tor Arne Vestbø
517c885239 Allow adding extra content to module pri
On the qmake-side we had exports, but they were quoted.

Change-Id: I95af4b927079691cab6403fec850f345ba181a00
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-02 16:44:10 +01:00
Alexandru Croitor
02f429f06c CMake: Clean up order of assignments in generated module pri files
Makes the diff between Qt 5.15 and 6.0 easier to read, to see what's
missing.

Change-Id: Idf8aa17b3ab8494f6855c172665423a53ca8a024
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-30 17:49:08 +01:00
Tor Arne Vestbø
5c2656cfb6 cmake: Allow specifying module 'uses' entries
Change-Id: Iee02654e0f52e36e026b8074e0eacb0ea1804685
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-28 16:52:32 +01:00
Tor Arne Vestbø
e24be7b6c3 cmake: Avoid -NOTFOUND suffix in module pri config
Change-Id: I1407a661c482d918dd143f291ee648bc7b18feef
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-28 00:22:30 +01:00
Alexandru Croitor
f65abc6344 CMake: Export QT_QPA_DEFAULT_PLATFORM in QtBuildInternalsExtra
The value is useful for QPA plugins built in repos other than qtbase,
to decide if it should be a default plugin or not.
Currently useful for qtwayland.

Also export a qmake value assignment when doing static builds, just
like src/gui/configure.pri does.

Change-Id: I1253f1a7e178b24b16e2615ba20d1e92b0b87b1a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-27 19:26:35 +01:00
Tor Arne Vestbø
851e1cb4c4 cmake: Allow target to specify initial module internal config
Change-Id: I7312fa19aad84b020015b304b1cd2cd5acc83b81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-26 20:10:48 +01:00
Tor Arne Vestbø
83ad237771 cmake: Produce internal module pris like qmake does
qmake treats internal modules as just the regular module file,
but with a _private suffix, as opposed to the current cmake
logic, that treats it as the private module file, resulting
in missing e.g. the Qt.foo.module entry.

Change-Id: Id55ca4c23921656d5abfd1d0fdf6430d4fe120bf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-23 16:37:14 +02:00
Tor Arne Vestbø
1f53a91ed3 cmake: Respect NO_PRIVATE_MODULE when generating module pri files
Change-Id: Id5816d6598a0a484c20674f34f6f809e68671e6b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-23 11:36:48 +02:00
Tor Arne Vestbø
6baa0f4ccc cmake: Don't add include paths to module pri if there are no headers
Change-Id: I8fa01f45410805399a511a87c6f04192ce42d374
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-23 11:36:48 +02:00
Tor Arne Vestbø
f6012c4a56 cmake: Fix logic for adding staticlib to module pri
Change-Id: I2426e78bb509a37e7e3924506903cd84732f88d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-16 23:59:28 +02:00
Alexandru Croitor
af9197ff91 CMake: Add missing Android values in qdevice.pri
These were introduced in
675805e9eb and
b9c85d6b0e

They should be exported if they were set.

Change-Id: Ieec565980ba148f675f84dcdd7c19894e349085f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-07 10:08:37 +02:00
Alexandru Croitor
4270522916 CMake: Export the chosen iOS SDK used when configuring Qt
The value is used by mkspecs/features/mac/default_post.prf and
ultimately by xcodebuild to decide which arch and SDK to build
against.

For a simulator_and_device build, no value needs to be set as far as
I can see.

Task-number: QTBUG-87218
Change-Id: I41992bec6b16aadfd87c3f7c10653a6094e76d3e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-07 10:08:31 +02:00
Cristian Adam
079cf55111 CMake Build: Add support for -qtlibinfix configure parameter
Rename all libQt6*.so to libQt6*<infix>.so

Task-number: QTBUG-85438
Change-Id: I4b91ffaaec7bea61454b0d3c794c77f2d0868d54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-23 17:31:13 +02:00
Joerg Bornemann
5f729da74a CMake: Implement configure -qreal <type>
The configure argument -qreal <type> maps to the CMake argument
-DQT_COORD_TYPE=<type>.

Fixes: QTBUG-83325
Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-19 08:28:50 +02:00
Joerg Bornemann
d6e41abd62 CMake: Handle -D, -I, -F and -L configure arguments
Introduce new CMake variables and map
-D to QT_EXTRA_DEFINES,
-I to QT_EXTRA_INCLUDEPATHS,
-L to QT_EXTRA_LIBDIRS,
and -F to QT_EXTRA_FRAMEWORKPATHS.

Those variables only affect the Qt build, not user projects.

Fixes: QTBUG-85878
Change-Id: I229df2eed1505a2619068d0d32975962b052569a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-17 18:19:24 +02:00
Alexandru Croitor
44cce1a2ea CMake: Split QtBuild.cmake into smaller files
QtBuild.cmake is huge. Split it.

Move module, plugin, tools, executables and test related functions out
of QtBuild.cmake into separate files.
Do the same for many other things too.

An additional requirement is that all the new Helpers files only
define functions and macros.
No global variable definitions are allowed, nor execution of commands
with side effects.

Some notes:
qt_install_qml_files is removed because it's dead code.

Some functions still need to be figured out, because they are
interspersed and depend on various global state assignments.

Task-number: QTBUG-86035
Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-14 13:17:11 +02:00