summaryrefslogtreecommitdiffstats
path: root/cmake/QtFrameworkHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Fix framework headers not being copied after rm-ing build dirAlexandru Croitor4 days1-2/+15
| | | | | | | | | | | | | | | | | | | | | | If a build dir is removed using rm -r *, this still leaves dot files around, specifically the .ninja_log file. Because of a possibly unspecified behavior of listing directories as OUTPUTs in a add_custom_command call for the ${target}_copy_fw_sync_headers custom target, we end up with a situation where the custom command is not rerun by ninja because the directory OUTPUT was encountered in the .ninja_log file. Make sure to specify an additional file as an OUTPUT, to ensure the command does rerun, and thus copies all headers from the syncqt staging directory. Amends 103eca1070a75bfa97d0b72b94e0c759ef0bcd1c Pick-to: 6.5 6.7 6.8 Fixes: QTBUG-126056 Change-Id: I5664cf074158199e0c7fd5e312ecf739133d7f2e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Fix calling some functions in CMake 3.16Alexandru Croitor11 days1-0/+6
| | | | | | | | | | | | Calling qt_internal_get_framework_info failed when the target was an INTERFACE_LIBRARY, because it tried to access properties that aren't allowed on such a target. Interface libraries can't be frameworks, so just add an early return guard. Do the same for qt_internal_apply_apple_privacy_manifest. Change-Id: I85b73449a0d56b92cd01b032d4ce5db905643c9f Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix incorrect framework versioned_binary_dir output for iOSAlexandru Croitor2024-05-241-1/+1
| | | | | | | | | There was a stray '}' character in the value. Amends 8f03bb6bd8ad2d59e0043d26a0470faf42e98093 Change-Id: I06f9200b1449bc54ec07ace1336bb97a8f132158 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Set fw_versioned_binary_dir in the framework info functionAlexandru Croitor2024-05-221-2/+8
| | | | | | | | This will be used by the SBOM generation code to retrieve the directory where the framework file is installed. Change-Id: I882344f1fa3c5a77e3cce85d2044aa0e682bed40 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix framework headers copying when module don't have header filesAlexey Edelev2024-02-151-11/+13
| | | | | | | Amends 103eca1070a75bfa97d0b72b94e0c759ef0bcd1c Change-Id: I3caae60c022cd46a6d33691760b619920d6e778e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the mechanism that copies framework header filesAlexey Edelev2024-02-141-5/+26
| | | | | | | | | | | | | | | | | | Split the header copy custom commands into two blocks and add <module>_sync_headers_fw_copy target that is responsible for the copy of CaMeL-case header aliases. For the Ninja generator we leave the file-level dependencies between the <module>_sync_headers_fw_copy target and header copy commands. For the Unix Makefiles generator we put the command directly to the target to make sure it's executed by make. Also add the explicit commands for creating the output header directories. Fixes: QTBUG-122200 Pick-to: 6.5 6.6 6.7 Change-Id: I71ba716d17a879f20ae0869cf2257d246ac17eff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Reset save dialog extension when resetting file name filterTor Arne Vestbø2024-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We map QFileDialog name filters to NSSavePanel.allowedFileTypes, for example turning "Text Files (*.txt)" into allowedFileTypes = @[@"txt"]. In this case, the NSSavePanel will automatically add the extension to the user's file name, if they just type "foo". When a filter allows all files, we reset the allowedFileTypes to nil, but this does not reset the automatically added extension, so if the user switches from one filter (*.txt) to another (*.*), the file name will still have a .txt extension. This is problematic when the save panel's file name field does not show the extension to the user, which can happen automatically if the user types an initial file name without an extension, overriding what we've asked by setting extensionHidden=NO. When that happens, the user is shown "foo", but the actual file name is "foo.txt". To mitigate this confusing situation we do a round-trip via the UTTypeDirectory content type, which is a valid type without any extension. This forces the save panel to remove any extensions added automatically by previous filters. Pick-to: 6.7 Change-Id: Ia17a8c2734eff656116ef77a9813113a5076e9cc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove framework-related functionality from syncqtAlexey Edelev2023-09-221-7/+24
| | | | | | | | | | | | | | | | | | The files generated by syncqt should land not only in module include directory, but also in framework directory. Before syncqt made two copies of the generated files one in staging directory and the second one in module framework directory. This commit moves all logic related to framework header files to cmake scripts. This is done for both consistency and simlifying the logic. The whole module .syncqt_staging directory is copying to the framework library in cmake. [ChangeLog][Tools][syncqt] '-framework' and '-frameworkIncludeDir' arguments were removed. The related logic is moved to cmake scripts. Task-number: QTBUG-116483 Pick-to: 6.6 6.5 Change-Id: If79c5470d2ab51eb7fc083bce6fb01858bed76ba Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add enablers to expose semi-public APIs for QtQuick3DChristian Strømme2023-09-051-2/+3
| | | | | | | | | Follow the same patterns as for qpa and rhi. Semi-public APIs will be put under the "namespace" ssg which is short for Spatial Scene Graph. Taks-number: QTBUG-116570 Change-Id: I38887f129ec90e67f6a929a0d8ea5ea8b8c49ee8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* rhi: Make it a QPA-style private but semi-public APILaszlo Agocs2023-05-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* iOS: request authorization before presenting image-pickerTimur Pocheptsov2023-03-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Right now, image picker view is shown first (it does not require access to photos, since it's essentially Photos app getting access to photos ...). Then, we use AssetsLibrary to get asset for an url (using ALAssetsLibrarie's -assetForURL method). This may trigger a permission-related alert, asking to: a. Select more photos or ... b. Allow access to all photos or ... c. Deny access. Showing this alert _after_ picker has selected an image makes little sense (and probably was never intended this way anyway). Instead, we now use Photos.framework to check the authorization and, if needed, we request an authorization (when the current status is 'Nondetermined'). If authorization is 'Granted' as a result, we show picker view and proceed as normal/before. Pick-to: 6.5 Task-number: QTBUG-109120 Change-Id: I0acfd7b0476346360d75a5e37f5845aaf2d6e3e0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qnetworkproxy_mac: use API available both on iOS and macOSTimur Pocheptsov2023-01-301-0/+1
| | | | | | | | | | | | | | | To extract system proxies, the one we used previously, was not available on iOS and thus we could not obtain system proxies there. Support is limited - no such things, as SOCKS/FTP/etc. proxies, only PAC (auto configuration), and HTTP/HTTPS. There are no keys to extract info about HTTPS, so instead we'll use CFNetworkCopyProxiesForURL ( looks like this enables exclusion lists (which are hidden) functionality and apparently from the system point of view HTTP/HTTPS are the same. Fixes: QTBUG-39869 Change-Id: I73af719a2e2b5cded706e6b3faa4b8eaa879352b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Tweak qt_internal_get_framework_info to match documentationTor Arne Vestbø2023-01-171-1/+1
| | | | | | | | | | <out_var>_private_header_dir and <out_var>_private_module_header_dir are documented to point to "the specific framework version and framework bundle version". Pick-to: 6.5 Change-Id: I00053f106ec9be88f7892c842ca75549cfc54124 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Enable shared library build of Qt for iOSTor Arne Vestbø2023-01-101-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | As of f68e2c92cc0ed2c1929140402c061359bc2363a5, and its follow up changes, we can now link individual plugins statically, even if the Qt build is generally a shared build. This allows us to build Qt for iOS as shared libraries, while still keeping the platform plugin as a static library, since this is harder to port over to a shared library. This gives the benefit of faster turnaround during development, as well as binary compatibility promises for the main Qt libraries, without having to go fully shared for all of Qt. Static builds are still the default, due to the downsides of larger application bundles and slower load times for shared builds. For now the user has to manually tick the "Embed & Sign" check box in Xcode for each Qt library, which is only available with Xcode projects generated by the qmake Xcode generator. Task-number: QTBUG-85974 Change-Id: Id2b7bd2823c8e7c79068dda95295b574ada8d7f2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add permission API backend for macOS and iOSTimur Pocheptsov2022-11-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When submitting applications to the iOS and macOS AppStore the application goes through static analysis, which will trigger on uses of various privacy protected APIs, unless the application has a corresponding usage description for the permission in the Info.plist file. This applies even if the application never requests the given permission, but just links to a Qt library that has the offending symbols or library dependencies. To ensure that the application does not have to add usage descriptions to their Info.plist for permissions they never plan to use we split up the various permission implementations into small static libraries that register with the Qt plugin mechanism as permission backends. We can then inspect the application's Info.plist at configure time and only add the relevant static permission libraries. Furthermore, since some permissions can be checked without any usage description, we allow the implementation to be split up into two separate translation units. By putting the request in its own translation unit we can selectively include it during linking by telling the linker to look for a special symbol. This is useful for libraries such as Qt Multimedia who would like to check the current permission status, but without needing to request any permission of its own. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Change-Id: Ic2a43e1a0c45a91df6101020639f473ffd9454cc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace the syncqt.pl script with syncqt toolAlexey Edelev2022-09-271-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syncqt.pl adds an extra dependency on perl when building Qt. Modern C++ provides the convenient cross-platform way to access a filesystem and to use regular expressions, so we may replace the perl script with C++ application. The syncqt executable is built at configure time and installed as QtCore tool. It's running at configure time to deliver the required header files for IDE to build a consistent code model and at the build time to keep tracking changes in header files and generate the missing aliases without reconfiguring. 'syncqt' only parses header files from a CMake build tree, so the resulting Qt installation only contains interfacing headers that belong to the platform that Qt is built for. 'sync.profile' files are not used as the 'source of truth' for sync qt procedure anymore, all the necessary information is taken from either CMake files at configure time or from the module header files while parsing them. syncqt.pl is still in place since it's required as fallback solution for a smooth transition to the new syncqt implementation for all qt repositories. This patchset only enables the C++ based syncqt for 'qtbase' repository. From the performance perspective C++ version works faster then perl script, also the configure time is reduced significally on subsequent reconfigurations - up x2 times faster when re-configuring repository, but it also takes time to compile the tool itself the first time. Numbers for qtbase: syncqt.pl syncqt.cpp initial: 0m16,035s 0m20,413s reconfig: 0m6,819s 0m3,725s The syncing procedure can be run separately for each module using <ModuleName>_sync_headers targets. The 'sync_headers' target can be used to sync all the modules at once. Task-number: QTBUG-87480 Task-number: QTBUG-103196 Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Allow specifying multiple header types in qt_copy_framework_headersAlexey Edelev2022-08-051-28/+23
| | | | | | | | | qt_copy_framework_headers now can accept all the headers in one call. This is useful for upcoming changes when it will accept generator expressions as the input instead of actual files. Change-Id: I110b6d9e6de976b2a7581902e051e38571716c5f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add VERBATIM option to add_custom_command callsAlexey Edelev2022-03-171-1/+2
| | | | | | | | | | | Use VERBATIM option to prepare the correct command line for the add_custom_command. This especially sensitive when using build directories with names containing special symbols, that cannot be handled by shell correctly. Change-Id: I51d7041cb806411135fd59bf6273c04a3c695443 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add CryptoTokenKit framework for macOSIevgenii Meshcheriakov2021-12-231-0/+1
| | | | | | | | | Set ${FWCryptoTokenKit} when the framework has been found. This is useful for WIP card reader support in QtConnectivity. Task-number: QTBUG-97946 Change-Id: I0e85e0fd2e0fc45fb3069bbdaa2d8b2c927a6c2d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Add CoreBluetooth framework for macOSJuha Vuolle2021-11-101-0/+1
| | | | | | | | | | The Qt bluetooth module uses ${FWCoreBluetooth} when building for iOS, but that evaluated to empty. Pick-to: 6.2 Change-Id: I93ff2c30697a912bed454087ae260fae9cc41b0f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Place internal apps in the correct output directoryAlexandru Croitor2021-07-091-1/+1
| | | | | | | | | | | | | | In a -debug-and-release build, apps were placed under bin/Release rather than just bin. Apply the logic we use for tools for apps as well. Rename and move the common functions into QtTargetHelpers.cmake. Pick-to: 6.2 Fixes: QTBUG-95028 Change-Id: I5a9082ea50c9238c8fcf0c6dd099708fbc571bf8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make framework names consistent with the module namesAlexey Edelev2021-06-031-11/+17
| | | | | | | | | | | | | | | | | | 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>
* Move the framework related information to the common functionAlexey Edelev2021-05-311-11/+41
| | | | | | | | | | 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>
* Merge main and private targets of the internal modulesAlexey Edelev2021-05-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In cmake, targets are used as an entity for modules. This causes a number of problems when we want to manipulate a module as a separate entity with properties associated with it. The _qt_internal_module_interface_name target property is introduced to represent the module entity. All modules write a name to this property, which will subsequently expand into the module name matched with the module name in qmake. The 'qt_internal_module_info' function is responsible for providing the correct values ​​for the module properties used when working with a module target. Unlike qmake, for internal modules in cmake it is expected that the Private suffix will be specified explicitly. In case the user wants to have a different module name, an additional argument MODULE_INTERFACE_NAME of the qt_internal_add_module function is introduced. This also changes the way how target dependencies are collected and resolved. Since the 'Private' suffix no longer means an unique identifier of the module 'Private' part, we look for the both Private and non-Private package names when resolving dependencies. TODO: This change doesn't affect the existing internal modules, so to keep compatibility with the existing code the existing internal modules create 'Private' aliases. The code that provides backward compatibility must be removed once all internal modules will get the proper names. Taks-number: QTBUG-87775 Change-Id: Ib4f28341506fb2e73eee960a709e24c42bbcd5ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add CoreMotion to the list of looked-up frameworks (Mac/iOS)Juha Vuolle2021-04-141-1/+1
| | | | | | | | The CoreMotion is required by the QtSensor module. Task-number: QTBUG-92502 Change-Id: I7f1853131aa96b2cb052862d5bf492df5ec18150 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: add CoreLocation framework for macOSIvan Solovev2021-01-151-0/+1
| | | | | | Task-number: QTBUG-89854 Change-Id: Icd52a6dd0ae36ae91599ab9a583e6920f2d2ba4c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use 'A' for Apple framework version instead of Qt major versionTor Arne Vestbø2020-09-231-1/+1
| | | | | | | | | | All system frameworks use 'A' instead of the major version of the framework, and Xcode's code signing assumes that the framework version is 'A' when signing embedded frameworks (FB7323980), so leave the version 'A'. This is also what Apple recommends. Change-Id: Idbf2e30e156c3e869da8f75731e568524d9407e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't hardcode Xcode SDK frameworks into public dependenciesAlexandru Croitor2020-09-091-25/+44
| | | | | | | | | | | | | | | | | | | | | Using find_library() to find an Xcode framework will end up embedding the absolute path of the framework into INTERFACE_LINK_LIBRARIES. A different machine might not have the SDK installed in the same location, which will cause build failures. This happens in our CI because Xcode is installed to /Applications/Xcode11.app. To fix this, replace all system framework paths with '-framework Foo' flags instead. We already do this for OpenGL and OpenGL ES. In the future we might want to convert these into full standalone FindFoo scripts that expose proper targets. Fixes: QTBUG-86299 Task-number: QTBUG-86422 Task-number: QTBUG-85240 Change-Id: I22b2b2d1d9e92108098d3974105e3758978cd8e2 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-0/+106
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>