summaryrefslogtreecommitdiffstats
path: root/cmake/QtResource.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Move Resources API into Qt6CoreMacrosLeander Beernaert2020-04-201-187/+0
| | | | | | | | Move QT6_ADD_RESOURCE to Qt6CoreMacros in order to avoid the extra config file step. Change-Id: Ib445ca35c648cf344ee8795de8bdddc0f0758972 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Relocate quick compiler resource pass to QtDeclarativeLeander Beernaert2020-04-201-136/+14
| | | | | | | | | | | | Since there's no way to register callbacks or to store functions to be called later in CMake, the only way to isolate the quick compiler behavior for qt_add_resources() is to wrap it in a conditional check. As soon as someone loads Qt6QmlMacros, the variable will set and the functionality will be available. Change-Id: I5fbdf2966e7dfdc734512a5b2b973e0ace9da5df Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rcc: Teach rcc the --no-zstd optionAlexandru Croitor2020-03-121-0/+10
| | | | | | | | | | | | It is needed when cross-building Qt using CMake, where the zstd feature might have different values between the host and target, in which case the build system tells rcc not to use zstd when the feature is disabled. Amends d20c9805763ab3dc504ebf2cefd33499d89ef22c Change-Id: I9dc55b59b1be5272b79aa5f1e2daf2b516a157d6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove retained quick compiler resource filesLeander Beernaert2020-02-051-22/+1
| | | | | | | | | Remove retained file feature as the expected behavior now is for the compiled file to be retained by default. Change-Id: I5a791a182825b223eb4497970fbb1c47c70135cc Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update add_custom_command and add_custom_target dependenciesLeander Beernaert2020-02-031-7/+14
| | | | | | | | | | | If we don't add the executable used by the custom_target and/or custom_command to list of the command's/target's dependencies (DEPENDS) the generated file will not update should the executable change. Change-Id: Idce30f3dd4f756d9e8f6848c5e16f5dd6c7c8f0a Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Rename / prefix all our private API functions with qt_Alexandru Croitor2019-11-141-1/+1
| | | | | | | | | | | Rename internal APIs like extend_target to qt_extend_target. Prefix apis with qt_ where required. Keep old names for compatibility until all their usages are removed. Change-Id: I9a13515a01857257a4c5be3a89253749d46a4f41 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add QT_RESOURCE_TARGET_DEPENDENCY source file propertyLeander Beernaert2019-10-151-1/+12
| | | | | | | | | | | | | | | | | | | In the plugin test in QtBase we have a scenario where we have target binaries that are inputs to add_qt_resource(). If we do not remove these files from the dependency list for add_custom_command() cmake will fail to generate the build files. If we mark them as generated source files, we'd have to add a special rule to generate them. Furthermore, using $<TARGET_FILE:...> does not work due processing done by add_qt_resource. To bypass this we check whether the property is set and instead of adding the file to the dependency list we add the target referenced in that property. RCC will still work as expected but will fail if the files aren't present. Change-Id: I16855a54f5606d6fe27ab1347ed7ff4f40392c98 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Create output directory for qmlcachegenJoerg Bornemann2019-10-111-0/+4
| | | | | Change-Id: I395de27bfe0eed46c595ac664b2c7218abbdb28b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Support passing extra arguments to rccJoerg Bornemann2019-09-201-3/+8
| | | | | | | | | | | qt6_add_resources already supported the OPTIONS multi value parameter, but only for the non-target case. Use the same parameter for the target case. Change-Id: Ib5fcb976ecbac244c3b11073b3cdd0c5c6366a87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot
* Store generated resource files in hidden directoriesLeander Beernaert2019-09-191-7/+7
| | | | | | | | | | Store generated qrc, cpp and qmlcachegen file from invocations of add_qt_resource/qt6_add_resources/qt6_process_resources under .rcc in the target's binary directory. Change-Id: I844f97acfabe6b54db85e7a7a0c9c25694452bd3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Fix QtDeclcarative static buildsLeander Beernaert2019-09-181-1/+1
| | | | | | | | Incorrect variable name was being used to set the target in the parent scope. Change-Id: I73ea644ebf94c9b9a62b34b1ad493e488729ff2f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix merge typo in QtResource.cmake.inLeander Beernaert2019-09-161-2/+2
| | | | | | | Output target was named output_target_quick instead of just output_target Change-Id: I3ee0598bb61e654e42cb82b84da46f292d87e2cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix OUTPUT_TARGET propagation in qt6_add_resource()Leander Beernaert2019-09-161-8/+11
| | | | | | | | | | | Value was not being propagated to the parent scope when set. This patch also changes OUTPUT_TARGET to OUTPUT_TARGETS since it is possible that two targets can be generated. Change-Id: If489a609ed363a319224fcd6c5a4fc878d0d8617 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Fix qmlcachegen invocation on Windows, part 2Simon Hausmann2019-09-041-6/+6
| | | | | | | | | | | | Fix up the previous commit and use separate COMMAND parameters for add_custom_command to ensure the expansion of the PATH. The injection via -E env "/some/dir;%PATH%" does not work as the dollar expansion is not applied when the ninja command uses cmd /C. This relies now on undocumented behavior of cmake ;( Change-Id: I5b5fc88e4c13f8fb6c6bba3131204c2eb35404d6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix qtdeclarative build on WindowsSimon Hausmann2019-09-041-4/+6
| | | | | | | | | | | | | | Our tools are typically installed into the Qt bin directory, after which they are useable right away on Windows, since the Qt dlls are located there, too. An exception to the rule are tools that are built within a module and used right away. At that point they are in the top-level bin dir of the build directory, along with "local" DLLS they might need, but with the Qt dlls out of reach. To cover this case, we need to prepend a PATH adjusting command when using these with add_custom_command. Change-Id: I7f58581f5060c8004b5d1fa1f6f17297256783de Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix add_qt_resource to handle resources in static builds properlyAlexandru Croitor2019-08-301-2/+14
| | | | | | | | | | | | | | | | | | Whenever the qml compiler is used to process qml files from a resource, and there are no resources left after all qml files have been processed, make sure to propagate the created resource target to add_qt_resource, so that the target is associated properly with an export name. Additionally the generated qml cache loader file uses private Qml headers. Thus the object library that contains the cpp file should have qml as a dependency (and not the target that will link to the object library). Change-Id: Ib385a900823df3e015492cdd06acd8a0cb9f8e9a Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix static builds after revamp of add_qt_resourceAlexandru Croitor2019-08-301-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first issue is that instead of arg_OUTPUT_TARGET we should use rcc_OUTPUT_TARGET (there was also a typo in the OUTPUT word). The second issue came with the fact that the object library targets that were created for resources had a "Qt6::" namespace prefix in the exported Targets files, and yet the link generator expression did not contain the prefix. This failed when building qtsvg in a static build, because the exported object library could not be found. The solution is to use the TARGET_NAME generator expression which takes care of adjusting the name of the target when exported, thus making the linking work both when building qtbase and when building qtsvg. This had the fallout, that all resource object libraries need to be associated with an export set and installed. This wasn't the case for plugins, because plugins have an export name of the form "FooTargets", whereas the export name for the resource object library is "Qt6FooTargets". Adjust the export names of plugins to be the same as for modules and resource library objects (aka contain the "Qt6 prefix"). Change-Id: I1ca28d20c51e4447e5783cc20571a68ec77f6513 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Link against Qml when using quick compilerLeander Beernaert2019-08-231-1/+1
| | | | | | | | When using the quick compiler to compile qml files, add an explicit dependency on Qml. This will result in linker errors otherwise. Change-Id: Ib7af0e8ec1b48822fd0d3c3556f10d24f10e7489 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace invalid symbols with underscoreLeander Beernaert2019-08-221-0/+1
| | | | | | | | | When building tests for android some resources names had the "#" character in them which triggered a CMake error when use in conjunction with add_custom_target() Change-Id: If5f471eebb027683e86b0c4e38c2f34ff8891b7a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Extract add_qt_resource into reusable componentsLeander Beernaert2019-08-221-0/+270
This patch moves all of the underlying code for add_qt_resource into a common reusable snippet for both the Qt build and user projects. For users, the new API is available under QT5_ADD_RESOURCES. If outfiles is a CMAKE target we will use the new API, otherwise we will fall back to the old behavior. This patch also adds EXTRA_CMAKE_FILES and EXTRA_CMAKE_INCLUDES to add_qt_module so that module specific cmake files can be installed and loaded by the module's config.cmake. The code will be installed under CMAKE_BINARY_DIR/Qt{}CoreResource.cmake and is injected into Qt{}Core_Config.cmake via the extra cmake includes passed into add_qt_module. To make sure it still works with QtBuild, we do the actual generation of the file from QtBaseGlobalTargets and include the generated file there as well. Change-Id: I85fefaa11dde01a6790d23c62d6a64cd157e2617 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>