summaryrefslogtreecommitdiffstats
path: root/cmake/QtPriHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* qdevice.pri: Use cmake separators for the pathMårten Nordheim2021-09-101-0/+2
| | | | | | | | | Because otherwise we may end up with trailing backslashes Pick-to: 6.2 6.2.0 6.1 Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use correct module include name across the projectAlexey Edelev2021-08-271-1/+2
| | | | | | | | | | | | | | | Module may have specific module include name that should be taken into account when specifying module include directories in different places. The INTERFACE_MODULE_INCLUDE_NAME module property name is aligned to the common naming rules and the property is used to preform include paths instead of the direct use of the module name. Add additional paths generated by qt_internal_module_info to keep them consistent across all cmake files. Pick-to: 6.2 Change-Id: I4c94017abc322c48616f47e65e371bd863bb087d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use _qt_module_has_headers instead of INTERFACE_MODULE_HAS_HEADERSAlexey Edelev2021-08-111-1/+1
| | | | | | | | | | | After introducing the _qt_module_has_headers target property, it's better to replace the INTERFACE_MODULE_HAS_HEADERS use by _qt_module_has_headers since properties duplicate each other. Pick-to: 6.2 Change-Id: I4d62ed71b8ed8263f51d8575628693122580b4a7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Make WrapVulkanHeaders target optional for QtGui consumersAlexandru Croitor2021-07-291-3/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If Vulkan headers are present on the system when qtbase is configured, QtGui and QtOpenGL should be compiled with Vulkan support. If a user project uses a Qt built with Vulkan support, but their system is missing Vulkan headers, the project configuration needs to succeed. The project will get compilation errors if it uses Vulkan headers, but that's intended. This use case was broken when fixing Vulkan to be found when building Qt for Android. Fix the regression with a combination of things 1) Mark the WrapVulkanHeaders package as optional (already the case) 2) Use the include directories directly when compiling Gui and OpenGL 3) Propagate WrapVulkanHeaders::WrapVulkanHeaders link requirement to consumers only if the target exists. It won't exist if Vulkan include dirs are not found This also requires some changes in pri and prl file generation. For prl file generation, we don't want to link to the WrapVulkanHeaders target, so we filter out all dependencies that use TARGET_NAME_IF_EXISTS for anything that calls __qt_internal_walk_libs which includes qt_collect_libs. For pri files, we make sure to generate a uses=vulkan/nolink clause by inspecting a new _qt_is_nolink_target property on the target. We also don't add include dirs to the pri file if the new _qt_skip_include_dir_for_pri property is set. This is intended for Vulkan, because there is separate qmake logic to try and find the include dirs when configuring a user project. As a drive-by, fix nolink handling for WrapOpenSSLHeaders. Amends bb25536a3db657b41ae31e1690d230ef8722b57d Amends 7b9904849fe1a43f0db8216076a9e974ebca5c78 Pick-to: 6.2 Fixes: QTBUG-95391 Change-Id: I21e2f4be5c386f9e40033e4691f4786a91ba0e2d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Keep public include header locations for internal module priJaeyoon Jung2021-07-261-1/+1
| | | | | | | | | Amends f254d62cb1807d5bd9ee2e23ef64d4ca2d1b6809. Task-number: QTBUG-95303 Pick-to: 6.1 6.2 Change-Id: Ica8d2850fe427b780d62cd9a9528f387a7ea1b79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix generated pri and prl filesLi Xinwei2021-07-171-2/+6
| | | | | | | | | | | | | | | Quote the paths after "-L". Get MSVC’s implicit link directories from $ENV{LIB}. Fix some issues cause by Inconsistent case. Amends 2c49f85380d7ad79d9473e0f42e7afaa36d31af9 Fixes: QTBUG-95198 Pick-to: 6.2 6.1 Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use target OUTPUT_NAME as a module identifier in .pri filesAlexey Edelev2021-06-181-3/+1
| | | | | | | | | | | | | | QtPriHelpers copies the logic related to the module OUTPUT_NAME to produce a module identifier. Since the module identifier should be equal to OUTPUT_NAME it makes sense to reuse the property and deduplicate logic. Amends 8aee7c6b29be5a0ee7d5e7cfcb5f2db762b2e28b Pick-to: 6.2 Fixes: QTBUG-94568 Change-Id: I8d9c04273e4cdb1a2e6a3b0db3ddf52e008c0cf7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix internal module naming in qmake .pri filesAlexey Edelev2021-06-171-1/+0
| | | | | | | | | | | | | Set the correct value to the _qt_config_module_name property at the internal module creating step instead of appending _private suffix when generating .pri files. Amends 425ff34aa10a02524f2d52f544dc00b539ef9a26 Pick-to: 6.2 Fixes: QTBUG-94568 Change-Id: I6fa8089358bc638668e313c98c3aee680bf7ec2a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make framework names consistent with the module namesAlexey Edelev2021-06-031-1/+1
| | | | | | | | | | | | | | | | | | For Apple's frameworks it's possible to include header files using the following assumption: If the framework name is "MyFramework" then '#include <MyFramework/frameworkheader.h>' will work without specifying the include path explicitly. This is broken for internal modules since they use the framework name with the 'Private' suffix. This uses the module name instead of the target name as a framework name. Amends edbe0eb335ca4c0fde23f57eae5acdf80937c9e3 Task-number: QTBUG-87775 Change-Id: I0592a28d0768724b6e10ca81aa7cefb0a3699a5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix generated prl and pri files for MSVCLi Xinwei2021-06-021-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MSVC static build, if we build Qt with 3rdparty library (e.g. zstd), cmake will add"zstd" (without "-l" prefix) to Qt6Core.prl. Then we use this Qt to build a qmake project, compilation will fail due to missing zstd.obj. Without "-l" prefix, qmake will treat "zstd" as an object file instead of a library. Library names in qt_module.pri and qt_lib_*_private.pri are also missing "-l" prefix. This is because on most compilers, CMAKE_LINK_LIBRARY_FLAG equals "-l". But on MSVC, it is an empty string. So we should pass "-DLINK_LIBRARY_FLAG=-l" for MSVC. Also add "-L/path/to/library" if the library path is not in default linker search directories. This will write un-relocatable paths to prl files only when using 3rdparty libraries to build Qt statically. Usually it's not a problem. In addition, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is also empty on MSVC. So The third argument of "$<FILTER>" is empty, it is an invalid generator expression. This means no include dir will be written to qt_module.pri and qt_lib_*_private.pri on MSVC. So only use "$<FILTER>" when CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not empty. Pick-to: 6.1 Change-Id: Ib66f95dc09cf920363a4b9338fb97747dd2f8ab7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move the framework related information to the common functionAlexey Edelev2021-05-311-4/+6
| | | | | | | | | | Since the information about framework is performed in multiple places it's quite hard to control its consistency. This moves the obtaining of framework related information to the common function and adjusts the use of the information across the repo. Change-Id: I1f488d41dcea75a1e8c361926792a6b7c45e5a3f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qmake: Pick default architecture on macOS based on unameTor Arne Vestbø2021-05-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | When dealing with a universal build of Qt, we would end up using the QT_ARCH as the architecture for user projects, but this architecture is always the primary one that Qt was configured with. Instead of relying on QT_ARCH, we start writing QT_ARCHS (plural) to qconfig.pri, based on CMAKE_OSX_ARCHITECTURES, and then use that to initialize QMAKE_APPLE_DEVICE_ARCHS. We then resolve the active arch using uname -m, matching what CMake does. We still feed all the available architectures to the Makefile or Xcode project, so that the user can build for any of the available architectures without needing a reconfigure. Fixes: QTBUG-93760 Change-Id: I0d338241ba4d944ca36d85371e9c4df7dbc4f269 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix auto-importing of plugins in static Qt qmake projectsAlexandru Croitor2021-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the plugin .pri files that CMake generated for qmake consumption contained an '-' to exclude the plugin from auto-importing only if the plugin type was generic or a platform plugin. Now that plugin projects that should be excluded have a proper DEFAULT_IF FALSE clause, we can simply query for the defaultness of the plugin to know whether to exclude it in the generated .pri file. This fixes an issue with Qt static builds and qtvirtualkeyboard. The vkb plugin was not excluded and thus any simple QtGui app linked to the vkb plugin in a static qmake project. This led to linker issues because the vkb plugin also depends on a vkb quick plugin which is not listed as a dependency. Augments 76230d98795a2e7a365328eb693ff57f6ddd7f1d Amends c975c35eaebcca3bd33931fecc3beb513e332292 Pick-to: 6.1 6.1.0 Fixes: QTBUG-92529 Task-number: QTBUG-87861 Change-Id: I9671f6504374cf0799289bbe19110e01c129402e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: add cmake build supportLorn Potter2021-04-011-1/+4
| | | | | | | | | | | | | | | | A few configure defines get changed: QMAKE_WASM_PTHREAD_POOL_SIZE is now QT_WASM_PTHREAD_POOL_SIZE QMAKE_WASM_TOTAL_MEMORY is now QT_WASM_INITIAL_MEMORY QMAKE_WASM_SOURCE_MAP_BASE is now QT_WASM_SOURCE_MAP_BASE device-option EMSCRIPTEN_ASYNCIFY=1 is QT_EMSCRIPTEN_ASYNCIFY=1 To create source maps for debugging. use device-option QT_WASM_SOURCE_MAP=1 Task-number: QTBUG-78647 Change-Id: If9f30cd7fb408c386d6d69b5f7b1beecf1ab44b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Use private headers for internal module priJaeyoon Jung2021-01-201-0/+2
| | | | | | | | | | | | Just like config_module_name is appended by "_private" in the case of internal module pri, replace module_includes with the private one. It fixes the issue where a pro file that uses an internal module pri does not build due to missing paths to private headers. Fixes: QTBUG-89961 Change-Id: Ice16a1e9f709d29454f1ddf5b954673cc06a88bb Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
* CMake: Fix QMAKE_LIB_<NAME> variable names in module .pri filesJoerg Bornemann2020-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | 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>
* CMake: Fill QT.<module-name>.uses entries in module .pri filesJoerg Bornemann2020-11-301-5/+30
| | | | | | | | | | | | | | | | 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>
* CMake: Rename internal variableJoerg Bornemann2020-11-301-1/+1
| | | | | | | | | | | 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>
* CMake: Name QT_NO_MAKE_*/BUILD_* variables consistentlyJoerg Bornemann2020-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Generate less pri files and mark header modules as no_linkCristian Adam2020-11-201-0/+3
| | | | | | | | | | | 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>
* Don't add module pri library entry for header modulesTor Arne Vestbø2020-11-091-1/+7
| | | | | | | | 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>
* cmake: Allow module to specify initial dependsTor Arne Vestbø2020-11-091-1/+4
| | | | | Change-Id: I85f39f16f2103dcb42ff467bbc79a0baf6c020e1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Private module pri files should have internal_moduleAlexandru Croitor2020-11-071-0/+4
| | | | | | Change-Id: I35b4111e4044ae6283eb8175173453db9001c71b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Allow adding linker flags to qmake module prisTor Arne Vestbø2020-11-031-1/+4
| | | | | | | | | | | | | 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>
* Allow adding extra content to module priTor Arne Vestbø2020-11-021-1/+4
| | | | | | | On the qmake-side we had exports, but they were quoted. Change-Id: I95af4b927079691cab6403fec850f345ba181a00 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up order of assignments in generated module pri filesAlexandru Croitor2020-10-301-6/+11
| | | | | | | | 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>
* cmake: Allow specifying module 'uses' entriesTor Arne Vestbø2020-10-281-2/+5
| | | | | Change-Id: Iee02654e0f52e36e026b8074e0eacb0ea1804685 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Avoid -NOTFOUND suffix in module pri configTor Arne Vestbø2020-10-281-2/+4
| | | | | Change-Id: I1407a661c482d918dd143f291ee648bc7b18feef Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Export QT_QPA_DEFAULT_PLATFORM in QtBuildInternalsExtraAlexandru Croitor2020-10-271-0/+5
| | | | | | | | | | | | 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>
* cmake: Allow target to specify initial module internal configTor Arne Vestbø2020-10-261-1/+3
| | | | | Change-Id: I7312fa19aad84b020015b304b1cd2cd5acc83b81 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Produce internal module pris like qmake doesTor Arne Vestbø2020-10-231-33/+37
| | | | | | | | | | 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>
* cmake: Respect NO_PRIVATE_MODULE when generating module pri filesTor Arne Vestbø2020-10-231-49/+52
| | | | | Change-Id: Id5816d6598a0a484c20674f34f6f809e68671e6b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Don't add include paths to module pri if there are no headersTor Arne Vestbø2020-10-231-0/+6
| | | | | Change-Id: I8fa01f45410805399a511a87c6f04192ce42d374 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix logic for adding staticlib to module priTor Arne Vestbø2020-10-161-4/+3
| | | | | Change-Id: I2426e78bb509a37e7e3924506903cd84732f88d8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing Android values in qdevice.priAlexandru Croitor2020-10-071-0/+7
| | | | | | | | | | | These were introduced in 675805e9eb0dc68a6e96622353073fd54161bdaf and b9c85d6b0e274bf0a6287cd56d9e3d7376b0d004 They should be exported if they were set. Change-Id: Ieec565980ba148f675f84dcdd7c19894e349085f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Export the chosen iOS SDK used when configuring QtAlexandru Croitor2020-10-071-0/+4
| | | | | | | | | | | | | 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>
* CMake Build: Add support for -qtlibinfix configure parameterCristian Adam2020-09-231-2/+5
| | | | | | | | | 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>
* CMake: Implement configure -qreal <type>Joerg Bornemann2020-08-191-1/+1
| | | | | | | | | 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>
* CMake: Handle -D, -I, -F and -L configure argumentsJoerg Bornemann2020-08-171-0/+17
| | | | | | | | | | | | | | 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>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-0/+728
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>